Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What is wrong with my XML?
Message
 
 
Information générale
Forum:
ASP.NET
Catégorie:
XML
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01293491
Message ID:
01293521
Vues:
15
I think the problem is in the way I added XSD Schema to the XML.

Because if I cut the XSD Schema code from the XML, all works.

>When trying to read an XML file into a data set, I get an error the "Input string was not in correct format".
>
>Note that I started getting an error after I added XSD into my XML.
>
>Here is my code:
>
>DataSet dstEmailList;
>dstEmailList = new DataSet("EmailList");
>// error is on the following line
>dstEmailList.ReadXml(@cEmailListXmlFileName);
>
>
>Here is my XML file:
>
>
><?xml version="1.0" encoding="utf-8" ?>
><EmailList>
>	<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
>		<xsd:element name="EmailList">
>		<xsd:complexType>
>			<xsd:sequence>
>				<xsd:element name="Contact"  minOccurs="0" maxOccurs="unbounded">
>					<xsd:complexType>
>						<xsd:sequence>
>							<xsd:element name="FirstName" type="xsd:string" />
>							<xsd:element name="LastName" type="xsd:string" />
>							<xsd:element name="Email" type="xsd:string" />
>							<xsd:element name="FromDOW" default="0" type="xsd:int" />
>							<xsd:element name="ToDOW" default="7" type="xsd:int" />
>							<xsd:element name="FromHour" default="0" type="xsd:int" />
>							<xsd:element name="FromMinute" default="0" type="xsd:int" />
>							<xsd:element name="ToHour" default="24" type="xsd:int" />
>							<xsd:element name="ToMinute" default="60" type="xsd:int" />
>							<xsd:element name="StopSendingEmail" type="xsd:string" />
>						</xsd:sequence>
>					</xsd:complexType>
>				</xsd:element>
>			</xsd:sequence>
>		</xsd:complexType>
>	</xsd:element>
></xsd:schema>
>	<Contact>
>		<FirstName>John</FirstName>
>		<LastName>Smith</LastName>
>		<Email>john.s@yahoo.com</Email>
>		<FromDOW></FromDOW>
>		<ToDOW></ToDOW>
>		<FromHour>0</FromHour>
>		<FromMinute></FromMinute>
>		<ToHour>0</ToHour>
>		<ToMinute>0</ToMinute>
>		<StopSendingEmail>0</StopSendingEmail>
>	</Contact>
></EmailList>
>
>
>Can anybody see what I did wrong in my XML or my XSD?
>
>Thank you in advance for any help.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform