I'm getting errors using XML deserialisation and CDATA sections when there
are hexidecimal characters involved.
If the CDATA section does not contain a hexidecimal values everything is
fine. However if I have a hexidecimal value in the CDATA section the parser
throws errors when it hits the hex character.
I thought CDATA sections are meant to be ignore by the parser?
Can anyone shed some light on this for me. The error is below:
MESSAGE: DeserializeObject failed: There is an error in XML document (11,
2).
TYPE: System.Exception
SOURCE: Enlighten.SMS
EVENT: xmlgwsablemsg DeserializeObjectxmlgwsablemsg(System.String)
STACK TRACE:
at
Enlighten.SMS.Vodafone.VodafoneXMLClient.Deseriali zeObjectxmlgwsablemsg(String
xmlResponse) at Enlighten.SMS.Vodafone.Index.Page_Load(Object sender,
EventArgs e)
MESSAGE: '', hexadecimal value 0x02, is an invalid character. Line 11,
position 16.
TYPE: System.Xml.XmlException
SOURCE: System.Xml
EVENT: Void ScanCData()
STACK TRACE:
at System.Xml.XmlScanner.ScanCData() at System.Xml.XmlScanner.ScanMarkup()
at System.Xml.XmlTextReader.ParseTag() at
System.Xml.XmlTextReader.ParseBeginTagExpandCharEn tities() at
System.Xml.XmlTextReader.Read() at System.Xml.XmlReader.ReadElementString()
at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationReader1.Read4_xmlgwsablemsgSablereceiv emessage(Boolean
isNullable, Boolean checkType) at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationReader1.Read1_xmlgwsablemsg(Boolean
isNullable, Boolean checkType) at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationReader1.Read8_xmlgwsablemsg()
Cheers
Damon 2 8416
Ok I think I've answered my own post. A CDATA section still has to contain
legal char range. CDATA really just stops you having to worry about
escaping. If someone wants to confirm this however please do. http://www.w3.org/TR/REC-xml#charsets
Valid characters are " #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] |
[#x10000-#x10FFFF] /* any Unicode character, excluding the surrogate
blocks, FFFE, and FFFF. */ "
"Damon" <da***@nsmanagedenlighten.co.nz> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl... I'm getting errors using XML deserialisation and CDATA sections when there are hexidecimal characters involved.
If the CDATA section does not contain a hexidecimal values everything is fine. However if I have a hexidecimal value in the CDATA section the parser throws errors when it hits the hex character.
I thought CDATA sections are meant to be ignore by the parser?
Can anyone shed some light on this for me. The error is below:
MESSAGE: DeserializeObject failed: There is an error in XML document (11, 2).
TYPE: System.Exception SOURCE: Enlighten.SMS EVENT: xmlgwsablemsg DeserializeObjectxmlgwsablemsg(System.String) STACK TRACE: at Enlighten.SMS.Vodafone.VodafoneXMLClient.Deseriali zeObjectxmlgwsablemsg(String xmlResponse) at Enlighten.SMS.Vodafone.Index.Page_Load(Object sender, EventArgs e)
MESSAGE: '', hexadecimal value 0x02, is an invalid character. Line 11, position 16.
TYPE: System.Xml.XmlException SOURCE: System.Xml EVENT: Void ScanCData() STACK TRACE: at System.Xml.XmlScanner.ScanCData() at System.Xml.XmlScanner.ScanMarkup() at System.Xml.XmlTextReader.ParseTag() at System.Xml.XmlTextReader.ParseBeginTagExpandCharEn tities() at System.Xml.XmlTextReader.Read() at System.Xml.XmlReader.ReadElementString() at Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationReader1.Read4_xmlgwsablemsgSablereceiv emessage(Boolean isNullable, Boolean checkType) at Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationReader1.Read1_xmlgwsablemsg(Boolean isNullable, Boolean checkType) at Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationReader1.Read8_xmlgwsablemsg()
Cheers
Damon
Thanks. However I still don't know the fix. I had similar issue with 0x03.
So what do you do? The other question is what is the right was to include
markup inside an Element that is not markup for the outer xml (i.e.
Including an xml string inside an element.) Do you let serializer escape
the chars or use CDATA? TIA
--
William Stacey, MVP http://mvp.support.microsoft.com
"Damon" <da***@nsmanagedenlighten.co.nz> wrote in message
news:OL**************@TK2MSFTNGP09.phx.gbl... Ok I think I've answered my own post. A CDATA section still has to contain legal char range. CDATA really just stops you having to worry about escaping. If someone wants to confirm this however please do.
http://www.w3.org/TR/REC-xml#charsets
Valid characters are " #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] /* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */ "
"Damon" <da***@nsmanagedenlighten.co.nz> wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl... I'm getting errors using XML deserialisation and CDATA sections when
there are hexidecimal characters involved.
If the CDATA section does not contain a hexidecimal values everything is fine. However if I have a hexidecimal value in the CDATA section the parser throws errors when it hits the hex character.
I thought CDATA sections are meant to be ignore by the parser?
Can anyone shed some light on this for me. The error is below:
MESSAGE: DeserializeObject failed: There is an error in XML document
(11, 2).
TYPE: System.Exception SOURCE: Enlighten.SMS EVENT: xmlgwsablemsg DeserializeObjectxmlgwsablemsg(System.String) STACK TRACE: at
Enlighten.SMS.Vodafone.VodafoneXMLClient.Deseriali zeObjectxmlgwsablemsg(Stri
ng xmlResponse) at Enlighten.SMS.Vodafone.Index.Page_Load(Object sender, EventArgs e)
MESSAGE: '', hexadecimal value 0x02, is an invalid character. Line 11, position 16.
TYPE: System.Xml.XmlException SOURCE: System.Xml EVENT: Void ScanCData() STACK TRACE: at System.Xml.XmlScanner.ScanCData() at
System.Xml.XmlScanner.ScanMarkup() at System.Xml.XmlTextReader.ParseTag() at System.Xml.XmlTextReader.ParseBeginTagExpandCharEn tities() at System.Xml.XmlTextReader.Read() at System.Xml.XmlReader.ReadElementString() at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationReader1.Read4_
xmlgwsablemsgSablereceivemessage(Boolean isNullable, Boolean checkType) at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationReader1.Read1_
xmlgwsablemsg(Boolean isNullable, Boolean checkType) at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationReader1.Read8_
xmlgwsablemsg() Cheers
Damon
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: wenke |
last post by:
Hi,
I am using the following code (see below) from php.net
(http://www.php.net/manual/en/ref.xml.php, example 1) to parse an XML
file (encoded in UTF-8). I changed the code slightly so that the...
|
by: alainpoint |
last post by:
I am experimenting with ElementTree and i came accross some
(apparently) weird behaviour.
I would expect a piece of XML to be read, parsed and written back
without corruption (except for the...
|
by: Bushido Hacks |
last post by:
Hey c.l.c++ and/or c.g.a.opengl posters,
How do I convert a hexidecimal string, traditionally used for defining
colors with HTML, into a floating point array?
In other words, how do I convert...
|
by: Xah Lee |
last post by:
what does it mean when a style tag gives something like the following?
<style type="text/css" media="screen,projection">/*<!]>*/</style>
is this standard?
Xah
xah@xahlee.org
∑...
|
by: charliewest |
last post by:
Can some pls provide an example as to how to use the TypeConverter and/or
WebColorConverter class to set a control color property to a hexidecimal
value?
Thanks in advance.
|
by: Jon Noring |
last post by:
Out of curiosity, may a CDATA section appear within an attribute
value with datatype CDATA? And if so, how about other attribute
value datatypes which accept the XML markup characters?
To me,...
|
by: nick_nw |
last post by:
Hi,
Given the following XML (cut down version for explanation, actual doc
much larger).
<?xml version="1.0" encoding="utf-8" ?>
<Stuff>Any string can go in here. It could even be well or...
|
by: =?Utf-8?B?QmlsbEF0V29yaw==?= |
last post by:
Hi,
I'm defining a report layout using an XML document, plugging data values
into fields before outputting the whole doc as an HTML page. I wrap each of
the data fields in CDATA section (in case...
|
by: dkyadav80 |
last post by:
Hi sir,
I'm new about xml, javascript. I have two selection field(html) first is city and second is state. the city and state values should be store in xml file. when user select city then all...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |