Groups | Blog | Home
all groups > dotnet xml > august 2005 >

dotnet xml : Do you have to be online to validate XML against a W3C schema?


Pascal Schmitt
8/12/2005 12:00:00 AM
Hello!

You can use XmlResolver to redirect the www.w3.org... requests to the
users hard-disk.


--
Martin Honnen
8/12/2005 12:00:00 AM


[quoted text, click to view]

Using a URL for a namespace is simply a way to have globally unique
name, there does not have to be any resource at that URL and you can
certainly validate for instance some XHTML with
<html xmlns="http://www.w3.org/1999/xhtml">
without ever needing to access the URL http://www.w3.org/1999/xhtml.

But of course if you want to validate against a schema then the
validator needs access to the schema and if you want to validate against
a schema residing somewhere on http://www.w3.org/ then you either need
to enable the validator to read the schema from there or you need to
make a local copy of the schema and make sure the validator works with
the local copy. As schema validation intentionally allows for validation
against a schema not linked to in the XML document (any
xsi:schemaLocation is only a hint) any validating parser supporting
schemas has an API that allows you to specify the schema(s) against
which to validate thus if you have local copies of the schemas needed
you can simply instruct the parser to use these by making the right API
calls.


--

Martin Honnen --- MVP XML
LesleyW
8/12/2005 5:07:02 AM
Hi

Apologies if this is a really dumb question, but being new to XML and
Schemas, I wonder if giving the namespace for eg xsd or xsi as a website
address means that the user has to be online when they run the app? If so,
what should I do if I can't guarantee that they will be? Can I bring all
these files into the app? Is that desirable?

I'm about to write an app that takes an XML file as input, using Visual
Studio 2005 Express and SQL Server 2005 Express, and I have to create a
schema that combines various standard ones that live on the net.

Thanks very much for any help.

LesleyW
8/12/2005 6:47:12 AM
Thanks for the replies.

So in VS 2005, are the standard W3C schemas already local and I just have to
copy in any others?

Is there a good source that describes how this works? I've been hunting for
days and can only find snippets here and there.

Many thanks again.

Stan Kitsis [MSFT]
8/12/2005 5:35:43 PM
Hi Lesley,

The XML Editor in VS2005 ships a set of predefined schemas which are
installed into your Visual Studio Installation directory under
%vsinstalldir%\xml\schemas (for example, C:\Program Files\Microsoft Visual
Studio 8\Xml\Schemas). These schemas describe some of the core standard XML
namespaces, as well as some of the Visual Studio specific namespaces.

When you open an XML file that uses any one of the namespaces defined by
these pre-defined schemas, the XML editor will automatically associate the
matching schema from the cache location (%vsinstalldir%\xml\schemas) and you
will immediately get validation errors and intellisense based on that
schema.

This schema cache directory is designed to hold schemas that are standard
and not likely to change. The list is as follows:

W3C & Soap Schemas
soap.xsd - Simple Object Access Protocol 1.0
soap1.1.xsd - Simple Object Access Protocol 1.1
soap1.2.xsd - Simple Object Access Protocol 1.2
wsdl.xsd - Web Service Description Language
xenc.xsd - XML Encryption
xhtml.xsd - XHTML 1.0
xlink.xsd - XML Linking
xml.xsd - Core XML attributes (xml:lang, xml:space, etc).
xmlsig.xsd - XML Digital Signatures
xsdschema.xsd - XSD for XSD
xslt.xsd - XML Transformation Language 1.0

WebData Schemas
msdata.xsd - ADO.NET XSD annotations.
datasource.xsd - <DataSource> XSD extensions
xdr.xsd - XML Data Reduced (SQL 2000)
xdrrowset.xsd - ADO recordset persistence XDR extensions
xdrtypes.xsd - Primitive types for XDR
msxsl.xsd - XSLT extensions for System.Xml.Xsl.

CLR & Windows Schemas
dotnetconfig.xsd - CLR config files
wshmeta.xsd - Windows Scripting Host

VS Core & MSBuild Schemas
addinschema.xsd - VS Addins
itemtemplate.xsd - Item templates
vstemplate.xsd - General templates
projecttemplate.xsd - Project templates
snippetformat.xsd - Code snippets
microsoft.msbuild.xsd - MSBuild schema
catalog.xsd - The XML Editor schema catalog format
vsIntellisense.xsd - XSD Intellisense extensions for XML & HTML editors.

Venus & Mobile Controls Schemas
adrotator.xsd - Ad Rotator control files
adrotator1_0.xsd - Ad Rotator v 1.0 files
sitemapschema.xsd - WebSite maps files
xmta.xsd - Smart Devices


--
Stan Kitsis
Program Manager, XML Technologies
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.


[quoted text, click to view]

Pascal Schmitt
8/13/2005 12:00:00 AM
Hello!

Kind of off-topic, but as you are "Program Manager, XML Technologies":

Will you add any kind of RDF-support in future .NET Versions? (And
editing support in VS.NET)? There are pretty few .NET implementations
(Drive, SemWeb, Euler.NET) and no dedicated data-store or query-engine.

Editing ontologies is a pain, an Editor for VS.NET wich is like the one
for XSD would be cool, IntelliSense (like for XML) for
RDF/XML-source-code editing too.


--
Chris Lovett
8/15/2005 10:11:09 AM
In VS 2005 there is are some standard schemas already provided in the box.
Check out the directory located at c:\program files\microsoft visual studio
8\xml\schemas.

If there are any more schemas you want the XML editor to always know about
automatically, just drop them in this folder. Or you can edit the
catalog.xml file in this directory to point to schemas located elsewhere on
your hard drive or LAN.

You can also just drop the schema in your Project (or Solution) and the XML
editor will automatically find them there. This is handy when it is a more
specific schema that you want scoped locally to a particular project.

If you installed the VS 2005 documentation you will find the details on how
the schema association works located under "Development Tools and
Languages\Visual Studio\Tools and Features\Working with XML Data\XML
Editor\XML Document Validation" and also the sibling page "Schema Cache".

Chris.


[quoted text, click to view]
AddThis Social Bookmark Button