473,218 Members | 1,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,218 software developers and data experts.

understanding noNamespaceSchemaLocation

XML, Schemas, and XSLT has been part of my life for a number of years
now, but I have always used it in desktop application where I simply
make the noNamespaceSchemaLocation attribute the name of the schema
because it is going to reside in the same location as the xml file.

I am now working on a project that is a bit more complex. Again part
is a desktop application which will not have access to the Internet all
the time, but another part of the project does have access to the
Internet. It is my understanding that within the XML, it is possible
to provide a URL as the namespace name.

How exactly do I go about setting up the XML so that when it is
validated on the desktop application, I can simply provide the schema
like I always have and then on the web it uses the URL as the source.

I don't think my question makes any sense. What I am really looking
for is a good tutorial on just namespaces and how they work. Any
suggestions?

Jan 7 '07 #1
7 9122
ca******@gmail.com wrote:
XML, Schemas, and XSLT has been part of my life for a number of years
now, but I have always used it in desktop application where I simply
make the noNamespaceSchemaLocation attribute the name of the schema
because it is going to reside in the same location as the xml file.

I am now working on a project that is a bit more complex. Again part
is a desktop application which will not have access to the Internet all
the time, but another part of the project does have access to the
Internet. It is my understanding that within the XML, it is possible
to provide a URL as the namespace name.
It's the other way around: a namespace name MUST be a URI. The URI
syntax allows for interpretation as a local filename, either relative to
the current location or absolute to your local hard disk, or as a
network resource (starting with http://, ftp://, etc)...however, the use
of local names is deprecated in namespaces.

I'm afraid noNamespaceSchemaLocation is just an unpleasant kludge: the
Namespaces Spec says "It is not a goal that it [the namespace name] be
directly usable for retrieval of a schema (if any exists)."
How exactly do I go about setting up the XML so that when it is
validated on the desktop application, I can simply provide the schema
like I always have and then on the web it uses the URL as the source.
You need to ask your software manufacturer for any non-standard feature
they may have provided. It's also a bit risky. What happens if the local
copy and the network copy go out of sync?

It's a great pity Schemas were not implemented using the DOCTYPE
declaration like DTDs, then we would have had PUBLIC and SYSTEM catalog
resolution at our disposal. Unfortunately this would have entailed
another TC to ISO 8879 and another tedious decade teaching developers
how to do catalog resolution properly.

///Peter
--
XML FAQ: http://xml.silmaril.ie/
Jan 7 '07 #2

Peter Flynn wrote:
ca******@gmail.com wrote:
XML, Schemas, and XSLT has been part of my life for a number of years
now, but I have always used it in desktop application where I simply
make the noNamespaceSchemaLocation attribute the name of the schema
because it is going to reside in the same location as the xml file.

I am now working on a project that is a bit more complex. Again part
is a desktop application which will not have access to the Internet all
the time, but another part of the project does have access to the
Internet. It is my understanding that within the XML, it is possible
to provide a URL as the namespace name.

It's the other way around: a namespace name MUST be a URI. The URI
syntax allows for interpretation as a local filename, either relative to
the current location or absolute to your local hard disk, or as a
network resource (starting with http://, ftp://, etc)...however, the use
of local names is deprecated in namespaces.

I'm afraid noNamespaceSchemaLocation is just an unpleasant kludge: the
Namespaces Spec says "It is not a goal that it [the namespace name] be
directly usable for retrieval of a schema (if any exists)."
Peter,

First off, thank you for your help! I am guessing here, but my
impression is thta things work this way:

Xml with a namespace of: urn:/cartoper/schema1
actual schema name: MyFirstSchema.xsd

When loading MyFirstSchema.xsd into the validator, there will be a way
to tell the validator that it's namespace is urn:/cartoper/schema1.

Or is it that I have to place the urn:/cartoper/schema1 in the schema,
too?

Jan 7 '07 #3
ca******@gmail.com wrote:
Xml with a namespace of: urn:/cartoper/schema1
actual schema name: MyFirstSchema.xsd

When loading MyFirstSchema.xsd into the validator, there will be a way
to tell the validator that it's namespace is urn:/cartoper/schema1.

Or is it that I have to place the urn:/cartoper/schema1 in the schema,
too?
If you want to author a schema defining elements in that namespace then
use targetNamespace="urn:/cartoper/schema1" e.g.

<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:/cartoper/schema1"
elementFormDefault="qualified">
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 7 '07 #4

Martin Honnen wrote:
ca******@gmail.com wrote:
Xml with a namespace of: urn:/cartoper/schema1
actual schema name: MyFirstSchema.xsd
If you want to author a schema defining elements in that namespace then
use targetNamespace="urn:/cartoper/schema1" e.g.

<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:/cartoper/schema1"
elementFormDefault="qualified">
Martin,

Ok, that makes perfect sense, after doing some digging;) The final
questions is: What exactly do I put in the XML? I am using XMLSpy as
my editor. When I assign the schema to the xml file, it generates this
attributes to the root element:

xmlns="urn:/cartoper/schema1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:/cartoper/schema1 D:\<full
path>\MyFirstSchema.xsd"

When I removed the full path from the xsi:schemaLocation attribute
(xsi:schemaLocation="urn:/cartoper/schema1 MyFirstSchema.xsd"), XmlSpy
complains that it is not valid. Do I simply need to leave off the
xsi:schemaLocation? Or is there some way I can still have the xml
point to the schema being in the same directory? I sort of like how
XMLSpy will validate the XML for me, I use it mostly in development.

Jan 7 '07 #5
Anyone?

ca******@gmail.com wrote:
Martin Honnen wrote:
ca******@gmail.com wrote:
Xml with a namespace of: urn:/cartoper/schema1
actual schema name: MyFirstSchema.xsd
If you want to author a schema defining elements in that namespace then
use targetNamespace="urn:/cartoper/schema1" e.g.

<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:/cartoper/schema1"
elementFormDefault="qualified">

Martin,

Ok, that makes perfect sense, after doing some digging;) The final
questions is: What exactly do I put in the XML? I am using XMLSpy as
my editor. When I assign the schema to the xml file, it generates this
attributes to the root element:

