Click here to Skip to main content
15,891,674 members
Home / Discussions / XML / XSL
   

XML / XSL

 
GeneralRe: Validating xml against schema using System.Xml in unmanagedC++ Pin
Murlai16-Nov-04 19:31
Murlai16-Nov-04 19:31 
GeneralRe: Validating xml against schema using System.Xml in unmanagedC++ Pin
DavidNohejl16-Nov-04 22:56
DavidNohejl16-Nov-04 22:56 
Generalinitial xml template with xmldatadocument Pin
Raduenzel12-Nov-04 3:37
Raduenzel12-Nov-04 3:37 
GeneralHosting xml editor in WinForm application Pin
Member 151042610-Nov-04 14:20
Member 151042610-Nov-04 14:20 
GeneralXML Serialization Pin
colin mcadam10-Nov-04 9:19
colin mcadam10-Nov-04 9:19 
GeneralRe: XML Serialization Pin
Philip Fitzsimons12-Nov-04 6:23
Philip Fitzsimons12-Nov-04 6:23 
GeneralValidate xml against schema, C# Pin
berlinbrown10-Nov-04 4:48
berlinbrown10-Nov-04 4:48 
GeneralRe: Validate xml against schema, C# Pin
DavidNohejl10-Nov-04 6:58
DavidNohejl10-Nov-04 6:58 
hi,
it is very simple... i don't have full code, bt I don't think it is a problem. Wink | ;)
I am working on app where I validate XML against my XSD:
this method reads XML with XmlValidatingReader
<br />
public void ValidateStg(String URL)<br />
{<br />
XmlValidatingReader r = new XmlValidatingReader(new XmlTextReader(URL));<br />
			try<br />
			{							<br />
				r.ValidationType=ValidationType.Schema;<br />
				r.ValidationEventHandler+=new System.Xml.Schema.ValidationEventHandler(r_ValidationEventHandler);<br />
				// TODO: plz get rid of this hard-coded local XSD Schema link!!!<br />
				r.Schemas.Add(null,"http://localhost/mySchemaExample/Schema.xsd");<br />
				while(r.Read())<br />
				{<br />
			<br />
				}<br />
			}<br />
			finally<br />
			{<br />
				r.Close();<br />
			}<br />
}<br />

there is handler called when there is some problem ( I write down error message into xml log):
<br />
private void r_ValidationEventHandler(object sender, System.Xml.Schema.ValidationEventArgs e)<br />
{<br />
XmlDocument doc = new XmlDocument();<br />
				doc.Load(@"C:\Inetpub/wwwroot/mySchemaExample/report.xml");<br />
				XmlElement el = doc.CreateElement(null,"error",null);<br />
				el.InnerText = e.Message;<br />
				doc.DocumentElement.AppendChild(el);<br />
				doc.Save(@"C:\Inetpub/wwwroot/mySchemaExample/report.xml");<br />
			}<br />

As you see, it is really simple. Smile | :)

best regards,
David 'DNH' Nohejl

Never forget: "Stay kul and happy" (I.A.)
GeneralDTD and attributes Pin
Svekke10-Nov-04 0:54
Svekke10-Nov-04 0:54 
GeneralRe: DTD and attributes Pin
Cohen24-Nov-04 3:51
Cohen24-Nov-04 3:51 
QuestionHow to get data from xml document to a datagrid Pin
Ehab Nady7-Nov-04 23:13
Ehab Nady7-Nov-04 23:13 
AnswerRe: How to get data from xml document to a datagrid Pin
Christian Graus10-Nov-04 14:40
protectorChristian Graus10-Nov-04 14:40 
Generalhelp with XPath expression Pin
Mike Hodnick7-Nov-04 4:48
Mike Hodnick7-Nov-04 4:48 
GeneralRe: help with XPath expression Pin
Tomas Petricek7-Nov-04 15:16
Tomas Petricek7-Nov-04 15:16 
GeneralRSS + ATOM Parser Pin
Azel Low7-Nov-04 0:03
Azel Low7-Nov-04 0:03 
GeneralXML Schema Problem!!! Pin
Het21095-Nov-04 17:50
Het21095-Nov-04 17:50 
Generalxml request and response Pin
lighting_blue2-Nov-04 8:31
lighting_blue2-Nov-04 8:31 
GeneralRe: xml request and response Pin
DavidNohejl3-Nov-04 7:22
DavidNohejl3-Nov-04 7:22 
GeneralXML to .doc,.html,.rtf Pin
makakiu31-Oct-04 5:34
makakiu31-Oct-04 5:34 
GeneralRe: XML to .doc,.html,.rtf Pin
DavidNohejl31-Oct-04 7:33
DavidNohejl31-Oct-04 7:33 
GeneralXPath expression Pin
Anonymous29-Oct-04 22:50
Anonymous29-Oct-04 22:50 
GeneralRe: XPath expression Pin
Stuart Dootson29-Oct-04 23:05
professionalStuart Dootson29-Oct-04 23:05 
GeneralXML Element Naming Pin
ITMan29-Oct-04 4:35
ITMan29-Oct-04 4:35 
GeneralHTML from XML Pin
Boniolopez27-Oct-04 23:57
Boniolopez27-Oct-04 23:57 
GeneralRe: HTML from XML Pin
DavidNohejl28-Oct-04 1:49
DavidNohejl28-Oct-04 1:49 

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.