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


0
4/1/2004 1:21:24 PM
dotnet.xml 7266 articles. 0 followers. Follow

2 Replies
599 Views

Similar Articles

[PageSpeed] 58

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/default.asp?url=/library/en-us/cpref/html/frlrfSystemXmlXmlValidatingReaderClassctorTopic1.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemxmlxmlvalidatingreaderclassschemastopic.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
> 
> 

0
lischke (6)
4/1/2004 1:58:19 PM
"simon ames" <amessimon-nospam-@hotmail.com> wrote in message news:#FZm7w#FEHA.264@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


0
loresayer (274)
4/2/2004 3:20:03 AM
Reply:

Similar Artilces:

open dba files
I have Windows 2003 and Palm 1S. Trying to recover Palm archive data in .dba format. Windows won't let me cut or paste file from archive to pda. Can anyone help? Thanks. And your Word question is? "ShirleyD" <ShirleyD@discussions.microsoft.com> wrote in message news:301AF667-A258-49F3-B32C-9715B96B0DBD@microsoft.com... :I have Windows 2003 and Palm 1S. Trying to recover Palm archive data in ..dba : format. Windows won't let me cut or paste file from archive to pda. Can : anyone help? Thanks. ...

File Access History
Is there anything in Excel that will show a history of who accessed, modified, and/or saved an Excel workbook other than what's in the file properties dialog box? Thanks in advance. :) Afraid not. -- Jim Rech Excel MVP "lensolo" <lensolo@discussions.microsoft.com> wrote in message news:5D5A47D1-AF26-426A-BB82-46CBBCAD90F6@microsoft.com... | Is there anything in Excel that will show a history of who accessed, | modified, and/or saved an Excel workbook other than what's in the file | properties dialog box? | | Thanks in advance. :) | ...

Restore Backup Files
Hi there I have posted this question to the XP Professional x64 Edition and Windows XP General Discussion board as suggested by other users. Some time ago I set up the Backup feature on Windows XP Pro so that my laptop data got backed up daily to an external hard drive. The laptop was recently stolen but thankfully, the external hard drive was left behind and I have a Mac desktop computer with Bootcamp. When I restore the backup.bkf file, the directories are all there, but there is no data - not a Word, Excel, PDF or any other type of file to be found yet the backup.bkf file ...

How to change attributes in an xml-file
Hi, I wrote a small c# programm, which generates an xml-string by serializing a class and sends it to a server. Now I want to change some values in that xml-string. The only way for me to do that might be, to deserialize it, change the particular attribute and serialize it again, to finally save it on my harddisk. But I believe, that there is a more convenient way to do this, since it is also possible to append an element... Can anybody help me in this matter? What about the class XmlAttribute? I appreciate for you help. Cheers Philipp Philipp wrote: > I wrote a small c# pro...

HTML file viewing/editing trouble
Hello all, I have created a webpage and all the links work fine when previewing the publisher file. When I save my publisher file as an HTML file on the server (I have direct access to the server), my subsequent pages do not load.... only the home page. If I try to click on the HTML file to edit with publisher, again I only see my home page. Any ideas would be greatly appreciated. Without seeing your site (it always helps to give an url), it could be a number of things. One common problem is Pub changes your text to an image, especially if you have a background color. Mike PS - yo...

File System Error 2 during IO on log file .. MS exchange 5.5
I am getting following message intermittently. MSexchangeIS (277) File system error 2 during IO on log file. Event id 163 MSexchangeIS (277) Unable to write log Error -510 Event id 120 MSexchangeIS (277) Unable to write log header 510 Event id 121 An error occured while writing to the database log file. Attempting to sop the Microsoft exchange Information store Event id 1111 Unable to create log . The drive may be read-only, out of disk space, misconfigured or corrutpted. Error 510 ---> Because of the Exchange is not operative, i have to restart services. --> The same problem ...

Determine schemas used by document
Hi, Using .Net 2.0 what is the best way to determine the list of schemas used by a XmlDocument. Thanks Donal Donal McWeeney wrote: > Using .Net 2.0 what is the best way to determine the list of schemas used by > a XmlDocument. Each XmlDocument instance has a property named Schemas <http://msdn2.microsoft.com/en-us/library/system.xml.xmldocument.schemas(VS.80).aspx> Is that what you are looking for? Note sure what kind of "use" you have in mind. -- Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/ Schemas is empty and only used (I think) for the...

