473,326 Members | 2,133 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

XmlTextReader problem with & in element text

I have an XSD defined as the following:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="Application">
<xs:complexType>
<xs:sequence>
<xs:element name="ReceivedDate" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

I have the following XML I am validating against the XSD:

<Application><ReceivedDate>Test &amp; Date</ReceivedDate></Application>

When validating with XmlValidatingReader I receive the following exception:

This is an unexpected token. The expected token is 'EndElement'. Line 1,
position 28.

Removing the &amp; causes the XML to validate properly. If I validate this
XSD/XML in Altova XMLSpy it validates perfectly (as it should).

Is there some setting/bug I do not know about with XmlValidatingReader or
XmlTextReader that causes it to get confused when an entity exists in
element text?

Thanks,

Nate
Nov 12 '05 #1
1 1719
I did not get an error when I tried XmlValidatingReader against your xsd and
xml. Would you post the code that you used?

---
www.societopia.net
"Nathan Alden" wrote:
I have an XSD defined as the following:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="Application">
<xs:complexType>
<xs:sequence>
<xs:element name="ReceivedDate" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

I have the following XML I am validating against the XSD:

<Application><ReceivedDate>Test & Date</ReceivedDate></Application>

When validating with XmlValidatingReader I receive the following exception:

This is an unexpected token. The expected token is 'EndElement'. Line 1,
position 28.

Removing the & causes the XML to validate properly. If I validate this
XSD/XML in Altova XMLSpy it validates perfectly (as it should).

Is there some setting/bug I do not know about with XmlValidatingReader or
XmlTextReader that causes it to get confused when an entity exists in
element text?

Thanks,

Nate

Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: schmendrick | last post by:
Is it possible to disable a control with Text (Textbox, combobox etc) but not have the text fade? I have a bunch of text boxes for a database, want them disabled till i hit the edit key, not a...
0
by: Mark Hahn | last post by:
I am using wxPython (wxWindows) and need a simple non-styled text control with an arbitrary image background. Since wx does not support transparent colored backgrounds on controls, I'm being...
1
by: GeneSZ | last post by:
How can I make a stored procedure which has a output parameter with text data type? My procedure is: CREATE PROCEDURE try @outPrm text Output AS select @outPrm =(select field1 from...
1
by: kim | last post by:
Hello! Here, in brief, is my problem. Access 2002. I need to export to a csv text file with text delimiters on every field. I find that if I save the original data in Excel and make sure the...
4
by: Marty Cruise | last post by:
Does anyone know of an wait-type cursor that can show text beside the hourglass? I'd like to display status messages beside the hourglass while not allowing the user to click anything...
2
by: Rod | last post by:
Hi, Does anyone know of a way to combine an icon with text on a pushbutton without venturing too deeply into the murky world of the graphics library. The icon is a gif loaded from a file but...
8
by: Imicola | last post by:
Hi, I want to use primary key IDs in my tables which are autonumbers, with a text prefix. I.e. for table tblVillage, the ID's will by V1, V2, V3... and for table tblHumanCases, the ID's will be...
4
by: christine chong | last post by:
now i'm using asp .net c# develop a system. i wish to using calendar control with text box, that when my cursor is at the text box then calendar just appear. then the date i select from calendar is...
7
by: shaiful | last post by:
Hi all, I have a problem with link with text. for example: I have a data from database "RS(1)" i want to see on form it with link and will show a msgbox. My question is how to make a link such as...
3
by: tokcy | last post by:
Hi, I have created dynamic row with text box i.e. initialy i have only one text box and add button when i clicked on add button it create another text box. and i want to append the values of...
0
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...
0
isladogs
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...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
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)...
1
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
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
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.