Altova Mailing List Archives


Re: MSXML error loading document

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 5/10/2004 5:49:00 PM

Vlad Vissoultchev wrote:

> i'm having troubles escaping special character when using MSXML. this VB6
> code is failing:
> 
> Private Sub Command1_Click()
>     Dim oDoc            As MSXML2.DOMDocument
>     Dim oEl             As IXMLDOMElement
> 
>     Set oDoc = New MSXML2.DOMDocument
>     Set oEl = oDoc.appendChild(oDoc.createElement("aaa"))
>     oEl.setAttribute "test", Chr(1)                '--- "&#x01;"
>     oDoc.Save "c:\temp\aaa4.xml"
> 
>     Set oDoc = New MSXML2.DOMDocument
>     If Not oDoc.Load("c:\temp\aaa4.xml") Then
>         MsgBox "error loading"
>     End If
> End Sub
> 
> can someone shed some light how to persist characters with ASCII code below
> 32 in an attribute, so that Load method to succeed?

There are only a few characters of those allowed in XML 1.0, namely 
&#x9;, &#xA;, &#xD; otherwise your document is not well-formed thus you 
should avoid those characters if you want to work with XML.

-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/

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.