Class ProcessingInstruction

  • All Implemented Interfaces:
    java.io.Serializable

    public class ProcessingInstruction
    extends XPathNode
    A class representing a Processing Instruction
    Version:
    $Revision: 3633 $ $Date: 2003-03-01 08:38:44 +0100 (Sat, 01 Mar 2003) $
    Author:
    Keith Visco
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      ProcessingInstruction​(java.lang.String target, java.lang.String value)
      Creates a new ProcessingInstruction
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getAttribute​(java.lang.String uri, java.lang.String local)
      Returns the value of the named attribute, or null if the node has no such attribute.
      XPathNode getFirstAttribute()
      Returns the first in a list of attribute nodes, or null if the node has no attributes.
      XPathNode getFirstChild()
      Returns the first child node of this node, or null if the node has no children.
      XPathNode getFirstNamespace()
      Returns the first in a list of namespace nodes, or null if the node has no namespaces.
      java.lang.String getLocalName()
      Returns the local name of the node.
      java.lang.String getNamespacePrefix​(java.lang.String uri)
      Returns the namespace prefix associated with this namespace URI, as defined in the context of this node.
      java.lang.String getNamespaceURI()
      Returns the namespace URI the node.
      java.lang.String getNamespaceURI​(java.lang.String prefix)
      Returns the namespace URI associated with this namespace prefix, as defined in the context of this node.
      XPathNode getNext()
      Returns the next sibling node in document order, or null if this node is the last node.
      int getNodeType()
      Returns the type of this node.
      XPathNode getParentNode()
      Returns the parent node, or null if the node has no parent.
      XPathNode getPrevious()
      Returns the previous sibling node in document order, or null if this node is the first node.
      java.lang.Object getProperty​(java.lang.String name)
      Retrieves the property with the given name.
      XPathNode getRootNode()
      Returns the root node.
      java.lang.String getStringValue()
      Returns the string value of the node.
      boolean hasChildNodes()
      Returns true if this node has any child nodes.
      void setProperty​(java.lang.String name, java.lang.Object obj)
      Retrieves the property with the given name.
      void setTarget​(java.lang.String target)
      Sets the target for this XPathNode
      void setValue​(java.lang.String value)
      Sets the value for this XPathNode
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LOCATION_PROPERTY

        public static final java.lang.String LOCATION_PROPERTY
        See Also:
        Constant Field Values
    • Constructor Detail

      • ProcessingInstruction

        public ProcessingInstruction​(java.lang.String target,
                                     java.lang.String value)
        Creates a new ProcessingInstruction
        Parameters:
        target - the target for this PI. [May be null]
        value - the value of this PI. [May be null]
    • Method Detail

      • getNodeType

        public int getNodeType()
        Returns the type of this node.
        Returns:
        The type of this node
      • getStringValue

        public java.lang.String getStringValue()
        Returns the string value of the node. The string value of a text node or an attribute node is it's text value. The string value of an element or a root node is the concatenation of the string value of all its child nodes. The string value of a namespace node is its namespace URI. The string value of a processing instruction is the instruction, and the string value of a comment is the comment text.
        Returns:
        The string value of the node
      • setValue

        public void setValue​(java.lang.String value)
        Sets the value for this XPathNode
      • setTarget

        public void setTarget​(java.lang.String target)
        Sets the target for this XPathNode
      • getFirstChild

        public XPathNode getFirstChild()
        Returns the first child node of this node, or null if the node has no children. Child nodes are only returned for an element or root node.
        Specified by:
        getFirstChild in class XPathNode
        Returns:
        The first child node of this node, or null
      • hasChildNodes

        public boolean hasChildNodes()
        Returns true if this node has any child nodes.
        Specified by:
        hasChildNodes in class XPathNode
        Returns:
        True if this node has any child nodes.
      • getNext

        public XPathNode getNext()
        Returns the next sibling node in document order, or null if this node is the last node. This method is value for any node except the root node.
        Specified by:
        getNext in class XPathNode
        Returns:
        The next sibling node in document order, or null
      • getPrevious

        public XPathNode getPrevious()
        Returns the previous sibling node in document order, or null if this node is the first node. This method can is valid for any node except the root node.
        Specified by:
        getPrevious in class XPathNode
        Returns:
        The previous sibling node in document order, or null
      • getFirstAttribute

        public XPathNode getFirstAttribute()
        Returns the first in a list of attribute nodes, or null if the node has no attributes. This method is valid only for the element node.
        Specified by:
        getFirstAttribute in class XPathNode
        Returns:
        The first in a list of attribute nodes, or null
      • getAttribute

        public java.lang.String getAttribute​(java.lang.String uri,
                                             java.lang.String local)
        Returns the value of the named attribute, or null if the node has no such attribute. If the argument uri is null, the node's namespace URI will be used. This method is valid only for the element node.
        Specified by:
        getAttribute in class XPathNode
        Parameters:
        uri - The attribute's namespace URI, or null
        local - The attribute's local name
        Returns:
        The attribute's value, or null if no such attribute exists
      • getFirstNamespace

        public XPathNode getFirstNamespace()
        Returns the first in a list of namespace nodes, or null if the node has no namespaces. This method is valid only for the element node.
        Specified by:
        getFirstNamespace in class XPathNode
        Returns:
        The first in a list of namespace nodes, or null
      • getLocalName

        public java.lang.String getLocalName()
        Returns the local name of the node. Returns the local name of an element or attribute, the prefix of a namespace node, the target of a processing instruction, or null for all other node types.
        Specified by:
        getLocalName in class XPathNode
        Returns:
        The local name of the node, or null if the node has no name
      • getNamespaceURI

        public java.lang.String getNamespaceURI()
        Returns the namespace URI the node. Returns the namespace URI of an element, attribute or namespace node, or null for all other node types.
        Specified by:
        getNamespaceURI in class XPathNode
        Returns:
        The namespace URI of the node, or null if the node has no namespace URI
      • getParentNode

        public XPathNode getParentNode()
        Returns the parent node, or null if the node has no parent. This method is valid on all node types except the root node. Attribute and namespace nodes have the element as their parent node.
        Specified by:
        getParentNode in class XPathNode
        Returns:
        The parent node, or null
      • getProperty

        public java.lang.Object getProperty​(java.lang.String name)
        Retrieves the property with the given name. This method, in conjuction with #setProperty, allows for a convenient way to store information that doesn't have it's own accessor methods.
        Parameters:
        name - the name of the property to return.
        See Also:
        setProperty(java.lang.String, java.lang.Object)
      • getNamespaceURI

        public java.lang.String getNamespaceURI​(java.lang.String prefix)
        Returns the namespace URI associated with this namespace prefix, as defined in the context of this node. Returns null if the prefix is undefined. Returns empty if the prefix is defined and associated with no namespace. This method is valid only for element nodes.
        Specified by:
        getNamespaceURI in class XPathNode
        Parameters:
        prefix - The namespace prefix
        Returns:
        The namespace URI, or null
      • getNamespacePrefix

        public java.lang.String getNamespacePrefix​(java.lang.String uri)
        Returns the namespace prefix associated with this namespace URI, as defined in the context of this node. Returns null if no prefix is defined for this namespace URI. Returns an empty string if the default prefix is associated with this namespace URI. This method is valid only for element nodes.
        Specified by:
        getNamespacePrefix in class XPathNode
        Parameters:
        uri - The namespace URI
        Returns:
        The namespace prefix, or null
      • setProperty

        public void setProperty​(java.lang.String name,
                                java.lang.Object obj)
        Retrieves the property with the given name. This method, in conjuction with #setProperty, allows for a convenient way to store information that doesn't have it's own accessor methods.
        Parameters:
        name - the name of the property to return.
        See Also:
        setProperty(java.lang.String, java.lang.Object)