class
SAPO.Utility.XML
Namespace with a set of xml utility functions
Defined in
Utility/XML/0.1/lib.js
Function Summary
Returns the document that owns the node
Parses a html fragment into a dom fragment within a given document.
Unlike parseHTMLNode, the returned fragment can have multiple
nodes on the fragment root.
Parses a html fragment into a dom node within a given document.
Parses a xml fragment into astandalone document.
Parses a xml fragment into a dom fragment within a given namespace context
and document. Unlike parseXMLNode, the returned fragment can have multiple
nodes on the fragment root.
Parses a xml fragment into a dom node within a given namespace context
and document.
Encodes all special xml, control and non ascii chars into entities
Function Details
function ownerDocument
Document
ownerDocument(Node
node)
Returns the document that owns the node
Parameters:
node
to fetch ownerDocument from
Returns:
{Document} the ownerDocument
function parseHTMLFragment
DocumentFragment
parseHTMLFragment(Node
contextNode, String
xmlStr)
Parses a html fragment into a dom fragment within a given document.
Unlike parseHTMLNode, the returned fragment can have multiple
nodes on the fragment root.
Parameters:
contextNode
context node. It's used to know the
ownerDocument of the resulting tree and any inherited
namespaces.
xmlStr
the xml string to parse
Returns:
{DocumentFragment} the parsed tree
function parseHTMLNode
Parses a html fragment into a dom node within a given document.
Parameters:
contextNode
context node. It's used to know the
ownerDocument of the resulting tree and any inherited
namespaces.
htmlStr
the html string to parse
Returns:
{Element} the parsed tree
function parseXMLDocument
Document
parseXMLDocument(String
xmlStr)
Parses a xml fragment into astandalone document.
Parameters:
xmlStr
the xml string to parse
Returns:
{Document} the parsed document
function parseXMLFragment
DocumentFragment
parseXMLFragment(Node
contextNode, String
xmlStr)
Parses a xml fragment into a dom fragment within a given namespace context
and document. Unlike parseXMLNode, the returned fragment can have multiple
nodes on the fragment root.
Parameters:
contextNode
context node. It's used to know the
ownerDocument of the resulting tree and any inherited
namespaces.
xmlStr
the xml string to parse
Returns:
{DocumentFragment} the parsed tree
function parseXMLNode
Parses a xml fragment into a dom node within a given namespace context
and document.
Parameters:
contextNode
context node. It's used to know the
ownerDocument of the resulting tree and any inherited
namespaces.
xmlStr
the xml string to parse
Returns:
{Element} the parsed tree
function serialize
String
serialize(Node
node, Boolean
deep)
Serializes the given node into a xml string
Parameters:
node
node to serialize
deep
if false, only serializes the given node, else it serializes the whole subtree.
Returns:
{String} the xml string
function xmlEncodeEntities
Encodes all special xml, control and non ascii chars into entities
Parameters:
xmlStr
the string to encode
Returns:
{String} the encoded string with entities