OpenFromString() |
Top Previous Next |
Object: EHL7.QSXML FileName: EHL7.dll
METHOD
Name: OpenFromString() Parameters:
Returns: Boolean Description: Creates a new XML document from the XML provided in strXML, a currently open document is destroyed.
See Also: GetRootChildren(), OpenFromFile()
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 some child nodes strXML = "<CHILDNODE></CHILDNODE>" Call .XMLAddNode(ndRT,strXML) Call .XMLAddNode(ndRT,strXML) Call .XMLAddNode(ndRT,strXML) Call .XMLAddNode(ndRT,strXML) MsgBox Cstr(.CountChildNodes(ndRT,"CHILDNODE")) & " nodes" 'Now make some grandchildren Set ndChild = ndRT.ChildNodes(0) 'The first CHILDNODE strXML = "<GRANDCHILD></GRANDCHILD>" Call .XMLAddNode(ndChild,strXML) Call .XMLAddNode(ndChild,strXML)
Set ndChild = ndRT.ChildNodes(3) 'The last CHILDNODE strXML = "<GRANDCHILD></GRANDCHILD>" Call .XMLAddNode(ndChild,strXML) Call .XMLAddNode(ndChild,strXML) MsgBox Cstr(.CountChildNodes(ndChild,"GRANDCHILD")) & " grandchild nodes on CHILDNODE 4" End With Set myXMLObj = Nothing
|