473,386 Members | 1,609 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,386 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 1726
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.