Class Saplings


  • public class Saplings
    extends Object
    This is a non-instantiable class holding a number of convenience methods for creating sapling nodes of different kinds.
    See Also:
    SaplingNode
    • Method Detail

      • doc

        public static SaplingDocument doc()
        Create a sapling document node, with no children
        Returns:
        the new node
      • doc

        public static SaplingDocument doc​(String baseUri)
        Create a sapling document node with a specified base URI, with no children
        Parameters:
        baseUri - the base URI of the document
        Returns:
        the new node
      • elem

        public static SaplingElement elem​(String name)
        Create a sapling element node, in no namespace, with no attributes and no children
        Parameters:
        name - the local name of the element node. This must be a valid NCName, but the current implementation does not check this.
        Returns:
        the new node
      • elem

        public static SaplingElement elem​(QName qName)
        Create a sapling element node, which may or may not be in a namespace, with no attributes and no children
        Parameters:
        qName - the qualified name of the element. The current implementation does not check that the parts of the qualified name are syntactically valid.
        Returns:
        the new node
      • text

        public static SaplingText text​(String value)
        Create a sapling text node, with a given string value
        Parameters:
        value - the string value of the text node
        Returns:
        the new node
      • comment

        public static SaplingComment comment​(String value)
        Create a sapling comment node, with a given string value
        Parameters:
        value - the string value of the comment node. This must not contain "--" as a substring, but the current implementation does not check this.
        Returns:
        the new node
      • pi

        public static SaplingProcessingInstruction pi​(String target,
                                                      String data)
        Create a sapling processing instruction node, with a given name and string value
        Parameters:
        target - the target (name) of the processing instruction. This must be a valid NCName, but the current implementation does not check this.
        data - the string value of the processing instruction node. This must not contain "?>" as a substring, but the current implementation does not check this.
        Returns:
        the new node