I want to do an sql query and if it returns EOF then I want to skip the append child step.
The createSSN routine will do the query and may not have a child to append at the last line. Normally, createSSN returns via
What can you return is rsSSN.EOF is true?
Code:
Set xmldom = New DOMDocument60
xmldom.async = False
xmldom.validateOnParse = False
xmldom.resolveExternals = False
xmldom.preserveWhiteSpace = True
' Create a processing instruction targeted for xml.
Set Node = xmldom.createProcessingInstruction("xml", "version='1.0'")
xmldom.appendChild Node
Set Node = Nothing
' Create a processing instruction targeted for xml-stylesheet.
'Set Node = dom.createProcessingInstruction("xml-stylesheet", _
"type='text/xml' href='test.xsl'")
'dom.appendChild Node
'Set Node = Nothing
' Create a comment for the document.
Set Node = xmldom.createComment("xml file created using 2.5.3 Software.")
xmldom.appendChild Node
Set Node = Nothing
xmldom.createTextNode (vbNewLine + vbTab)
' Create the root element.
Set root = xmldom.createElement(xmlPrefix + "LobbyReg")
' Create an attribute for the root element to define the schema
Set attr = xmldom.createAttribute("xsi:schemaLocation")
attr.Value = "file:///C:/XML LobbReg.xsd"
root.setAttributeNode attr
Set attr = Nothing
' Create an attribute for the root element to locate the schema
Set attr = xmldom.createAttribute("xmlns:xsd")
attr.Value = "file:///C:/XML"
root.setAttributeNode attr
Set attr = Nothing
' Create an attribute for the root element to ??schema??
Set attr = xmldom.createAttribute("xmlns:xsi")
attr.Value = "http://www.w3.org/2001/XMLSchema-instance"
root.setAttributeNode attr
Set attr = Nothing
root.appendChild xmldom.createTextNode(vbNewLine + vbTab)
xmldom.appendChild root
' Create the children elements.
root.appendChild createSSN(xmldom)
Code:
Set createSSN = SSNNode
rsSSN.Close
rsFiler.Close
Exit Function
Comment