473,795 Members | 2,924 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 1764
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
5709
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
1214
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
6520
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
4542
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
2950
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
1340
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
16603
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
1278
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
1462
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
2893
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
9522
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
10443
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10216
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...
0
10002
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7543
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
6783
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();...
0
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4113
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
2
3728
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.