Validating xml
Hi guys,
I've recently discovered that XML is pretty cool thing, and I should be familiar with it.
So I have done xml file: http://testingzone.50webs.com/intervals.xml,
and xml shema for it: http://testingzone.50webs.com/intervals.xsd
Now i have a problem validating it, i don't know maybe i'm using wrong validators or don't know how to use them right, please help me to figure it out or give me a hint.
P.S: thanks for help and support and sorry for stupid newbie question
[522 byte] By [
Z e n] at [2007-11-11 8:26:56]

# 1 Re: Validating xml
Zen,
I think the problem is the schemaLocation attribute. The first part of the attribute value specifies only the namespace, not the path of the schema.
The following validates ok on my computer:
<?xml version="1.0" encoding="utf-8" ?>
<intervals xmlns="http://testingzone.50webs.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://testingzone.50webs.com http://testingzone.50webs.com/intervals.xsd">
<interval>
<label>A</label>
<left>1</left>
<right>2</right>
</interval>
</intervals>
Gerald
XML Copy Editor (http://xml-copy-editor.sourceforge.net)
# 2 Re: Validating xml
Thanks for the reply Geralds,
I really appreciate your help,
If you please I'd ask another one question (or couple):
1. What validator do You use?
2. Is it possible to validate xml on local computer (with IIS installed)?
I tried to use MS Visual Studio 2003.Net to validate xml on local machine but I always get error like "Can't find schema to validate xml document", I used xmlns = "http://localhost" (xml files were situated in wwwroot directory).
Anyway thanx for your help.
Z e n at 2007-11-11 23:29:40 >

# 3 Re: Validating xml
Zen,
1. I'm using MSXML 4.0. I think it's installed on most recent Windows machines. (Updating IE should ensure that the latest version is present.)
2. Absolutely. Just make sure you include the xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" attribute and give the full path as the second part of the xsi:schemaLocation attribute. (You could try xsi:noNamespaceSchemaLocation="http://..." to make sure the file is accessible to the parser.)
You can call MSXML via COM in-process automation. I could imagine .NET offers convenience functions for this, but I don't have .NET installed. Alternatively, if you want to validate against XML Schemas/RELAX NG grammars/DTDs on your computer, you could always use an editor that does this for you.
Gerald
XML Copy Editor (http://xml-copy-editor.sourceforge.net)