Class XPXMLDOC

This object is capable of creating new XML documents as well as parsing existing documents for data elements. When creating a new XML document, you simply add the elements and the take the XMLString$ output as a formatted XML document


Unlike HTML, XML has no predefined elements and attributes. As the document author you are responsible for creating a meaningful document.


Programmer's Notes:

  • XML is case sensitive. That means that and are references to different elements.
  • When presented, all attributes must be in quotes and all elements must have a starting and ending tag or explicitly indicate that they are empty elements.
  • XML elements must be properly nested
  • XML documents must have a single root element
  • XML Attribute Values Must be Quoted
  • Unlike HTML, white space is preserved. So no spaces would be removed from the string "Hello world."
  • CR / LF is Converted to LF. In XML, a new line is always stored as LF

Some helpful web sites:

  • http://msdn.microsoft.com/xml
  • http://www.xml.com
  • http://www.w3schools.com/xml/xml_syntax.asp

Understanding XML:

  • http://msdn.microsoft.com/xml/default.aspx?pull=/library/en-us/dnxml/html/understxml.asp
  • http://www.w3.org/2000/03/29-XML-protocol-matrix

Inherits

XPXMLTAG

Known SubClasses

XPSOAPDOC

Properties

PROPERTY Declaration$

Defines the XML version and character encoding used in the document. It is the first line of the document.

PROPERTY SuppressDeclaration

Set to "True" to suppress the generation of the XML declaration at the beginning of the document. This is typically done when the document will be combined or embedded into another XML document.

PROPERTY Version$

Version number from the XML Header

PROPERTY Encoding$

Encoding from the XML Header

PROPERTY Error$

If an error occurs while importing a file or string, this property will contain the description of the error.

PROPERTY XMLString$

Use this property to pull the XML document back out of the object as a single string.

Methods

FUNCTION LoadEncodedString(_XMLString$)

Parse the XMLString$ variable as a complete XML document that has been encoded using the HTML escape sequences for <, >, ", and &. This is typically done when the XMLString$ is part of a payload for a SOAP element

ParameterDescription
_XMLString$ The variable that contains the XML document to be parsed
Returns Will return True if parse is successful
FUNCTION LoadFile(_XMLDoc$)

Parse the XMLDoc$ file.

ParameterDescription
_XMLDoc$ The name of a file to be parsed
Returns Will return True if parse is successful
FUNCTION LoadString(_XMLString$)

Parse the XMLString$ variable as a complete XML document.

ParameterDescription
_XMLString$ The variable that contains the XML document to be parsed
Returns Will return True if parse is successful
FUNCTION NewDocument()

This method will initialize the object for creation of a new document.

FUNCTION NewDocument(Import)

This method will initialize the object for creation of a new document.

ParameterDescription
Import Set to boolean true (1) to suppress automatic generation of common tags and comments. This is typically used only by internal object functions when importing an XML or SOAP document.
FUNCTION UTFDate$(JulianDate)

This function returns the specified date in the Universal Time Format: YYYY-MM-DD

ParameterDescription
JulianDate The input date as a Julian numeric date. You may also send 0 (zero) to obtain the current system date.
Returns the specified date in the Universal Time Format: YYYY-MM-DD
FUNCTION UTFDate$(LongDate$)

This function returns the specified date in the Universal Time Format: YYYY-MM-DD

ParameterDescription
JulianDate The input date as a as a standard long date format (YYYYMMDD). You may also send 0 (zero) to obtain the current system date.
Returns the specified date in the Universal Time Format: YYYY-MM-DD
FUNCTION UTFDateTime$(JulianDate)

This method returns the specified date and time in the Universal Time Format (UTF)

ParameterDescription
JulianDate The date to be converted
Returns the specified date and time in the Universal Time Format (UTF): YYYY-MM-DDThh:mm:ss
FUNCTION UTFDateTime$(JulianDate, Time)

This method returns the specified date and time in the Universal Time Format (UTF)

ParameterDescription
JulianDate The date to be converted
Time The fractional time value to be used in the conversion
Returns the specified date and time in the Universal Time Format (UTF): YYYY-MM-DDThh:mm:ss
FUNCTION UTFDateTime$(LongDate$)

This method returns the specified date and time in the Universal Time Format (UTF)

ParameterDescription
LongDate$ The date to be converted
Returns the specified date and time in the Universal Time Format (UTF): YYYY-MM-DDThh:mm:ss
FUNCTION UTFDateTime$(LongDate$, Time)

This method returns the specified date and time in the Universal Time Format (UTF)

ParameterDescription
LongDate$ The date to be converted
Time The fractional time value to be used in the conversion
Returns the specified date and time in the Universal Time Format (UTF): YYYY-MM-DDThh:mm:ss

Properties inherited from: XPXMLTAG

Name$, Text$, DecodedText$, Attributes, AttributeCount, Elements, ElementCount, CurrentElement, CurrentElementName$, LineSep$, XMLString$

Methods inherited from: XPXMLTAG

CreateAttribute(), CreateElement(), FindAttribute(), FindAttributeText$(), FindElement(), FindElementText$(), FindNextElement(), FindNextElementName$(), FindNextElementText$(), Parse$(), SetName(), SetText()