public class Xml extends Object implements IIvyDataObject
Constructor and Description |
---|
Xml()
Constructs a uninitialized (invalid) DomWrapper
|
Xml(File file)
Constructs a new Xml object by parsing a file.
|
Xml(Node node)
Constructs a new XmlWrapper
|
Xml(String source)
Constructs a new Xml object.
|
Xml(String rootName,
Object[][] arguments)
Creates a new Xml object.
|
Xml(String rootName,
String text)
Constructs a new XmlWrapper.
|
Modifier and Type | Method and Description |
---|---|
void |
appendChild(String name,
Object value)
Appends a new child.
|
void |
appendChild(Xml child)
Import and appends a child element.
|
Xml |
clone()
Clones a node (and its owner document).
|
boolean |
equals(Object obj)
Implements a different equality behavior.
|
Object |
evaluateXPath(String xPath) |
boolean |
getBoolean(String xPath)
Returns the specified element as a boolean.
|
List<Boolean> |
getBooleanList(String xPath)
Retrurns the specified elements as a List of Booleans.
|
Date |
getDate(String xPath)
Returns the specified element as a Date object.
|
List<Date> |
getDateList(String xPath)
Returns the specified elements a a list of Dates.
|
DateTime |
getDateTime(String xPath)
Returns the specified DateTimeObject.
|
List<DateTime> |
getDateTimeList(String xPath)
Returns the specified elements as a list of DateTime-objects.
|
Element |
getDOMElement()
Returns a DOM element.
|
Node |
getDOMNode()
Returns the DOM object wrapped by this Xml object.
|
String |
getLocalName() |
Xml |
getNode(String xPath)
Returns a subnode specified by an XPath;
if the XPath describes several subnodes, the first one is returned.
|
List<Xml> |
getNodeList(String xPath)
Returns a list of Xml objects specified by an XPath.
|
String |
getNodeName() |
Number |
getNumber(String xPath)
Returns the specified element as a number.
|
List<Number> |
getNumberList(String xPath)
Returns the specified elements in a list of numbers.
|
int |
getNumberOfNodes(String xPath) |
String |
getString(String xPath)
Returns the String-value of a specified element.
|
List<String> |
getStringList(String xPath)
Returns a list of String-values of specified elements.
|
String |
getText() |
Time |
getTime(String xPath)
Returns the specified element as a Time-object.
|
List<Time> |
getTimeList(String xPath)
Return the specified elements as a List of Time-objects.
|
int |
hashCode() |
boolean |
isValid()
Determines whether this is a valid document (or part of a valif document).
|
void |
remove(String xPath)
Removes specified elements.
|
void |
setAttribute(String name,
Object value)
Changes an attribute
|
void |
setValue(Object value) |
void |
setValue(Object value,
String xPath)
Sets the value of a specified node.
|
String |
toString() |
boolean |
writeToFile(File file)
Write this XML object to a file.
|
boolean |
writeToFile(String filePath)
Write this XML object to a file.
|
deepClone
public Xml()
public Xml(Node node)
node
- the XML document node that should be wrappedpublic Xml(String source)
source
- The name of the document element or an XML document.SAXException
public Xml(String rootName, String text)
rootName
- The name of the root element.text
- The text content of the root element.SAXException
public Xml(File file) throws IOException
file
- The file that will be parsed.IOException
SAXException
public Xml(String rootName, Object[][] arguments)
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.public String getLocalName()
public String getNodeName()
public Node getDOMNode()
public Element getDOMElement()
public int getNumberOfNodes(String xPath)
xPath
- public Xml getNode(String xPath) throws TransformerException
xPath
- TransformerException
public List<Xml> getNodeList(String xPath) throws TransformerException
xPath
- TransformerException
public String getText()
public String getString(String xPath) throws TransformerException
xPath
- An XPath for specifying elements.TransformerException
public List<String> getStringList(String xPath) throws TransformerException
xPath
- An XPath for specifing elements.TransformerException
public Number getNumber(String xPath) throws TransformerException
xPath
- TransformerException
public List<Number> getNumberList(String xPath) throws TransformerException
xPath
- TransformerException
public boolean getBoolean(String xPath) throws TransformerException
xPath
- TransformerException
public List<Boolean> getBooleanList(String xPath) throws TransformerException
xPath
- TransformerException
public Date getDate(String xPath) throws TransformerException
xPath
- TransformerException
public List<Date> getDateList(String xPath) throws TransformerException
xPath
- TransformerException
public DateTime getDateTime(String xPath) throws TransformerException
xPath
- TransformerException
public List<DateTime> getDateTimeList(String xPath) throws TransformerException
xPath
- TransformerException
public Time getTime(String xPath) throws TransformerException
xPath
- TransformerException
public List<Time> getTimeList(String xPath) throws TransformerException
xPath
- TransformerException
public Object evaluateXPath(String xPath) throws TransformerException
xPath
- TransformerException
public void appendChild(Xml child)
child
- public void appendChild(String name, Object value)
name
- value
- public void setAttribute(String name, Object value)
name
- value
- public void setValue(Object value)
value
- public void setValue(Object value, String xPath) throws TransformerException
value
- xPath
- TransformerException
public void remove(String xPath) throws TransformerException
xPath
- TransformerException
public boolean writeToFile(File file)
file
- public boolean writeToFile(String filePath)
filePath
- public Xml clone()
clone
in interface IIvyDataObject
clone
in class Object
public boolean equals(Object obj)
public boolean isValid()
public int hashCode()
hashCode
in class Object
Object.hashCode()
public String toString()
toString
in class Object
Copyright © 2024
AXON IVY AG
All Rights Reserved Documentation was generated
on April 28, 2024