473,663 Members | 2,838 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

understanding noNamespaceSche maLocation

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 noNamespaceSche maLocation 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 9164
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 noNamespaceSche maLocation 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 noNamespaceSche maLocation 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 noNamespaceSche maLocation 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 noNamespaceSche maLocation 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.x sd

When loading MyFirstSchema.x sd 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.x sd

When loading MyFirstSchema.x sd 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"
elementFormDefa ult="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.x sd
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"
elementFormDefa ult="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:schemaLocat ion="urn:/cartoper/schema1 D:\<full
path>\MyFirstSc hema.xsd"

When I removed the full path from the xsi:schemaLocat ion attribute
(xsi:schemaLoca tion="urn:/cartoper/schema1 MyFirstSchema.x sd"), XmlSpy
complains that it is not valid. Do I simply need to leave off the
xsi:schemaLocat ion? 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.x sd
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"
elementFormDefa ult="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:schemaLocat ion="urn:/cartoper/schema1 D:\<full
path>\MyFirstSc hema.xsd"

When I removed the full path from the xsi:schemaLocat ion attribute
(xsi:schemaLoca tion="urn:/cartoper/schema1 MyFirstSchema.x sd"), XmlSpy
complains that it is not valid. Do I simply need to leave off the
xsi:schemaLocat ion? 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:schemaLocat ion attribute. Am I correct? Is there any way of
denoting in the xsi:schemaLocat ion 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
2316
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
4539
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 and serialize it. My customer gave me an example xml file, how it should look like, and it begins with <?xml version="1.0" encoding="UTF-8"?>
1
7808
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 definition looks like this : public class MyClass
1
7784
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 version="1.0" encoding="utf-8"?> <TitleNotification xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" d1p1:noNameSpaceSchemaLocation="http://www.pdr.com&#xA;https://extw3c.pdr.co...
18
2191
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 inserted/deleted at the end and at beginning and the std::list can have data inserted/deleted anywhere. But how can those differences be physically understood?
8
1816
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 have not read the same C++ books that I have read. This kind of people has written some parts of the code that use notations that I am not familiar with (and that probably also includes also 50 % of other C ++ programmers). While everybody who...
2
7628
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 mentioning the class members(functions, typedefs, data) under the access control labels : public, protected, private. Encapsulation means providing the implementation of class member
2
2467
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 xsi:noNamespaceSchemaLocation has to point to a specific location that is not local. I was wondering if it was possible to make sure that the xsi:noNamespaceSchemaLocation points to the non local location, force the parser to disregard the...
3
5406
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 need the following ' xsi:noNamespaceSchemaLocation="obj-envelope.xsd"' to be included in the in the main opening tag
0
8345
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8548
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8634
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7371
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6186
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5657
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2763
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2000
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1757
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.