Functions of ballerina.lang.xmls package
function addAttribute(xml x, string xPath, string name, string value, map namespaces)
Adds an attribute to the XML element that matches the given XPath. If the XPath matches the text value of an existing element, or if the XPath does not match an existing element, this operation will have no effect. Namespaces are supported.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
x | xml | An XML object |
xPath | string | An XPath |
name | string | Name of the attribute to be added |
value | string | Attribute value |
namespaces | map | A map object consisting of namespaces |
function addAttribute(xml x, string xPath, string name, string value)
Adds an attribute to the XML element that matches the given XPath. If the XPath matches the text value of an existing element, or if the XPath does not match an existing element, this operation will have no effect.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
x | xml | An XML object |
xPath | string | An XPath |
name | string | Name of the attribute to be added |
value | string | Attribute value |
function addElement(xml x, string xPath, xml value, map namespaces)
Adds an XML element to the location that matches the given XPath. If the XPath matches the text value of an existing element, or if the XPath does not match an existing element, this operation will have no effect. Namespaces are supported.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
x | xml | An XML object |
xPath | string | An XPath |
value | xml | An XML value |
namespaces | map | A map object consisting of namespaces |
function addElement(xml x, string xPath, xml value)
Adds an XML element to the location that matches the given XPath. If the XPath matches the text value of an existing element, or if the XPath does not match an existing element, this operation will have no effect.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
x | xml | An XML object |
xPath | string | An XPath |
value | xml | An XML value |
function getString(xml x, string xPath) (string )
Evaluates the XPath on an XML object and returns the matching string value.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
x | xml | An XML object |
xPath | string | An XPath |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
string | Matching string value |
function getString(xml x, string xPath, map namespaces) (string )
Evaluates the XPath on an XML object and returns the matching string value. Namespaces are supported.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
x | xml | An XML object |
xPath | string | An XPath |
namespaces | map | A map object consisting of namespaces |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
string | Matching string value |
function getXml(xml x, string xPath, map namespaces) (xml )
Evaluates the XPath on an XML object and returns the matching XML object. Namespaces are supported
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
x | xml | An XML object |
xPath | string | An XPath |
namespaces | map | A map object consisting of namespaces |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
xml | Matching XML object |
function getXml(xml x, string xPath) (xml )
Evaluates the XPath on an XML object and returns the matching XML object.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
x | xml | An XML object |
xPath | string | An XPath |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
xml | Matching XML object |
function remove(xml x, string xPath, map namespaces)
Removes the element(s) that match the given XPath. Namespaces are supported.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
x | xml | An XML object |
xPath | string | An XPath |
namespaces | map | A map object consisting of namespaces |
function remove(xml x, string xPath)
Removes the element(s) that match the given XPath.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
x | xml | An XML object |
xPath | string | An XPath |
function set(xml x, string xPath, string value, map namespaces)
Sets the string value of an element that matches the given XPath. If the XPath matches an existing element, that element's value will be updated. If the XPath does not match an existing element, this operation will have no effect. Namespaces are supported.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
x | xml | An XML object |
xPath | string | An XPath |
value | string | A string value |
namespaces | map | A map object consisting of namespaces |
function set(xml x, string xPath, xml value, map namespaces)
Sets the XML value of an element that matches the given XPath. If the XPath matches an existing element, that element's value will be updated. If the XPath does not match an existing element, this operation will have no effect. Namespaces are supported.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
x | xml | An XML object |
xPath | string | An XPath |
value | xml | An XML value |
namespaces | map | A map object consisting of namespaces |
function set(xml x, string xPath, string value)
Sets the string value of an element that matches the given XPath. If the XPath matches an existing element, that element's value will be updated. If the XPath does not match an existing element, this operation will have no effect.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
x | xml | An XML object |
xPath | string | An XPath |
value | string | x: An XML object |
function set(xml x, string xPath, xml value)
Sets the XML value of an element that matches the given XPath. If the XPath matches an existing element, that element's value will be updated. If the XPath does not match an existing element, this operation will have no effect.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
x | xml | An XML object |
xPath | string | An XPath |
value | xml | An XML value |
function toString(xml x) (string )
Converts an XML object to a string representation.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
x | xml | An XML object |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
string | String value of the converted XML |