1 DocumentBuilderFactory

Class Ax.xml.DocumentBuilderFactory


XML Document Builder Factory to parse files into XML Documents. Wrapper for DocumentBuilderFactory. TO VALIDATE SEE: http://www.edankert.com/validate.html https://stackoverflow.com/questions/60603441/java-xml-parser-adding-unnecessary-xmlns-and-xmlspace-attributes

Constructor Summary

Method
Description
Creates a new Document Builder Factory instance.

Method Summary

Modifier and Type
Method
Description
Ax.xml.Document 
parse(Object data)
Builds an XML document from an ImputStream convertible object (File, URL, Blob .
Ax.xml.Document 
parse(Ax.io.File file)
Builds an XML document from the contents of a file.
Ax.xml.Document 
parse(Ax.io.File file, Ax.text.String encoding)
Builds an XML document from the contents of a file, with the defined charset encoding.
Ax.xml.Document 
parse(Object data,Ax.text.String encoding)
Builds an XML document from an InputStream convertible object (File, URL, Blob .
Ax.xml.DocumentBuilderFactory 
setAttribute(Ax.text.String name, Ax.text.String value)
Set the specific attribute name to the value.
Ax.xml.DocumentBuilderFactory 
setCoalescing(boolean coalescing)
Specifies that the parser produced by this code will convert CDATA nodes to Text nodes and append it to the adjacent (if any) text node.
Ax.xml.DocumentBuilderFactory 
Specifies the function to map the entity name for publicId and systemId.
Installs an error handler and returns an empty array list that will hold errors after parse.
Ax.xml.DocumentBuilderFactory 
setExpandEntityReferences(boolean expandEntityRef)
Specifies that the parser produced by this code will expand entity reference nodes.
Ax.xml.DocumentBuilderFactory 
setFeature(Ax.text.String name,boolean value)
Set a feature for this DocumentBuilderFactory and DocumentBuilders created by this factory.
Ax.xml.DocumentBuilderFactory 
setIgnoringComments(boolean ignoreComments)
Specifies that the parser produced by this code will ignore comments.
Ax.xml.DocumentBuilderFactory 
Specifies that the parsers created by this factory must eliminate whitespace in element content (sometimes known loosely as 'ignorable whitespace') when parsing XML documents (see XML Rec 2.
Ax.xml.DocumentBuilderFactory 
setNamespaceAware(boolean awareness)
Specifies that the parser produced by this code will provide support for XML namespaces.
Ax.xml.DocumentBuilderFactory 
setSchema(Schema schema)
Set the Schema to be used by parsers created from this factory.
Ax.xml.DocumentBuilderFactory 
setValidating(boolean validating)
Specifies that the parser produced by this code will validate documents as they are parsed.
Ax.xml.DocumentBuilderFactory 
setXIncludeAware(boolean state)
Set state of XInclude processing.

Constructor Detail

Ax.xml.DocumentBuilderFactory.JSXMLDocumentBuilderFactory

Ax.xml.DocumentBuilderFactory.JSXMLDocumentBuilderFactory()
Info:
Creates a new Document Builder Factory instance.

Method Detail

Ax.xml.DocumentBuilderFactory.parse

object Ax.xml.DocumentBuilderFactory.parse(
	object data
)
Info:
Builds an XML document from an ImputStream convertible object (File, URL, Blob ...).
Parameters:
data - any convertible to inputStream
Returns:
object

Ax.xml.DocumentBuilderFactory.parse

object Ax.xml.DocumentBuilderFactory.parse(
	file file
)
Info:
Builds an XML document from the contents of a file.
Parameters:
file - a JavaScript file object
Returns:
object

Ax.xml.DocumentBuilderFactory.parse

object Ax.xml.DocumentBuilderFactory.parse(
	file file,
	string encoding
)
Info:
Builds an XML document from the contents of a file, with the defined charset encoding.
Parameters:
file - a JavaScript file object
encoding - the charset encoding to use
Returns:
object

Ax.xml.DocumentBuilderFactory.parse

object Ax.xml.DocumentBuilderFactory.parse(
	object data,
	string encoding
)
Info:
Builds an XML document from an InputStream convertible object (File, URL, Blob ...), with the defined charset encoding.
Parameters:
data - any convertible to inputStream
encoding - the charset encoding to use
Returns:
object

Ax.xml.DocumentBuilderFactory.setAttribute

object Ax.xml.DocumentBuilderFactory.setAttribute(
	string name,
	string value
)
Info:
Set the specific attribute name to the value.
Parameters:
name - the attribute name
value - the value to set
Returns:
object

Ax.xml.DocumentBuilderFactory.setCoalescing

object Ax.xml.DocumentBuilderFactory.setCoalescing(
	boolean coalescing
)
Info:
Specifies that the parser produced by this code will convert CDATA nodes to Text nodes and append it to the adjacent (if any) text node. By default is set to false.
Parameters:
coalescing - whether the parser produced will convert CDATA nodes to Text nodes and append it to the adjacent text node
Returns:
object

Ax.xml.DocumentBuilderFactory.setEntityResolver

object Ax.xml.DocumentBuilderFactory.setEntityResolver(
	object mapping
)
Info:
Specifies the function to map the entity name for publicId and systemId.
Parameters:
mapping - the mapping function
Returns:
object

Ax.xml.DocumentBuilderFactory.setErrorHandler

array Ax.xml.DocumentBuilderFactory.setErrorHandler()
Info:
Installs an error handler and returns an empty array list that will hold errors after parse.
Returns:
array

Ax.xml.DocumentBuilderFactory.setExpandEntityReferences

object Ax.xml.DocumentBuilderFactory.setExpandEntityReferences(
	boolean expandEntityRef
)
Info:
Specifies that the parser produced by this code will expand entity reference nodes.
Parameters:
expandEntityRef - whether the parser will expand entity reference nodes
Returns:
object

Ax.xml.DocumentBuilderFactory.setFeature

object Ax.xml.DocumentBuilderFactory.setFeature(
	string name,
	boolean value
)
Info:
Set a feature for this DocumentBuilderFactory and DocumentBuilders created by this factory.
Parameters:
name - the feature name
value - the feaure value
Returns:
object

Ax.xml.DocumentBuilderFactory.setIgnoringComments

object Ax.xml.DocumentBuilderFactory.setIgnoringComments(
	boolean ignoreComments
)
Info:
Specifies that the parser produced by this code will ignore comments.
Parameters:
ignoreComments - whether the parser will ignore comments
Returns:
object

Ax.xml.DocumentBuilderFactory.setIgnoringElementContentWhitespace

object Ax.xml.DocumentBuilderFactory.setIgnoringElementContentWhitespace(
	boolean whitespace
)
Info:
Specifies that the parsers created by this factory must eliminate whitespace in element content (sometimes known loosely as 'ignorable whitespace') when parsing XML documents (see XML Rec 2.10).
Parameters:
whitespace - whether the parser will eliminate whitespaces
Returns:
object

Ax.xml.DocumentBuilderFactory.setNamespaceAware

object Ax.xml.DocumentBuilderFactory.setNamespaceAware(
	boolean awareness
)
Info:
Specifies that the parser produced by this code will provide support for XML namespaces.
Parameters:
awareness - whether the parser will support XML namespaces
Returns:
object

Ax.xml.DocumentBuilderFactory.setSchema

object Ax.xml.DocumentBuilderFactory.setSchema(
	object schema
)
Info:
Set the Schema to be used by parsers created from this factory.
Parameters:
schema - the parser schema
Returns:
object

Ax.xml.DocumentBuilderFactory.setValidating

object Ax.xml.DocumentBuilderFactory.setValidating(
	boolean validating
)
Info:
Specifies that the parser produced by this code will validate documents as they are parsed.
Parameters:
validating - whether the parser will valdate documents as they are parsed.
Returns:
object

Ax.xml.DocumentBuilderFactory.setXIncludeAware

object Ax.xml.DocumentBuilderFactory.setXIncludeAware(
	boolean state
)
Info:
Set state of XInclude processing.
Parameters:
state - whether to set XInclude processing sate
Returns:
object

2 Document

Class Ax.xml.Document


Class that represents a XML Document. Wrapper for Document.

Constructor Summary

Method
Description
Creates a new XML Document instance by parsing the given source.
JSXMLDocument(org.w3c.dom.Document document)
Creates a new XML Document instance from a source Document.

Method Summary

Modifier and Type
Method
Description
void 
cleanNameSpace(org.w3c.dom.NodeList list)
Ax.xml.Element 
createElement(Ax.text.String name)
Create an element in the document
byte[] 
org.w3c.dom.Element 
Gets the root element of the XML document.
getNode(Ax.text.String expression)
By using this kind of expressions we can filter for whatever element we need to look for just by using the correct syntax.
getNodeSet(Ax.text.String expression)
use of an XPath expression to retrieve a list of nodes from the XML The NodeList it returns by specifying NODESET to the compile instruction as return type, is an ordered collection of nodes that can be accessed by passing an index as parameter.
int 
Ax.xml.Element 
Gets the root element of the XML document.
Returns an iterator over the XML Document elements.
toBlob()
A fast wary to transfer a XML to db using blob
org.json.JSONObject 
toJSON()
Map 
toMap()
Converts the XML Document to a map.
Map 
toMap(Function<StringBoolean> nodeArrayMapper)
Converts the XML Document to a map.
Ax.text.String 
Allow console.

Constructor Detail

Ax.xml.Document.JSXMLDocument

Ax.xml.Document.JSXMLDocument(
	object src
						)
Info:
Creates a new XML Document instance by parsing the given source. Source must be an InputStream convertible object (File, URL, Blob ...).
Parameters:
src - the source data

Ax.xml.Document.JSXMLDocument

Ax.xml.Document.JSXMLDocument(
	object document
						)
Info:
Creates a new XML Document instance from a source Document.
Parameters:
document - the source Document

Method Detail

Ax.xml.Document.cleanNameSpace

null Ax.xml.Document.cleanNameSpace(
	object list
)
Parameters:
list - 
Returns:
null

Ax.xml.Document.createElement

object Ax.xml.Document.createElement(
	string name
)
Info:
Create an element in the document
Parameters:
name - 
Returns:
object

Ax.xml.Document.getBytes

byte[] Ax.xml.Document.getBytes()
Returns:
byte[]

Ax.xml.Document.getElement

element Ax.xml.Document.getElement()
Info:
Gets the root element of the XML document.
Returns:
element

Ax.xml.Document.getNode

object Ax.xml.Document.getNode(
	string expression
)
Info:
By using this kind of expressions we can filter for whatever element we need to look for just by using the correct syntax.
Parameters:
expression - 
Returns:
object

Ax.xml.Document.getNodeSet

array Ax.xml.Document.getNodeSet(
	string expression
)
Info:
use of an XPath expression to retrieve a list of nodes from the XML The NodeList it returns by specifying NODESET to the compile instruction as return type, is an ordered collection of nodes that can be accessed by passing an index as parameter.
Parameters:
expression - 
Returns:
array

Ax.xml.Document.getNodeType

smallint Ax.xml.Document.getNodeType()
Returns:
smallint

Ax.xml.Document.getRootElement

object Ax.xml.Document.getRootElement()
Info:
Gets the root element of the XML document.
Returns:
object

Ax.xml.Document.iterator

object Ax.xml.Document.iterator()
Info:
Returns an iterator over the XML Document elements.
Returns:
object

Ax.xml.Document.removeNamespaces

object Ax.xml.Document.removeNamespaces()
Returns:
object

Ax.xml.Document.toBlob

object Ax.xml.Document.toBlob()
Info:
A fast wary to transfer a XML to db using blob
Returns:
object

Ax.xml.Document.toJSON

object Ax.xml.Document.toJSON()
Returns:
object

Ax.xml.Document.toMap

object Ax.xml.Document.toMap()
Info:
Converts the XML Document to a map. Map contains key, value pairs. Value can be a text for CDATA or final Elements or a node when Element has children. When a key has multiple values, it will be converted to a List.
Returns:
object

Ax.xml.Document.toMap

object Ax.xml.Document.toMap(
	object nodeArrayMapper
)
Info:
Converts the XML Document to a map. Map contains key, value pairs. Value can be a text for CDATA or final Elements or a node when Element has children. When a key has multiple values, it will be converted to a List.
Parameters:
nodeArrayMapper - A function mapping which XML nodes will be forced to be an array. When null, an anrray will be used if and only if, a node has more than one child
Returns:
object

Ax.xml.Document.toString

string Ax.xml.Document.toString()
Info:
Allow console.log(xml) shows XML content If the namespace declaration xmlns='http://www.lotus.com/dxl' appears in the outermost element, then you can't say it "isn't used anywhere" - on the contrary, it is used everywhere! It effectively changes every element name in the document to a different name. There's no way you can ignore that.
Returns:
string

3 Element

Class Ax.xml.Element


Class that represents a XML Document element. A wrapper on Element. An XML element is everything from the element's start tag, to the element's end tag, both included. An element may contain elements inside, forming a hierarchy starting from the root element.

Constructor Summary

Method
Description
JSXMLElement(org.w3c.dom.Element element)
Creates a new XML element instance from a source Element.

Method Summary

Modifier and Type
Method
Description
appendCDATA(Ax.text.String text)
Ax.xml.Element 
appendChild(Ax.xml.Element element)
appendText(Ax.text.String text)
void 
cleanNameSpace(org.w3c.dom.NodeList list)
Ax.xml.Element 
createChild(Ax.text.String name)
Ax.text.String 
getAttribute(Ax.text.String name)
Returns the value of an attribute of an element.
List 
Returns the names of all element attributes
byte[] 
Ax.text.String 
Concats all the text and cdata node children of this element and return the resulting text.
org.w3c.dom.Element 
Gets the source Element.
Ax.xml.Element 
This method returns an XML object representing the first child element in the current element.
Ax.xml.Element 
This method returns an XML object representing the next element at the same level in the Document Object Model (DOM) tree as the current element.
getNode(Ax.text.String expression)
By using this kind of expressions we can filter for whatever element we need to look for just by using the correct syntax.
getNodeSet(Ax.text.String expression)
use of an XPath expression to retrieve a list of nodes from the XML The NodeList it returns by specifying NODESET to the compile instruction as return type, is an ordered collection of nodes that can be accessed by passing an index as parameter.
int 
Ax.xml.Element 
This method returns an XML object representing the parent element the current element.
Ax.xml.Element 
This method returns an XML object representing the previous element at the same level in the Document Object Model (DOM) tree as the current element.
Ax.text.String 
Gets the element tag name.
An iterat over the element sub-elements.
void 
removeAttribute(Ax.text.String name)
void 
Remove this element from the XML tree witch can be useful to minimize memory usage while processing a large XML and nodes are no longer need.
void 
setAttribute(Ax.text.String name, Ax.text.String value)
Ax.xml.Element 
setTextContent(Ax.text.String text)
toBlob()
A fast wary to transfer a XML to db using blob
org.json.JSONObject 
toJSON()
Map 
toMap()
Map 
toMap(Function<StringBoolean> nodeArrayMapper)
Ax.text.String 
Allow console.

Constructor Detail

Ax.xml.Element.JSXMLElement

Ax.xml.Element.JSXMLElement(
	element element
						)
Info:
Creates a new XML element instance from a source Element.
Parameters:
element - the source Element

Method Detail

Ax.xml.Element.appendCDATA

object Ax.xml.Element.appendCDATA(
	string text
)
Parameters:
text - 
Returns:
object

Ax.xml.Element.appendChild

object Ax.xml.Element.appendChild(
	object element
)
Parameters:
element - 
Returns:
object

Ax.xml.Element.appendText

object Ax.xml.Element.appendText(
	string text
)
Parameters:
text - 
Returns:
object

Ax.xml.Element.cleanNameSpace

null Ax.xml.Element.cleanNameSpace(
	object list
)
Parameters:
list - 
Returns:
null

Ax.xml.Element.createChild

object Ax.xml.Element.createChild(
	string name
)
Parameters:
name - 
Returns:
object

Ax.xml.Element.getAttribute

string Ax.xml.Element.getAttribute(
	string name
)
Info:
Returns the value of an attribute of an element. Returns null if the attribute is not found. Like in org.apache.soap.util.xml.DOMUtils
Parameters:
name - the name of the attribute
Returns:
string

Ax.xml.Element.getAttributeNames

array Ax.xml.Element.getAttributeNames()
Info:
Returns the names of all element attributes
Returns:
array

Ax.xml.Element.getBytes

byte[] Ax.xml.Element.getBytes()
Returns:
byte[]

Ax.xml.Element.getChildCharacterData

string Ax.xml.Element.getChildCharacterData()
Info:
Concats all the text and cdata node children of this element and return the resulting text.
Returns:
string

Ax.xml.Element.getElement

element Ax.xml.Element.getElement()
Info:
Gets the source Element.
Returns:
element

Ax.xml.Element.getFirstChildElement

object Ax.xml.Element.getFirstChildElement()
Info:
This method returns an XML object representing the first child element in the current element.
Returns:
object

Ax.xml.Element.getNextSiblingElement

object Ax.xml.Element.getNextSiblingElement()
Info:
This method returns an XML object representing the next element at the same level in the Document Object Model (DOM) tree as the current element.
Returns:
object

Ax.xml.Element.getNode

object Ax.xml.Element.getNode(
	string expression
)
Info:
By using this kind of expressions we can filter for whatever element we need to look for just by using the correct syntax.
Parameters:
expression - 
Returns:
object

Ax.xml.Element.getNodeSet

array Ax.xml.Element.getNodeSet(
	string expression
)
Info:
use of an XPath expression to retrieve a list of nodes from the XML The NodeList it returns by specifying NODESET to the compile instruction as return type, is an ordered collection of nodes that can be accessed by passing an index as parameter.
Parameters:
expression - 
Returns:
array

Ax.xml.Element.getNodeType

smallint Ax.xml.Element.getNodeType()
Returns:
smallint

Ax.xml.Element.getParentElement

object Ax.xml.Element.getParentElement()
Info:
This method returns an XML object representing the parent element the current element.
Returns:
object

Ax.xml.Element.getPreviousSiblingElement

object Ax.xml.Element.getPreviousSiblingElement()
Info:
This method returns an XML object representing the previous element at the same level in the Document Object Model (DOM) tree as the current element.
Returns:
object

Ax.xml.Element.getTagName

string Ax.xml.Element.getTagName()
Info:
Gets the element tag name.
Returns:
string

Ax.xml.Element.iterator

object Ax.xml.Element.iterator()
Info:
An iterat over the element sub-elements.
Returns:
object

Ax.xml.Element.removeAttribute

null Ax.xml.Element.removeAttribute(
	string name
)
Parameters:
name - 
Returns:
null

Ax.xml.Element.removeElement

null Ax.xml.Element.removeElement()
Info:
Remove this element from the XML tree witch can be useful to minimize memory usage while processing a large XML and nodes are no longer need.
Returns:
null

Ax.xml.Element.removeNamespaces

object Ax.xml.Element.removeNamespaces()
Returns:
object

Ax.xml.Element.setAttribute

null Ax.xml.Element.setAttribute(
	string name,
	string value
)
Parameters:
name - 
value - 
Returns:
null

Ax.xml.Element.setTextContent

object Ax.xml.Element.setTextContent(
	string text
)
Parameters:
text - 
Returns:
object

Ax.xml.Element.toBlob

object Ax.xml.Element.toBlob()
Info:
A fast wary to transfer a XML to db using blob
Returns:
object

Ax.xml.Element.toJSON

object Ax.xml.Element.toJSON()
Returns:
object

Ax.xml.Element.toMap

object Ax.xml.Element.toMap()
Returns:
object

Ax.xml.Element.toMap

object Ax.xml.Element.toMap(
	object nodeArrayMapper
)
Parameters:
nodeArrayMapper - 
Returns:
object

Ax.xml.Element.toString

string Ax.xml.Element.toString()
Info:
Allow console.log(xml) shows XML content If the namespace declaration xmlns='http://www.lotus.com/dxl' appears in the outermost element, then you can't say it "isn't used anywhere" - on the contrary, it is used everywhere! It effectively changes every element name in the document to a different name. There's no way you can ignore that.
Returns:
string