XML.js
What for?
XML.js provides helper functions for XML manipulation, including conversion of documents into JXON objects. It is built on top of xmldom & xpath modules and brings common XML-related features together into a simplistic API.
API
XML#parse
{ ... //-> DOMDocument
XML#load
{ ... //-> DOMDocument
XML#serialize
{ ... //-> String
XML#query
{ ... //-> [Node]
Example
XML;XML;
JXON
convert
{ ... //-> {Object}
Example
Given document
is the following:
<![CDATA[ Will call back tomorrow. ]]>
Resulting JXON object, converted with JXON.convert(document)
, would be:
"contact": "firstName": "George" "lastName": "Cartier" "*": "notes": "*": "#D": "Will call back tomorrow."
compact
{ ... //-> {Object}
Example
When not compacted, previous result would be the following, which could be compacted afterwards with JXON#compact
:
"contact": "@firstName": "George" "@lastName": "Cartier" "children": "#TEXT": "\n " "notes": "children": "#TEXT": "\n " "#CDATA": "\n Will call back tomorrow.\n " "#TEXT": "\n " "#TEXT": "\n "
More?
Please have a look to the test fixtures!