Adding prolog information using MSXML 4.0 (April release) for a DOM document 
Author Message
 Adding prolog information using MSXML 4.0 (April release) for a DOM document

I'd like to add prolog information to an XML document, but I haven't
found where they've hidden the information on how to in their
documentation.  I've resorted to appending the xml text into a string
along with the prolog strings.  Here's the code I'm using to create my
document:

'Create a DOM document object for creating our request.
  Dim xmlCustQuery As New MSXML2.DOMDocument
  Set xmlCustQuery = CreateObject("MSXML2.DOMDocument")

'Declare the xml node objects
  Dim rootElement As IXMLDOMNode
  Dim QBXMLMsgsRqNode As IXMLDOMNode
  Dim CustomerQueryRqNode As IXMLDOMNode

'Declare the xml attribute objects
  Dim onErrorAttr As IXMLDOMAttribute
  Dim requestIDAttr As IXMLDOMAttribute

  'xmlCustQuery.appendChild xmlCustQuery.createElement("?xml
version=""1.0"" ?")
  'xmlCustQuery.appendChild xmlCustQuery.createElement("")

  'Add the QBXML aggregate
  Set rootElement = xmlCustQuery.createElement("QBXML")
  xmlCustQuery.appendChild rootElement

  'Add the QBXMLMsgsRq aggregate
  Set QBXMLMsgsRqNode = xmlCustQuery.createElement("QBXMLMsgsRq")
  rootElement.appendChild QBXMLMsgsRqNode

  'Set the QBXMLMsgsRq onError attribute to continueOnError
  Set onErrorAttr = xmlCustQuery.createAttribute("onError")
  onErrorAttr.Text = "continueOnError"
  QBXMLMsgsRqNode.Attributes.setNamedItem onErrorAttr

  'Add the CustomerQueryRq aggregate
  Set CustomerQueryRqNode =
xmlCustQuery.createElement("CustomerQueryRq")
  QBXMLMsgsRqNode.appendChild CustomerQueryRqNode

  'Set the requestID attribute to 4
  Set requestIDAttr = xmlCustQuery.createAttribute("requestID")
  requestIDAttr.Text = "4"
  CustomerQueryRqNode.Attributes.setNamedItem requestIDAttr

  'We're adding the prolog using text strings
  BuildCustomerQueryRequest = _
    "<?xml version=""1.0"" ?>" & _
    "<!DOCTYPE QBXML PUBLIC '-//INTUIT//DTD QBXML QBD 1.0//EN' >" & _
    rootElement.xml

Any help would be appreciated.

Thank you,

Tony Purmal



Tue, 10 Feb 2004 01:47:45 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. DOM issue with MSXML

2. msxml DOM: reading each element in an XML

3. msxml DOM: no linefeed after creating a new node

4. Read XML using VB6 DOM 4.0 with Namespaces - See Sample XML

5. MSXML 4.0

6. Insert information into a word document using automation

7. Using form to enter the same information into several documents

8. Appending nodes to DOM document created with ASP

9. Tags in document and the DOM

10. Events do not fire when node added to Doc by DOM

11. Help with DOM SELECT.ADD()

12. using a url in documents.add method

 

 
Powered by phpBB® Forum Software