I also have a question when using VS 2008 to edit the xml file. In my
xml file, I used schemaLocation attribute to specify the xsd. If I put
the xsd in our internal sharepoint site such as:
xsi:schemaLocation="someNs http://sharepoint/Test.xsd"
VS2008 xml editor shows that "this schema referenced from this
location in your document contains errors". However if I copy the xsd
to the local folder, and use this:
xsi:schemaLocation="someNs C:\Test.xsd"
Then it works fine. Also the first method works in VS 2005. So is
there anything changed in the VS 2008 xml editor?
Thanks,
Heng-yi
On Apr 7, 10:03*pm, stch...@online.microsoft.com (Steven Cheng [MSFT])
wrote:
Hi Bob,
As for XML document/file and the XML schema(xsd) it rely on(conform to),
here are some of my understanding:
** From XML standard, we generally do not specify the location (url or file
path ) of the xml schema, we only add namespace attributes in XML document
so as to indicate what namespace those Nodes in XML document belong to. *
** For the location where to find the schema, it is normally the XML
Editor/Designer's task. Yes, there is "xsi:schemaLocation" attribute that
can help specify a schema via url/path location, however, *this is still
depend on whether the XML Editor or designer will use it. If the IDE won't
take care of this attribute(will try locating the schema from the specified
location and perform validation).
** For Visual Studio, it use several means to find the schemas to validate
the document or provide intellisense:
1) schema in *the Visual Studio's global cache location. e.g. the VS 2008
use the following path:
C:\Program Files\Microsoft Visual Studio 9.0\Xml\Schemas
2) You can also add schema in the property window when you editing a xml
file in VisualStudio xml editor
3) Visual studio xml editor will also look for "schemaLocation" you
specified in xml document for reference
You can also add your own schemas to global cache or customize it. The
following MSDN documenet has mentioned those features:
#Schema Cache *http://msdn2.microsoft.com/en-us/lib...21(VS.80).aspx
Hope this helps.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msd...@microsoft.com.
==================================================
Get notification to my posts through email? Please refer tohttp://msdn.microsoft.com/subscriptions/managednewsgroups/default.asp...
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) athttp://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights..
--------------------
From: "Bob Altman" <r...@nospam.nospam>to
References: <uVZqyNQmIHA.3...@TK2MSFTNGP02.phx.gbl>
Subject: Re: How to associate XML with XSD
Date: Mon, 7 Apr 2008 16:54:40 -0700
I think I found most of my answers myself. *(Actually, a coworker happenedwander by my padded cell and he enlightened me ;-) *I'd appreciate ifsomeonewho actually knows this stuff would comment on this posting to let me knowifI've got this more or less correct. *Thanks!I put1. Assuming that I have an XML file and its associated XSD file, what dointo 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 thetop-levelelement 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 lookslike aweb URL, but it can pretty much be any string that doesn't includewhitespace orescaped characters.IDE2. Is there something else that I need to (or should) do to tell the VSthat my XML file has an associated XSD file?The "properties" for the XML file includes a field that specifies therelatedXSD file. *I don't know what happens if this property conflicts with theaboveXML text.The existence of this property solves another mystery -- how the IDE knowsaboutthe schema of app.config files even though the text of the app.config file
doesn't contain any obvious reference to a schema file.- Hide quoted text-
- Show quoted text -