xmlns="urn:/cartoper/schema1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:/cartoper/schema1 D:\<full
path>\MyFirstSchema.xsd"

When I removed the full path from the xsi:schemaLocation attribute
(xsi:schemaLocation="urn:/cartoper/schema1 MyFirstSchema.xsd"), XmlSpy
complains that it is not valid. Do I simply need to leave off the
xsi:schemaLocation? Or is there some way I can still have the xml
point to the schema being in the same directory? I sort of like how
XMLSpy will validate the XML for me, I use it mostly in development.
Jan 8 '07 #6
ca******@gmail.com wrote:
Anyone?
>Ok, that makes perfect sense, after doing some digging;) The final
questions is: What exactly do I put in the XML? I am using XMLSpy as
my editor.
You might want to ask XMLSpy specific questions in an XMLSpy user forum
as there you have a better chance to find other users of that software
than in a generic comp.text.xml group.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 8 '07 #7

Martin Honnen wrote:
ca******@gmail.com wrote:
Anyone?
Ok, that makes perfect sense, after doing some digging;) The final
questions is: What exactly do I put in the XML? I am using XMLSpy as
my editor.

You might want to ask XMLSpy specific questions in an XMLSpy user forum
as there you have a better chance to find other users of that software
than in a generic comp.text.xml group.
Martin,

I would agree with you, except, I am trying to understand how exactly
namespaces, schemas, and xml are all tied together, I am assuming the
XMLSpy will comply with the way things are, which is not always the
case;)

Peter's inital reply implies that it is a bad thing to use the
xsi:schemaLocation attribute. Am I correct? Is there any way of
denoting in the xsi:schemaLocation that the schema file is in the same
folder/directory as the XML?

Jan 8 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Tjerk Wolterink | last post by:
Who can learn me the difference between the these two attributes: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation and xsi:noNamespaceSchemaLocation
0
by: jr | last post by:
Hello, I have got a schema file "myschema.xsd" from my customer for which I must create xml files. I used xsd.exe to create a class for the schema. I fill an object for that class with data...
1
by: Balaji V | last post by:
Hi, I am creating C# calsses to seralize and deserialize based on xsd. When defining the classes to do seralization i need to specify the schema for the reference. Typically my class...
1
by: AP | last post by:
Hi, I'm getting the following error trying to validate an xml document against a schema: The 'xsi:noNameSpaceSchemaLocation' attribute is not declared My xml file looks like this: <?xml...
18
by: Simon | last post by:
Hi, I understand what one the differences between std::vector, std::deque and std::list is, the std::vector can have data inserted/deleted at the end. The std::deque can have data...
8
by: boki_pfc | last post by:
Hi Everybody, I am looking for an advice on following: I have that "pleasure" of reading C++ codes that have been written by person(s) that have not attended the same C++ classes that I did or...
2
by: subramanian100in | last post by:
Is my following understanding correct ? Data abstraction means providing the interface - that is, the set of functions that can be called by the user of a class. Information hiding means...
2
by: =?ISO-8859-1?Q?Jean=2DFran=E7ois_Michaud?= | last post by:
Hello guys, I was wondering if it was possible to disregard the xsi:noNamespaceSchemaLocation. For validation it's obviously easier to have it point to say a local directory but the final...
3
by: Samuel | last post by:
I use the following code to create the XML from a class object Dim serialize As New System.Xml.Serialization.XmlSerializer(GetType(XYZObject)) serialize.Serialize(obWtiter, obObject) But I...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.