Re: ?Best way to escape for xml?



Thanks for your help. Subsequent investigation leads me to believe that,
although the original error was and is reported to have been caused by the
line containing "xmldoc.LoadXml(oraclestring)", it was the next line
containing "xmlcontrol.Document = xmldoc" and the tranformation of the xml
using an xsl document that is the fault. (Removing this line stops the
problem, changing the xsl solves it.) I will change my encode and decode
methods (in Java on the Oracle server) to comply with your suggestion and the
W3 specification. But I will remain puzzled as to why .Net just ignored
"!"(?).

"Ion Vasilian" wrote:

> Hi,
>
> You might want to take a look at http://www.w3.org/TR/REC-xml/#syntax
> first. It is unlikely that the problem is caused by the '!'; '&' is the
> culprit.
> Whatever you're getting is not well-formed xml. You'll need to change the
> source so that it applies the following character mapping on serialization:
> for character data:
> < -> <
> & -> &
> for attribute values the above plus:
> ' -> &apos;
> " -> "
> Unless you have a very specialized scenario you cannot consistently filter
> the
> input unless you're parsing the xml at the same time. You probably don't
> want
> to do that. Another alternative is to use CDATA sections for the text.
> Again,
> that's reasonable provided that you have control of the source
> serialization.
>
> Ion
>
> "beanweed" <beanweed@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:A593F356-B964-431B-8978-7AAFEEEA1120@xxxxxxxxxxxxxxxx
> > I have an Oracle Procedure that returns xml. There was an exception thrown
> > when I tried to load an XmlDocument (using LoadXml(String)) because the
> value
> > returned from Oracle had an exclamation mark in a text node. So I wrote an
> > escape method to encode the text coming into the .Net class. But now I am
> not
> > sure how to write the unescape method to handle the text when it goes back
> to
> > the Oracle db.
> >
> > Here's what I mean:
> > - if the data in the db is "abc ! & ' " < > efg", the procedure produces
> > this element
> >
> > <data>abc ! & " ' < > xyz</data>
> >
> > - loading this into an XmlDocument using thedocument.LoadXml(oraclestring)
> > leaves
> >
> > <data>abc ! & ' " < > xyz</data>
> >
> > So do I write a method to change the "&", "<" and ">" back to "&<>" in
> > Oracle? How many other characters are changed and to what? Why was it bad
> for
> > me to give an "!" in the string when .Net then uses it unescaped
> thereafter?
> > I await enlightenment peacefully.
> >
>
>
>
.



Relevant Pages

  • Welche Classe zum XML auswerten
    ... Bisher hab ich mir die XmlDocument und XmlReader Klasse angeschaut, ... Eine Beispiel XML Datei befindet sich am Ende des Posts. ... Der XmlReader hingegen sehr einfach zu sein, Elemente wie "character" ...
    (microsoft.public.de.german.entwickler.dotnet.csharp)
  • Re: ?Best way to escape for xml?
    ... Whatever you're getting is not well-formed xml. ... source so that it applies the following character mapping on serialization: ... > returned from Oracle had an exclamation mark in a text node. ... > sure how to write the unescape method to handle the text when it goes back ...
    (microsoft.public.dotnet.xml)
  • Re: xmltextwriter escaping characters
    ... there is some characters that make invalid xml ) ... xmltextwriter replace character with doublequote ... 147 is not assigned any character. ... How exactly do you populate the XmlDocument instance? ...
    (microsoft.public.dotnet.languages.csharp)
  • Oracle Character Conversion Bugs (#NISR2122004G)
    ... Oracle 10g/AS on all operating systems ... Due to character conversion problems in Oracle 10g with Oracle's Application ... database server as SYS. ...
    (NT-Bugtraq)
  • Re: Storing Queries in Tables
    ... Either you should follow the method Oracle is using to store SQL ... removed all the indents from the query and then they have worked. ... of report, date, other qualifier etc. ... brings me back to character sets. ...
    (comp.databases.oracle.misc)

Loading