Javascript XML manipulation inspired on jQuery.
When trying to manipulate XML data using jQuery, I realized that all the elements and attributes are turned into lower-case and, in some cases, the code do not work well on IE.
| append (value) | Append an element |
| attr (name, [value]) | Get os set an attribute |
| clone ([deep]) | Clone the set of elements |
| eq (idx) | Returns the element at nth position |
| find (elementName) | Returns the elements with the specified name |
| first () | Returns the first element in the set |
| last () | Returns the last element in the set |
| serialize () | Returns the serialized xml |
| size () | Returns the number of elements in the set |
var myXMLData = '<root><myData dataType="Boolean">True</myData></root>',
myXMLQuery = $X(myXMLData);
console.log('Serialized XML: ' + myXMLQuery.serialize());
// returns: Serialized XML: <root><myData dataType="Boolean">True</myData></root>
console.log('Attribute: ' + myXMLQuery.find('myData').attr('dataType'));
// returns: Attribute: BooleanCreated by Thiago Laubstein.