putting parameters into XML and than in collection?
Hi, I have application A giving 1 string containing some parameter to application B. I guess it would be 'nice' if I made that parameter-string in XML-format. In my application B I need a way to find out easily which parameters are put into the XML-string, and I need to be able to work easily with them. Would it be good to read out the XML and put it in a Collection? Or a better way how to do that? Is it really necessary to transform it into sometyhing else in the application? Other question: I'm not really familiar with XML. Is there somewhere a quick overview on how I need to...

Reusing SBMnn Numbers and Locating SBM files
I have added and deleted various companies in SBM. Each add uses the next SBM number. When I delete a company that number is removed. Is there a way to recover and re-use a number? Is it possible to have different SBM companies on different drives? Fred Fred, Next newsgroup down. This is the M$ Retail Management Point of Sale group. -- * "Fred" <Fred@discussions.microsoft.com> wrote in message news:A2454A5E-956F-4EF1-BCDA-A5A4B8C0457B@microsoft.com... I have added and deleted various companies in SBM. Each add uses the next SBM number. When I delete a company that numbe...

VBA to write cells out to a file
I want to... open new file check cell data (If data="xyz" then goto close file or whatever) write cell data write a string move to next cell check cell data (If data="xyz" then goto close file or whatever) write cell data write a string etc close file can anyone give me sample code snippit to... - create/open a file - check cell data - branch on results - write cell data - write a string - close file thanks for any help You can use the macro recorder to create some of this code as you perform the steps manually. Then, edit the generated code. If you...

Simple problem importing a file using a macro
Hello Everyone, I am very new to Excel programming, but I have written a few simple macros before. However, I have never really worked with loading information out of a file and then saving it back. I have a series of text files which contain data that I want to import. I ran the macro recorder to import one file that I wanted where I wanted it, but I am now trying to automate the process. All the files end in .PRN. I write the name of the file that I want in the "A" row of an Excel spreadsheet, minus the ".PRN". The files are always on a floppy disk in the &...

Including Video Files
Hi, I've made a Web site using Publisher 2007. Everything works except my three WMV video files. How do I include them in my Publisher file so that when I "Publish to Web..." they get FTPd to my site and the links to them work? Thanks, Dan Including external files in a Publisher web: http://msmvps.com/blogs/dbartosik/archive/2006/01/07/80561.aspx DavidF "Daniel Jameson" <danjam47@newsgroup.nospam> wrote in message news:%23ObKak9cIHA.3400@TK2MSFTNGP03.phx.gbl... > Hi, > > I've made a Web site using Publisher 2007. Everything works except ...

Money -- import of Excel File of Transactions ...
I'm having trouble reconciling my account on line. So I was able to download the account into Excel and "fixed" my transactions that way. How do I import these transactions into an excisting account into Microsoft Money (2003). Thanks. Convert it to QIF. More details in the FAQ. "jkotecha" <anonymous@discussions.microsoft.com> wrote in message news:D25442EC-C729-4522-AB11-3DE56336C40C@microsoft.com... > I'm having trouble reconciling my account on line. So I was able to download the account into Excel and "fixed" my transactions that way. How d...

automatically update data validation selections
I've restricted user enter for certain cells to a named range. Fo example, the named range includes: Apples, Oranges, Bananas. Let's say a user selects "Apples". Then, the list is updated so tha "Apples" becomes "Green Apples". I want what the user selecte ("Apples") to now automatically reflect "Green Apples". I canno figure out how to accomplish this without using a combo box - but really don't want to use a combo box - just keep the user entry area a cells. Any suggestions with no code or a minimum of code are much appr...

File in Use Error
Hello, I have a excel spreadsheet with two worksheets, each of which connects to the same Access database via an ODBC connection to retrieve data. The worksheets have different data and are pulling from different tables in access. I was able to do this without any problem but since I am the owner and creator for both files I did not forsee any problems. Now I need another individual to do this task but when they open the excel file they get 'File in Use :|' error. The person has read, write, modify and excute rights to the database. Any help will be appreciated. Thank you. Sini ...

End User Recovery
Good Morning, Before DPM we used Shadow Copy on our windows servers. We were able to right click on a file or folder, pick previous versions and gain access to the shadow copies. Now that we have DPM, this seems to have changed. We can right click on a folder and see our previous versions, but if we try the same on a file we just get no previous versions available. Is this correct? Thanks Dear, If you go on a folder, you will always see "previous versions" A file will only show you "previous versions" if there are actually previous versions. ...

