Attributes
Checking for Attributes in XML
Reading Attributes from XML
attr method returns a wrapper of the XML attribute and with value the value of the attribute can be accessed.
If you want to access an attribute in another namespace, you have to use the attrNs method.
Writing Attributes to XML
It is possible to set a new attribute value directly from the element wrapper or on the attribute wrapper.Removing Attributes from XML
It is possible to remove an attribute from the element directly or to remove the attribute itself.Text Content
It is possible to read and write the text content of an XML element with thetextContent method.
Child Elements
Reading Child Elements from XML
Besides attributes, you can also get a unique or all child elements of a specific type. Optionally, a namespace can be passed to the methods as first parameter.Append Child Elements
The methodappend is used to append a single or multiple child elements to an XML element.
Remove Child Elements
To remove child elements from an XML element, the methodremove is used. It accepts single or multiple child elements and removes them from the parent element.
Replace Elements
To replace an element or a child element, the methodsreplace and replaceChild are used.