473,387 Members | 3,787 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Validating XML file against an XSD schema

I have an XML file i'd like to validate against an XSD schema.

I'm creating the XML on the fly in an ASP.NET page and need to validate it
aginst the schema to ensure its well formed.

How do i do this?

Thanks in advance...

Simon Ames
Nov 12 '05 #1
2 5951
Hi simon,

Why not searching the msdn? i searched for "xml" "validating" "xsd" and
found some pages where to find example code using the

XmlValidatingReader

e.g.
http://msdn.microsoft.com/library/de...ctorTopic1.asp
http://msdn.microsoft.com/library/de...hemastopic.asp

hope that helps.

stefan

simon ames wrote:
I have an XML file i'd like to validate against an XSD schema.

I'm creating the XML on the fly in an ASP.NET page and need to validate it
aginst the schema to ensure its well formed.

How do i do this?

Thanks in advance...

Simon Ames


Nov 12 '05 #2
"simon ames" <am***************@hotmail.com> wrote in message news:#F*************@TK2MSFTNGP12.phx.gbl...
I'm creating the XML on the fly in an ASP.NET page and need to validate it
aginst the schema to ensure its well formed.


Simon,

It's not necessary to validate an XML document against a schema
to ensure it is well formed.

Well-formedness checking is a fundamental XML requirement.
Testing the schema validity of some XML makes a much stronger
statement about a document (and entails paying a greater price
in performance).

Just load the XML into an XmlDocument. The Load( ) method
throws an XmlException when the XML is not well formed.

Validate against a schema when you want to ensure that an XML
document is schema-valid, and/or you require the Post Schema
Validation Infoset (PSVI). The class to use for this purpose is an
XmlValidatingReader, which you can wrap around an XmlText-
Reader (which you can wrap around a number of sources: reader,
stream, URL).
Derek Harmon
Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: billcoumbe | last post by:
any recommendations? I'm looking for something that will just run from the unix command line to validate large (20-50Mb) XML files against an XML DTD. Ideally something that is actively...
6
by: Iain | last post by:
I've got a system which takes an XML file, translates it into an update gram and then loads it into my database with SQLXML3 (all in dot net). But it's fragile. And the SQLXML 3 error reporting...
1
by: Christian | last post by:
Hi, I load an Xml-file "customers.xml" into a DataSet (works fine) but then how do I validate it against a schema (e.g. customers.xsd) ? my customers.xml: <?xml version="1.0"...
2
by: Joris Janssens | last post by:
I'm trying to write a program for validating XHTML 1.1-documents against the XHTML 1.1 DTD (which is actually the same as validating an XML-file) but I always get a "(404) Not found" error. This...
3
by: Shailendra Batham | last post by:
hi guys I need your suggestions / opinion for doing this the right way. I have a XML and a Schema for the same What I want is when its validated against the schema, it should give custom...
1
by: Craig Beuker | last post by:
Hello, I am experimenting with this XmlValidatingReader and have a question about how it is working (or not working as would be the case) The sample documents and code are included at the end...
2
by: srujana | last post by:
Hi I am validating an xml document against schema . when i am passing the xml file location as an input to the parse method String XmlDocumentUrl="E:/books.xml"; parser.parse(XmlDocumentUrl);...
6
by: Andy B | last post by:
I need to make sure that a file saved in a particular place is a valid xml file that fits a certain schema. Where would I get started doing this? The original file would have been created and saved...
7
by: =?Utf-8?B?Q29kZVJhem9y?= | last post by:
I wrote a method to validate and xml file against a schema. If the file does not conform to the schema, it throws an error. It works fine except for one curious thing. If I try to validate an...
4
by: agda.karlberg | last post by:
Hello, I need to remove the DTD reference from an xml document, the reason for this is that we want to validate against a schema instead (which we have locally). It takes up to a minute to fetch...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...

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.