There has been an error reading or writing the file
I am using Money 2005 and when I try and create a report for Account Transactions I get the error message mentioned above. MS article 281865 confirms this problem and asks that the report be customized. My problem is that Money shuts down without giving me a chance to customize the report. Please help ...

.xls file gets renamed to a file with no extension
Hello All! I am using Excel 2000 and I am occasionally having an issue with my .xls files being renamed. I have an in-house application that opens, modifies, saves and closes any given list of .xls files. Prior to running the in-house app, let's say my directory contains 10 .xls files. Sometimes, after the in-house app runs, the directory will have (for example) 8 .xls files and 2 files with no extensions (like 22F1AC20). Sometimes, as the in-house app is modifying the .xls files, I watch the timestamps of the files (via Windows Explorer) as they change after the files are ope...

Problems copying from PDF file
When I copy an object from an Adobe Reader file and paste it into a Publisher file, I have two problems: object loses its sharpness and when I print it out, it prints out in a solid black block. What am I doing wrong? Any help would be appreciated! Thank you. What happens if you copy and paste into an editing program and save and then insert into Publisher. What happens if you select "paste special" and designate a specific format? What is the resolution of the picture? Where did you get the PDF? Do you have an URL? -- Mary Sauer MSFT MVP http://office.microsoft.com/ http...

file attachment #4
Could anyone suggest how to override the setting that I have in Outlook Express? I try to send a file attachment with my emails and it deletes them when I send the email out. It says OE has deleted the file just in case it has a bug in it.Akkkk! any help would be appreciated. This newsgroup is for support of Outlook 97-2003 from the Office family for Windows PCs. For Outlook Express (OE) support try posting in one of these newsgroups: microsoft.public.inetexplorer.ie4.outlookexpress for OE 4.x microsoft.public.windows.inetexplorer.ie5.outlookexpress for OE 5.x http://support.microsoft.com...

importing PST file
I exported all my outlook to a pst file before my system crashed. I am having difficulty in importing the pst file. When I follow the instruction an error message come that the file has no rule. Can someone guide me though the process As stated here frequently Export / Import is not the way to transfer outlook data. Where is the pst file located? How are you trying to 'recover' this data file? "Steve" <Steve@discussions.microsoft.com> wrote in message news:0F84899B-4F48-46A3-910B-5DE93FF38384@microsoft.com... >I exported all my outlook to a pst fi...

Read a .pub file when don't have Publisher
I was sent a .pub file, but don't have Publisher. Is there free software to download so I can just read the file? ala .pdf files? Thx. After managing to set up OE-QuoteFix on his new PC, Ed reads a message from Susan <anonymous@discussions.microsoft.com>... > I was sent a .pub file, but don't have Publisher. Is there free > software to download so I can just read the file? ala .pdf files? No. Refer the source to http://www.mvps.org/publisher/sharing.html Converting the file to PDF is the best option. The whole point of PDF is to share documents created in other applic...

Excel 2007 prompt to open file as read only
I would like an Excel 2007 file to prompt the user to open a file as read only. How do I do this? Thank you! If you want the user to see a prompt, open the file. Do a SaveAs Click Tools|General options|and check "read-only recommended" They can still answer "no" to this prompt, right? SEllis wrote: > > I would like an Excel 2007 file to prompt the user to open a file as read > only. How do I do this? Thank you! -- Dave Peterson ...

Updating linked files
I have Excel 2003 workbooks that are linked. The files are located in the same directory but I do take them home and work there with the files on a USB jump drive. When I copy them back to the work PC and open one, it asks me if I want to update. When I click update all my vlookups and such return #values. When I open the parent? file, the values are updated. Is this normal that all files need to be open in Excel to do the update or is the copying back and forth messing with something? Thanks, -- Lee Coleman ...

Im wanting to down load a file where i can go in and make my own .
Im wanting to know what file i can download so i can make my own business cards There are a multitude of templates within Publisher. Always post what version you are using. Hey David, missed you... Everyone said you abandoned us to go to Serif. How are things down under? I hear the Aussie PM is still on Bush's side... -- Mary Sauer MS MVP http://office.microsoft.com/ http://www.msauer.mvps.org/ news://msnews.microsoft.com "��MS-Publisher��" <brains@here.com> wrote in message news:OVYylLGqEHA.3712@TK2MSFTNGP15.phx.gbl... > There are a multitude of templates wit...