![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: encoding="utf-8" gets suppressed on http post >Thread Next - Re: encoding="utf-8" gets suppressed on http post Re: encoding="utf-8" gets suppressed on http postTo: NULL Date: 8/11/2007 9:55:00 AM
<jvanderhulst@v...> wrote in message
news:1186758918.099569.111460@z......
> Thanks Anthony for your response;
>
> Ok, I have taken up your suggestion. In my code I have built up an XML
> tree which is a piece of code that I know to be working for other
> purposes.
>
> The important parts are these:
>
> ' Create the XML object
> set objXMLdoc = Server.CreateObject ("MSXML2.DOMDocument.3.0")
>
> objXMLdoc.async = False
> objXMLdoc.validateonParse = false
> objXMLdoc.preserveWhiteSpace = false
> objXMLdoc.resolveExternals = false
>
> ' ------------------ Create the root node named Message
> set objXMLroot = objXMLdoc.createElement("Message")
> objXMLdoc.appendChild(objXMLroot)
>
> ' Create the Order element
> set objXMLOrderNode = objXMLDoc.createNode ("element", "Order","")
> objXMLdoc.documentElement.appendChild(objXMLOrderNode)
>
>
> { Other leaves in the tree are inserted ....}
>
>
> ' Create the Certificate Codenode
> set objItemNum = objXMLdoc.createNode("element", "CertificateCode","")
> objItemNum.Text = "3"
> objXMLOrderItemNode.appendChild(objItemNum)
> set objItemNum = Nothing
>
> dim xmlHttp
>
> set xmlHttp = server.CreateObject ("MSXML2.ServerXMLHTTP.3.0")
>
> objXMLdoc.xml.createProcessingInstruction ("xml", "version=""1.0""
> encoding=""UTF-8""")
>
> call xmlHttp.open ("POST", "http://server....",False)
> xmlHttp.send (objXMLdoc.xml)
>
> --------------
>
> but then I get this: Cannot use parentheses when calling a Sub
> /SAPReceiveIDOC/XML-izeRequesttoHTTP.asp, line 171, column 87
> objXMLdoc.xml.createProcessingInstruction ("xml", "version=""1.0""
> encoding=""UTF-8""")
> --------------------------------------------------------------------------
------------
> ^
> The up arrow is actually positioned at the closing bracket.
>
> I am not too familiair with ASP coding. I notice that on your example
> sometimes there are no brackets where I have them but I picked those
> up from other code samples.
>
> So how exactly do I stick these processing instructions in the XML ?
This:-
objXMLdoc.xml.createProcessingInstruction ("xml", "version=""1.0""
encoding=""UTF-8""")
should be:-
Dim oPI
oPI = objXMLdoc.createProcessingInstruction("xml", "version=""1.0""
encoding=""UTF-8""")
objXMLDoc.insertBefore oPI, objXMLDoc.documentElement
Although it would be better if the xml declare were appended as the first
child of the document before adding other xml as per my previous post.
> And I should send objXMLdoc instead of without the objXMLdoc.xml ?
>
Yes the XMLHttp object has special case handling when the object passed as
the send parameter is an XML DOM.
--
Anthony Jones - MVP ASP/ASP.NET
| ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||
|
