Class Index | File Index

Classes


Class gxe.xml.DomProcessor

Provides utility functions for processing an XML document.
(used when opening an existing document)
Defined in: gxe.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Method Summary
Method Attributes Method Name and Description
 
findMatchingChildAttribute(domParentNode, cfgChild)
Attempts to find the attribute of a DOM Node that matches the XML target associated with an editor configuration object.
 
findMatchingChildElement(domParentNode, cfgChild)
Attempts to find an immediate child element of a DOM Node that matches the XML target associated with an editor configuration object.
 
findMatchingChildElements(domParentNode, cfgChild)
Attempts to find the immediate child elements of a DOM Node that match the XML target associated with an editor configuration object.
 
forEachElementNode(domParentNode, callback)
Executes a function for each immediate child element of a DOM Node.
 
forEachMatchingElementNode(domParentNode, sNamespaceUri, sLocalName, callback)
Executes a function for each immediate child element of a DOM Node that matches a supplied namespace and loca name.
 
getNodeText(domNode)
Gets the text content of a DOM Node (element or attribute).
 
Determines if a DOM Node has either: attributes, child elements or element text.
 
isMatching(domNode, cfgObject)
Determines if the qualified name associated with a DOM Node matches the XML target associated with an editor configuration object.
 
matchTopElement(xmlNamespaces, domNode, sMatchPath, sMatchTextNodeValue, bMust)
Determines if there is a match between a supplied DOM Node and a descendant condition.
 
splitQualifiedName(sQualifiedName)
Splits a qualified name into a prefix plus localName pair.
Class Detail
gxe.xml.DomProcessor()
Method Detail
{Node} findMatchingChildAttribute(domParentNode, cfgChild)
Attempts to find the attribute of a DOM Node that matches the XML target associated with an editor configuration object.
Parameters:
{Node} domParentNode
the DOM node whose attributes will be searched
{Object} cfgChild
the editor configuration object that will be used to determine a match
Returns:
{Node} a matching DOM attribute (null if no match)
See:
gxe.xml.DomProcessor#isMatching

{Node} findMatchingChildElement(domParentNode, cfgChild)
Attempts to find an immediate child element of a DOM Node that matches the XML target associated with an editor configuration object.
Parameters:
{Node} domParentNode
the DOM node whose children will be searched
{Object} cfgChild
the editor configuration object that will be used to determine a match
Returns:
{Node} a matching DOM element (null if no match)
See:
gxe.xml.DomProcessor#isMatching

{Node[]} findMatchingChildElements(domParentNode, cfgChild)
Attempts to find the immediate child elements of a DOM Node that match the XML target associated with an editor configuration object.
Parameters:
{Node} domParentNode
the DOM node whose children will be searched
{Object} cfgChild
the editor configuration object that will be used to determine a match
Returns:
{Node[]} the matching DOM elements (null if no match)
See:
gxe.xml.DomProcessor#isMatching

forEachElementNode(domParentNode, callback)
Executes a function for each immediate child element of a DOM Node.
Only child elements of nodeType=1 (ELEMENT_NODE) will be considered.

The callback function will have the following signature: function(domChildNode) {}
The callback function can return the String "break" to terminate the loop.
Parameters:
{Node} domParentNode
the DOM node whose children will be searched
{function} callback
the callback function

forEachMatchingElementNode(domParentNode, sNamespaceUri, sLocalName, callback)
Executes a function for each immediate child element of a DOM Node that matches a supplied namespace and loca name.
Only child elements of nodeType=1 (ELEMENT_NODE) will be considered.

The callback function will have the following signature: function(domChildNode) {}
The callback function can return the String "break" to terminate the loop.
Parameters:
{Node} domParentNode
the DOM node whose children will be searched
{String} sNamespaceUri
the namespace URI to match (can be null)
{String} sLocalName
the local node name to match (i.e unqualified name)
{function} callback
the callback function

{String} getNodeText(domNode)
Gets the text content of a DOM Node (element or attribute).
Parameters:
{Node} domNode
the DOM node that is actively being processed
Returns:
{String} the text content (can be null)

{boolean} hasChildrenOrAttributes(domNode)
Determines if a DOM Node has either: attributes, child elements or element text.
Parameters:
{Node} domNode
the DOM node that is actively being processed
Returns:
{boolean} true if there is a match

{boolean} isMatching(domNode, cfgObject)
Determines if the qualified name associated with a DOM Node matches the XML target associated with an editor configuration object.
Editor configuration example for referencing a target XML element:
<g:element g:targetName="pfx:name" ..
Parameters:
{Node} domNode
the DOM node that is actively being processed
{Object} cfgObject
the associated editor configuration object
Returns:
{boolean} true if there is a match

{boolean} matchTopElement(xmlNamespaces, domNode, sMatchPath, sMatchTextNodeValue, bMust)
Determines if there is a match between a supplied DOM Node and a descendant condition.

Note: matchTopElement does not support full XPath expressions
Parameters:
{gxe.xml.XmlNamespaces} xmlNamespaces
a configured list of target namespaces
{Node} domNode
the DOM node that is actively being processed
{String} sMatchPath
the relative path for the element to match (a simple path relative to the supplied parent DOM node)
{String} sMatchTextNodeValue
the text node value to match (null indicates no test should be made)
{boolean} bMust
true indicates that there must be a match (false indicates must not)
Returns:
{boolean} true if there is a match

{"prefix":{String}|"localName":{String}} splitQualifiedName(sQualifiedName)
Splits a qualified name into a prefix plus localName pair.
Parameters:
{String} sQualifiedName
the qualified name
Returns:
{"prefix":{String}|"localName":{String}} the prefix plus localName pair