Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: encoding="utf-8" gets suppressed on http post

From: "Anthony Jones" <Ant@------------.--->
To: 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




transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent