xml/ XmlDocument.js

This library provides the ability to create an XML DOM document cross browser.  The document can be loaded from a string and written to a string.

Copyright

2004 Rob Rohan robr.nosp@m.ohan@gmai.nosp@m.l.com All rights reserved

See

http://mozref.com/reference/objects/Document

Example

myDoc = new XmlDocumentFactory.getInstance();       //get a new doc
myDoc.loadXML("<test>hi</test>"); //populate from string
str = myDoc.toString(); //show xml as string

nodelist = myDoc.getElementsByTagName("tag"); //get a list of elements
nodelist = myDoc.getElementsByTagNameNS("uri","tag");
node = myDoc.documentElement //the root node
attr = myDoc.createAttribute("name") //creates and attribute
attr = myDoc.createAttributeNS("uri","name")
element = myDoc.createElement("name")
element = myDoc.createElementNS("uri","name")
node = myDoc.createTextNode(data)
element = myDoc.getElementById(id)

Related

util/Collections.js xml/XmlSax.js (for safari only) xml/XmlW3CDom.js (for safari only)

Summary
This library provides the ability to create an XML DOM document cross browser.
the library version
an xml element
gets and xml node type as a string
This can be used to create new xml documents in a somewhat cross browser compatable way.
Gets an instance of an XML document that tries to have the same w3c functions for all browsers currently IE, Mozilla, and Safari

Variables

XMLDOCUMENT_VERSION

var XMLDOCUMENT_VERSION

the library version

XML_ELEMENT

var XML_ELEMENT

an xml element

XML_ATTRIBUTE

var XML_ATTRIBUTE

XML_TEXT

var XML_TEXT

XML_CDATA

var XML_CDATA

XML_ENTITY_REFERENCE

var XML_ENTITY_REFERENCE

XML_ENTITY

var XML_ENTITY

XML_PI

var XML_PI

XML_COMMENT

var XML_COMMENT

XML_DOCUMENT

var XML_DOCUMENT

XML_DOCUMENT_TYPE

var XML_DOCUMENT_TYPE

XML_DOCUMENT_FRAGMENT

var XML_DOCUMENT_FRAGMENT

XML_NOTATION

var XML_NOTATION

Functions

XML_NodeTypeAsString

function XML_NodeTypeAsString(node)

gets and xml node type as a string

Parameters

nodethe node whos type you’d like to know

Return

a string that represnets the node

XMLDocumentFactory

This can be used to create new xml documents in a somewhat cross browser compatable way.  It trys to keep MS and Mozilla functions the same with a touch of w3c thrown in for good measure.  This add Namespace support to IE and the ability to load a document from a string in safari with the supporting libraies The create instance method should give you a DOM object that you should be used to

Summary
Gets an instance of an XML document that tries to have the same w3c functions for all browsers currently IE, Mozilla, and Safari

Functions

XMLDocumentFactory. getInstance

Gets an instance of an XML document that tries to have the same w3c functions for all browsers currently IE, Mozilla, and Safari

Return

an XMLDocument object

var XMLDOCUMENT_VERSION
the library version
var XML_ELEMENT
an xml element
var XML_ATTRIBUTE
var XML_TEXT
var XML_CDATA
var XML_ENTITY_REFERENCE
var XML_ENTITY
var XML_PI
var XML_COMMENT
var XML_DOCUMENT
var XML_DOCUMENT_TYPE
var XML_DOCUMENT_FRAGMENT
var XML_NOTATION
function XML_NodeTypeAsString(node)
gets and xml node type as a string