Package ch.ivyteam.ivy.scripting.objects
Class Xml
java.lang.Object
ch.ivyteam.ivy.scripting.objects.Xml
- All Implemented Interfaces:
IIvyDataObject
,Serializable
,Cloneable
Used by the CSLXmlClass to hold the data of the sys objects of the
Xml class. This wrapper wraps a DOM Node
- Version:
- umk, 21.3.2001
- See Also:
- API:
- This is a public API.
-
Constructor Summary
ConstructorDescriptionXml()
Constructs a uninitialized (invalid) DomWrapperConstructs a new Xml object by parsing a file.Constructs a new Xml object.Creates a new Xml object.Constructs a new XmlWrapper.Constructs a new XmlWrapper -
Method Summary
Modifier and TypeMethodDescriptionvoid
appendChild
(Xml child) Import and appends a child element.void
appendChild
(String name, Object value) Appends a new child.clone()
Clones a node (and its owner document).boolean
Implements a different equality behavior.evaluateXPath
(String xPath) boolean
getBoolean
(String xPath) Returns the specified element as a boolean.getBooleanList
(String xPath) Retrurns the specified elements as a List of Booleans.Returns the specified element as a Date object.getDateList
(String xPath) Returns the specified elements a a list of Dates.getDateTime
(String xPath) Returns the specified DateTimeObject.getDateTimeList
(String xPath) Returns the specified elements as a list of DateTime-objects.Returns a DOM element.Returns the DOM object wrapped by this Xml object.Returns a subnode specified by an XPath; if the XPath describes several subnodes, the first one is returned.getNodeList
(String xPath) Returns a list of Xml objects specified by an XPath.Returns the specified element as a number.getNumberList
(String xPath) Returns the specified elements in a list of numbers.int
getNumberOfNodes
(String xPath) Returns the String-value of a specified element.getStringList
(String xPath) Returns a list of String-values of specified elements.getText()
Returns the specified element as a Time-object.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
Removes specified elements.void
setAttribute
(String name, Object value) Changes an attributevoid
void
Sets the value of a specified node.toString()
boolean
writeToFile
(File file) Write this XML object to a file.boolean
writeToFile
(String filePath) Write this XML object to a file.
-
Constructor Details
-
Xml
public Xml()Constructs a uninitialized (invalid) DomWrapper- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
Xml
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
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
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
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
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 Details
-
getLocalName
- Returns:
- The local name of this nide.
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
getNodeName
- Returns:
- The name of this node.
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
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
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
- 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
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
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
- Returns:
- the text content of this Xml object.
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
getString
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
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
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
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
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
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
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
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
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
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
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
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
- 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
Import and appends a child element.- Parameters:
child
-- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
appendChild
Appends a new child.- Parameters:
name
-value
-- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
setAttribute
Changes an attribute- Parameters:
name
-value
-- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
setValue
- Parameters:
value
-- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
setValue
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
Removes specified elements.- Parameters:
xPath
-- Throws:
TransformerException
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
writeToFile
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
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
Clones a node (and its owner document).- Specified by:
clone
in interfaceIIvyDataObject
- Returns:
- a clone.
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
equals
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:
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
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.
-