Click here to Skip to main content
15,892,005 members
Home / Discussions / C#
   

C#

 
AnswerRe: question about program's name in open-with dlg Pin
CooperWu4-Nov-06 15:02
CooperWu4-Nov-06 15:02 
GeneralRe: question about program's name in open-with dlg Pin
likefood4-Nov-06 18:39
likefood4-Nov-06 18:39 
QuestionHow to make my program send faxes Pin
Boshkash4-Nov-06 9:18
Boshkash4-Nov-06 9:18 
AnswerRe: How to make my program send faxes [modified] Pin
Amar Chaudhary4-Nov-06 21:23
Amar Chaudhary4-Nov-06 21:23 
QuestionGZipStream for compact framework 2.0 Pin
wajih.boukaram4-Nov-06 8:59
wajih.boukaram4-Nov-06 8:59 
AnswerRe: GZipStream for compact framework 2.0 Pin
Suelinda_W15-Dec-06 8:11
Suelinda_W15-Dec-06 8:11 
QuestionHow to get IWMHeaderInfo3 interface from WMEncoder Pin
Hemant kulkarni4-Nov-06 8:34
Hemant kulkarni4-Nov-06 8:34 
QuestionValidating XML Schema Pin
RichardInToronto4-Nov-06 7:20
RichardInToronto4-Nov-06 7:20 
Hi,

By calling Dataset.WriteXml, my code produces XML as listed below.

The user can also load the XML file, and I will use Dataset.ReadXML to do this. Preferably before calling that method, I would like to validate the schema of the XML to ensure that it has the same structure as an XML file produced by WriteXml. How can I do that?

At present, I am loading the XML file and writing code like this:
ValidXml =
(LoadedOk) &
(dsKeysAndValues.Tables[dsnKeysAndValues].Columns[KeyGroup] != null) &
(dsKeysAndValues.Tables[dsnKeysAndValues].Columns[ValueGroup] != null) ;
The code not only doesn’t work, but it also doesn’t seem elegant – if the XML file is large, it will take time just to load the file, before I can validate it.
How can I validate the schema of XML to ensure that it matches what I am expecting?

Thanks for your help, pointers, and time!

Richard

The mystery is out there – in the XML-Files (X-files music follows…)

XML produced using WriteXml:

<?xml version="1.0" standalone="yes"?>
<KeysAndValues>
<xs:schema id="KeysAndValues" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="KeysAndValues" msdata:IsDataSet="true" msdata:Locale="en-CA">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="KeysAndValues">
<xs:complexType>
<xs:sequence>
<xs:element name="Key" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="50" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Value" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="255" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
<KeysAndValues>
<Key> K1</Key>
<Value> V9999</Value>
</KeysAndValues>
AnswerRe: Validating XML Schema Pin
Stefan Troschuetz4-Nov-06 22:38
Stefan Troschuetz4-Nov-06 22:38 
GeneralRe: Validating XML Schema Pin
RichardInToronto6-Nov-06 7:03
RichardInToronto6-Nov-06 7:03 
Questionhow to convert char[] to System.IntPtr Pin
Hemant kulkarni4-Nov-06 6:01
Hemant kulkarni4-Nov-06 6:01 
AnswerRe: how to convert char[] to System.IntPtr Pin
Guffa4-Nov-06 6:39
Guffa4-Nov-06 6:39 
GeneralRe: how to convert char[] to System.IntPtr Pin
Hemant kulkarni4-Nov-06 7:16
Hemant kulkarni4-Nov-06 7:16 
GeneralRe: how to convert char[] to System.IntPtr Pin
Guffa4-Nov-06 7:51
Guffa4-Nov-06 7:51 
Questionrichtextbox Pin
ammoh4-Nov-06 5:24
ammoh4-Nov-06 5:24 
AnswerRe: richtextbox Pin
Judah Gabriel Himango4-Nov-06 8:46
sponsorJudah Gabriel Himango4-Nov-06 8:46 
QuestionSelected text in datagrid cell not refreshing [modified] Pin
coachDon4-Nov-06 4:58
coachDon4-Nov-06 4:58 
Questionhair stylist software Pin
samreengr84-Nov-06 4:17
samreengr84-Nov-06 4:17 
AnswerRe: hair stylist software Pin
User 66584-Nov-06 4:25
User 66584-Nov-06 4:25 
GeneralRe: hair stylist software Pin
samreengr84-Nov-06 4:46
samreengr84-Nov-06 4:46 
GeneralRe: hair stylist software Pin
mav.northwind4-Nov-06 5:17
mav.northwind4-Nov-06 5:17 
JokeRe: hair stylist software Pin
likefood4-Nov-06 18:49
likefood4-Nov-06 18:49 
GeneralRe: hair stylist software Pin
User 66585-Nov-06 1:34
User 66585-Nov-06 1:34 
GeneralRe: hair stylist software Pin
Guffa4-Nov-06 5:49
Guffa4-Nov-06 5:49 
JokeRe: hair stylist software Pin
Colin Angus Mackay4-Nov-06 12:15
Colin Angus Mackay4-Nov-06 12:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.