GetRootElement()

Top  Previous  Next

Object: EHL7.QSXML

FileName: EHL7.dll

 

METHOD

 

Name: GetRootElement()

Parameters: None

Returns: Object (See below)

Description: This method returns the root element of the XML document.

 

*XML Note: The object returned is actually of type "MSXML2.IXMLDOMNode" and is the functional equivalent of calling the .documentElement() method of an open "MSXML2.DomDocumentXX"

 

 

Example:

Dim myXMLObj As New EHL7.QSXML

Dim strXML As String

Dim ndRT As Object

Dim ndChild As Object

With myXmlObj

.ClearErrors

strXML = "<GOODXML></GOODXML>"

Call .OpenFromString(strXML)

If .IsError Then

  MsgBox .LastError

  .ClearErrors

  Exit Sub

End If

Set ndRT = .GetRootElement()

'ndRT is now an object of type MSXML2.IXMLDOMNode

MsgBox ndRt.XML

'is the same as calling

MsgBox myXMLObj.XML

'Add a child node

strXML = "<CHILDNODE></CHILDNODE>"

Set ndChild = .XMLAddNode(ndRT,strXML)

'Now look at the xml again

MsgBox ndRt.XML

'is the same as calling

MsgBox myXMLObj.XML

End With

Set myXMLObj = Nothing