Previous Topic

Next Topic

XMLDOM Object

The XMLDOM Object can be used to read and write XML files.

XMLDOM Object has the following Properties:

FormattedXML

String containing the formatted XML, containing indentation and new line characters.

Version

The XML Version.

XML

String containing the XML without formatting.

Encoding

The type of XML Encoding, either:

  • UTF-8 - OR -
  • UTF-16

XMLDOM Object has the following Methods:

CreateDocument

Creates an object with the specified Root Node.

LoadFromFile

Loads an XML file with specified Filename into the object.

LoadXML

Takes an XML String and loads it into the object.

Root

The root Object of the XML.

SaveToFile

Saves the XML to a specified Filename, with an option flag to save formatted XML.

The following code sample creates an XMLDOM Object from an XML file and returns the number of child nodes.

Dim XML as Object

XML = CreateObject("Accredo.XMLDom")

XML.Version = "1.0"

XML.Encoding = "UTF-8"

XML.LoadFromFile("c:\data\sample.xml")

Dim Root as Object

Root = XML.Root

Dim Children as Object

ChildRen = Root.ChildNodes

Msgbox("Document has " & Children.Count & " children")

See Also

MaxBasic Objects

Book Contents

Book Index