Re: How to associate XML with XSD
- From: "Bob Altman" <rda@xxxxxxxxxxxxx>
- Date: Mon, 7 Apr 2008 16:54:40 -0700
I think I found most of my answers myself. (Actually, a coworker happened to
wander by my padded cell and he enlightened me ;-) I'd appreciate if someone
who actually knows this stuff would comment on this posting to let me know if
I've got this more or less correct. Thanks!
1. Assuming that I have an XML file and its associated XSD file, what do I put
into the XML file to tell Visual Studio to use the XSD file to wire up
intellisense?
My coworker showed me how to include a bunch of xmlns gibberish in the top-level
element to specify the schema location:
<TopLevelElement
xmlns="MyDefaultNamespace"
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation="MyDefaultNamespace MySchemaFile.xsd" >
In the above example, "MyDefaultNamespace" is usually a string that looks like a
web URL, but it can pretty much be any string that doesn't include whitespace or
escaped characters.
2. Is there something else that I need to (or should) do to tell the VS IDE
that my XML file has an associated XSD file?
The "properties" for the XML file includes a field that specifies the related
XSD file. I don't know what happens if this property conflicts with the above
XML text.
The existence of this property solves another mystery -- how the IDE knows about
the schema of app.config files even though the text of the app.config file
doesn't contain any obvious reference to a schema file.
.
- Follow-Ups:
- Re: How to associate XML with XSD
- From: Steven Cheng [MSFT]
- Re: How to associate XML with XSD
- References:
- How to associate XML with XSD
- From: Bob Altman
- How to associate XML with XSD
- Prev by Date: How to associate XML with XSD
- Next by Date: Whoops: I deleted a registered schema
- Previous by thread: How to associate XML with XSD
- Next by thread: Re: How to associate XML with XSD
- Index(es):
Relevant Pages
|