Class Xml

    • Constructor Detail

      • Xml

        public Xml()
        Constructs a uninitialized (invalid) DomWrapper
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • Xml

        public Xml​(Node node)
        Constructs a new XmlWrapper
        Parameters:
        node - the XML document node that should be wrapped
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • Xml

        public Xml​(String source)
            throws SAXException
        Constructs a new Xml object. If the argument is null or an empty String, a null-object is created. If the (trimmed) argument starts with a '<' symbol, the argument is considered as an XML document and is parsed. Otherwise, a new Xml object is created whose empty document elements name is the argument.
        Parameters:
        source - The name of the document element or an XML document.
        Throws:
        SAXException
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • Xml

        public Xml​(String rootName,
                   String text)
            throws SAXException
        Constructs a new XmlWrapper.
        Parameters:
        rootName - The name of the root element.
        text - The text content of the root element.
        Throws:
        SAXException
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • Xml

        public Xml​(File file)
            throws SAXException,
                   IOException
        Constructs a new Xml object by parsing a file.
        Parameters:
        file - The file that will be parsed.
        Throws:
        IOException
        SAXException
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • Xml

        public Xml​(String rootName,
                   Object[][] arguments)
        Creates a new Xml object.
        Parameters:
        rootName - The name of the document element.
        arguments - An array of arrays of length 1 or 2. If a subarray is of length 1, its element must be a path. If a subarray is of length 2, its first element must be a path, the second element can be any value object. A path is String, and it is a dot-separated list of XML-element names.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
    • Method Detail

      • getLocalName

        public String getLocalName()
        Returns:
        The local name of this nide.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getNodeName

        public String getNodeName()
        Returns:
        The name of this node.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getDOMNode

        public Node getDOMNode()
        Returns the DOM object wrapped by this Xml object.
        Returns:
        a DOM node.
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • getDOMElement

        public Element getDOMElement()
        Returns a DOM element. If this Xml element wrapps a DOM Element, this DOM element is returned. If this Xml element wrapps a DOM Document, the corresponding document element is returned. Otherwise, null is returned.
        Returns:
        A DOM element or null.
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • getNumberOfNodes

        public int getNumberOfNodes​(String xPath)
        Parameters:
        xPath -
        Returns:
        The number of specified subelements by the XPath.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getNode

        public Xml getNode​(String xPath)
                    throws TransformerException
        Returns a subnode specified by an XPath; if the XPath describes several subnodes, the first one is returned.
        Parameters:
        xPath -
        Returns:
        a subnode specified by an XPath.
        Throws:
        TransformerException
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getNodeList

        public List<Xml> getNodeList​(String xPath)
                              throws TransformerException
        Returns a list of Xml objects specified by an XPath.
        Parameters:
        xPath -
        Returns:
        a list of Xml objects specified by the XPath in the argument.
        Throws:
        TransformerException
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getText

        public String getText()
        Returns:
        the text content of this Xml object.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getString

        public String getString​(String xPath)
                         throws TransformerException
        Returns the String-value of a specified element.
        Parameters:
        xPath - An XPath for specifying elements.
        Returns:
        The Stringvalue of the specified Element.
        Throws:
        TransformerException
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getStringList

        public List<String> getStringList​(String xPath)
                                   throws TransformerException
        Returns a list of String-values of specified elements.
        Parameters:
        xPath - An XPath for specifing elements.
        Returns:
        A list of Strings.
        Throws:
        TransformerException
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getNumber

        public Number getNumber​(String xPath)
                         throws TransformerException
        Returns the specified element as a number.
        Parameters:
        xPath -
        Returns:
        The specified element as a number.
        Throws:
        TransformerException
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getNumberList

        public List<Number> getNumberList​(String xPath)
                                   throws TransformerException
        Returns the specified elements in a list of numbers.
        Parameters:
        xPath -
        Returns:
        the specified elements in a list of numbers.
        Throws:
        TransformerException
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getBoolean

        public boolean getBoolean​(String xPath)
                           throws TransformerException
        Returns the specified element as a boolean.
        Parameters:
        xPath -
        Returns:
        boolean value
        Throws:
        TransformerException
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getBooleanList

        public List<Boolean> getBooleanList​(String xPath)
                                     throws TransformerException
        Retrurns the specified elements as a List of Booleans.
        Parameters:
        xPath -
        Returns:
        list of boolean values
        Throws:
        TransformerException
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getDate

        public Date getDate​(String xPath)
                     throws TransformerException
        Returns the specified element as a Date object.
        Parameters:
        xPath -
        Returns:
        the specified element as a Date object.
        Throws:
        TransformerException
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getDateList

        public List<Date> getDateList​(String xPath)
                               throws TransformerException
        Returns the specified elements a a list of Dates.
        Parameters:
        xPath -
        Returns:
        list of Date objects
        Throws:
        TransformerException
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getDateTime

        public DateTime getDateTime​(String xPath)
                             throws TransformerException
        Returns the specified DateTimeObject.
        Parameters:
        xPath -
        Returns:
        the specified DateTimeObject.
        Throws:
        TransformerException
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getDateTimeList

        public List<DateTime> getDateTimeList​(String xPath)
                                       throws TransformerException
        Returns the specified elements as a list of DateTime-objects.
        Parameters:
        xPath -
        Returns:
        list of DateTime objects
        Throws:
        TransformerException
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getTime

        public Time getTime​(String xPath)
                     throws TransformerException
        Returns the specified element as a Time-object.
        Parameters:
        xPath -
        Returns:
        Time object
        Throws:
        TransformerException
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getTimeList

        public List<Time> getTimeList​(String xPath)
                               throws TransformerException
        Return the specified elements as a List of Time-objects.
        Parameters:
        xPath -
        Returns:
        the specified elements as a List of Time-objects.
        Throws:
        TransformerException
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • evaluateXPath

        public Object evaluateXPath​(String xPath)
                             throws TransformerException
        Parameters:
        xPath -
        Returns:
        the text content of the specified subelement
        Throws:
        TransformerException
        API:
        This public API is available in IvyScript and Java. It has the visibility ADVANCED.
      • appendChild

        public void appendChild​(Xml child)
        Import and appends a child element.
        Parameters:
        child -
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • appendChild

        public void appendChild​(String name,
                                Object value)
        Appends a new child.
        Parameters:
        name -
        value -
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • setAttribute

        public void setAttribute​(String name,
                                 Object value)
        Changes an attribute
        Parameters:
        name -
        value -
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • setValue

        public void setValue​(Object value)
        Parameters:
        value -
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • setValue

        public void setValue​(Object value,
                             String xPath)
                      throws TransformerException
        Sets the value of a specified node.
        Parameters:
        value -
        xPath -
        Throws:
        TransformerException
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • remove

        public void remove​(String xPath)
                    throws TransformerException
        Removes specified elements.
        Parameters:
        xPath -
        Throws:
        TransformerException
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • writeToFile

        public boolean writeToFile​(File file)
        Write this XML object to a file.
        Parameters:
        file -
        Returns:
        true if successful, false otherwise.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • writeToFile

        public boolean writeToFile​(String filePath)
        Write this XML object to a file.
        Parameters:
        filePath -
        Returns:
        true if successful, false otherwise.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • clone

        public Xml clone()
        Clones a node (and its owner document).
        Specified by:
        clone in interface IIvyDataObject
        Returns:
        a clone.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • equals

        public boolean equals​(Object obj)
        Implements a different equality behavior.
        Parameters:
        obj -
        Returns:
        true if equal to the argument.
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • isValid

        public boolean isValid()
        Determines whether this is a valid document (or part of a valif document).
        Returns:
        true if initialized (or modified), false if the object is a default object, i.e. a document without any children.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • hashCode

        public int hashCode()
        See Also:
        Object.hashCode()
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • toString

        public String toString()
        Returns:
        a text representation of the xml object. If this object was constructed by the constructor with a string argument, this String is returned. Otherwise, a String representation is constructed by DomXmlPrint.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.