473,602 Members | 2,792 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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"
elementFormDefa ult="qualified" attributeFormDe fault="unqualif ied">
<xs:element name="Applicati on">
<xs:complexType >
<xs:sequence>
<xs:element name="ReceivedD ate" type="xs:string "/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

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

<Application><R eceivedDate>Tes t &amp; Date</ReceivedDate></Application>

When validating with XmlValidatingRe ader 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 XmlValidatingRe ader or
XmlTextReader that causes it to get confused when an entity exists in
element text?

Thanks,

Nate
Nov 12 '05 #1
1 1745
I did not get an error when I tried XmlValidatingRe ader 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"
elementFormDefa ult="qualified" attributeFormDe fault="unqualif ied">
<xs:element name="Applicati on">
<xs:complexType >
<xs:sequence>
<xs:element name="ReceivedD ate" type="xs:string "/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

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

<Application><R eceivedDate>Tes t & Date</ReceivedDate></Application>

When validating with XmlValidatingRe ader 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 XmlValidatingRe ader 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
5682
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 problem, cept they are kind of hard to read while disabled. thanks!
0
1207
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 forced to use a simple pane with a bitmap loaded and write the text directly over the bitmap with text drawing calls. Does anyone know of any existing python code that implements the logic of a text control with direct calls to painting text on any...
1
6510
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 databaseName Where field2='12345') GO
1
4521
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 data format selected is text it, when I open it in Access and try to export it will put the quotes around all the string data, including null values, but will not put quotes around the numeric data. Anyone have any ideas on how I can force it to...
4
2939
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
1335
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 the text is read from a resource and may be in any one of several languages so I probably need to create the button logo on the fly using text in a string. Any suggestions on how I can combine the two?
8
16580
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 H1, H2, H3... I have a few questions: 1. I have heard its not good to do this. Is this true and if so why? 2. I am also having problems creating the relationships to related tables due to the field types. In the parent table the field type...
4
1265
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 appear at text box. anyone know how to do that? please give me a guide thz a lot
7
1446
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 hyper link on a text ..? pls give me advice or idea if u have . thx advance , shaif
3
2886
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 dynamic text box in hidden field but its not working properly when i am appending the values of text box it appends again and again same value mean suppose in 1st text box the value is 1 and in second the value is 2 and so on... then when i am trying to...
0
7920
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8404
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8054
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6730
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5867
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5440
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2418
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1254
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.