By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,480 Members | 1,144 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,480 IT Pros & Developers. It's quick & easy.

rookie question - setting a path to a schema

P: n/a
Ian
I would like to set a path to a schema where both the xml file and the
schema are on my local hard drive (e.g. c:\XML\auto.xml and
c:\XML\auto.xsd)

Thank you,

Ian
Jul 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
/Ian/:
I would like to set a path to a schema where both the xml file and the
schema are on my local hard drive (e.g. c:\XML\auto.xml and
c:\XML\auto.xsd)


"2.6.3 xsi:schemaLocation, xsi:noNamespaceSchemaLocation"
<http://www.w3.org/TR/xmlschema-1/#xsi_schemaLocation>

Examples:

"5.6 schemaLocation" <http://www.w3.org/TR/xmlschema-0/#schemaLocation>

Note, these provide only a hint to the processor. If you manipulate
the files programmatically, depending on the programming framework
you use, you should be able to control these with processor's
specific calls.

--
Stanimir
Jul 20 '05 #2

P: n/a
Hi Stanimir,

According to the specification:

A schema is not required to have a namespace (see Undeclared Target
Namespaces (3.4)) and so there is a noNamespaceSchemaLocation
attribute which is used to provide hints for the locations of schema
documents that do not have target namespaces.

In this case the schema does have a namespace, but it is located on a
network or local hard drive. In testing, I have had some success with
http://localhost but that only works if all files are on my local hard
drive and not on the network .... any further thoughts?

Thanks,

Ian
Stanimir Stamenkov wrote:
/Ian/:
I would like to set a path to a schema where both the xml file and the schema are on my local hard drive (e.g. c:\XML\auto.xml and
c:\XML\auto.xsd)
"2.6.3 xsi:schemaLocation, xsi:noNamespaceSchemaLocation"
<http://www.w3.org/TR/xmlschema-1/#xsi_schemaLocation>

Examples:

"5.6 schemaLocation"

<http://www.w3.org/TR/xmlschema-0/#schemaLocation>
Note, these provide only a hint to the processor. If you manipulate
the files programmatically, depending on the programming framework
you use, you should be able to control these with processor's
specific calls.

--
Stanimir


Jul 20 '05 #3

P: n/a
/ia*********@gmail.com/:
A schema is not required to have a namespace (see Undeclared Target
Namespaces (3.4)) and so there is a noNamespaceSchemaLocation
attribute which is used to provide hints for the locations of schema
documents that do not have target namespaces.

In this case the schema does have a namespace, but it is located on a
network or local hard drive. In testing, I have had some success with
http://localhost but that only works if all files are on my local hard
drive and not on the network .... any further thoughts?
The namespace URI is nothing more but uniquely identifying the
namespace - it doesn't designate the resource of the schema document.

Here:

-----"c:\XML\auto.xsd"

<?xml version="1.0" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:x-ian-test:auto">

<xs:element name="example" type="xs:string" />

</xs:schema>

-----"c:\XML\auto.xml"

<?xml version="1.0" ?>
<example xmlns="urn:x-ian-test:auto"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:x-ian-test:auto auto.xsd">

bla-bla

</example>
There:

<http://www.w3.org/TR/xmlschema-0/#UsingSchemaLocationInQuarterly>:
The schemaLocation attribute value consists of one or more pairs of
URI references, separated by white space. The first member of each
pair is a namespace name, and the second member of the pair is a
hint describing where to find an appropriate schema document for
that namespace.
<http://www.w3.org/TR/xmlschema-1/#schema-loc> (a bit down bellow):
3. On the other hand, in case a document author (human or not)
created a document with a particular schema in view, and warrants
that some or all of the document conforms to that schema, the
'schemaLocation' and 'noNamespaceSchemaLocation' attributes ... are
provided. The first records the author's warrant with pairs of URI
references (one for the _namespace name_, and one for a hint as to
the _location of a schema document_ defining names for that
namespace name).


--
Stanimir
Jul 20 '05 #4

P: n/a
I understand what you are saying now. Appreciate you taking the time to
spell it out for me!

Thank you,

Ian

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.