473,513 Members | 2,583 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XML Namespace question

How do I create an XML namespace?

Say I have one defined in my root element: xmlns:namespacename="http://
theurigoeshere.com/xmlnamespace"
How do I get that http://theurigoeshere.com/xmlnamespace to resolve
like this one does: http://purl.org/dc/elements/1.1/
I know there is a way that the uri will return the actual name of the
namespace, but how?
Jan 7 '08 #1
5 1666
bfrederi wrote:
How do I create an XML namespace?

Say I have one defined in my root element: xmlns:namespacename="http://
theurigoeshere.com/xmlnamespace"
How do I get that http://theurigoeshere.com/xmlnamespace to resolve
like this one does: http://purl.org/dc/elements/1.1/
I know there is a way that the uri will return the actual name of the
namespace, but how?
I am not sure what you are asking about. URI used for namespace do not
need to point to an actual resource. URIs are simply used to have unique
names. In the example
<pf:root xmlns:pf="http://example.com/2008/ns1">
the namespace name is http://example.com/2008/ns1 and pf is a prefix
bound to that name.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 7 '08 #2
In article <5b**********************************@s12g2000prg. googlegroups.com>,
bfrederi <br**********@gmail.comwrote:
>How do I create an XML namespace?
That deends what you mean by "create".
>Say I have one defined in my root element: xmlns:namespacename="http://
theurigoeshere.com/xmlnamespace"
How do I get that http://theurigoeshere.com/xmlnamespace to resolve
like this one does: http://purl.org/dc/elements/1.1/
You put something on the webserver for the URI in question.

But you don't usually have to do this to use a namespace. For
example, a schema validator may try to open the URI to find a schema,
but there will be an alternative way to provide the schema directly.
>I know there is a way that the uri will return the actual name of the
namespace, but how?
I don't understand this question. The URI *is* the name of the
namespace.

-- Richard
--
:wq
Jan 7 '08 #3
On 7 Jan, 16:51, bfrederi <brfrederi...@gmail.comwrote:
How do I create an XML namespace?
An XML namespace identifier is basically a string. However, by
convention it is done in the form of an HTTP URI (http://...). Even
if you make it an HTTP URI though, that doesn't mean that the URI has
to resolve to a real web page!
Say I have one defined in my root element: xmlns:namespacename="http://
theurigoeshere.com/xmlnamespace"
How do I get that http://theurigoeshere.com/xmlnamespace to resolve
like this one does: http://purl.org/dc/elements/1.1/
I know there is a way that the uri will return the actual name of the
namespace, but how?
Just put up a web page and serve what ever you think's appropriate in
the normal way - or not as the case may be!

HTH,

Pete Cordell
Codalogic
Visit http://www.codalogic.com/lmx/ for XML C++ data binding
Jan 7 '08 #4
I guess I should be more specific in what I am doing. I am using
ElementTree in python, and when I add the dublin core namespace
"http://purl.org/dc/elements/1.1/" to my elements when creating my
XML, it automatically knows that the uri "http://purl.org/dc/elements/
1.1/" is supposed to be known as "dc". So it automatically add this to
my root element: xmlns:dc="http://purl.org/dc/elements/1.1/" and to
all the of elements I have attached the uri "http://purl.org/dc/
elements/1.1/" to, it puts a "dc:element" for the element name. So
somehow the uri is able to resolve to an alias of "dc". How do I
create my own uri that will resolve as such? Do I need to create some
sort of reference file that does something of the effect of namespace
= "http://www.example.com/namespace/" or is it an apache setting, etc?
Jan 7 '08 #5
The prefix chosen doesn't matter. If the tool has promised it will take
care of this, it's the tool's responsibility (more accurately, the XML
Serializer's responsibility) to either generate or select an appropriate
prefix and bind it correctly, or to use default namespaces, or both,
when it writes out the XML. The DOM Level 3 spec describes one way this
can be done, but the precise algorithm doesn't matter as long as
everything winds up bound to the right namespace URI.

I haven't used that Python tool, so I don't know what approach it's
using. Check with whoever authored that tool?
--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Jan 7 '08 #6

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

Similar topics

1
2703
by: John L. Clark | last post by:
I am curious as to the rationale, and effect, of having default namespaces not applying (directly) to attributes (see http://www.w3.org/TR/REC-xml-names/#defaulting). Given an attribute without a...
25
3046
by: kj | last post by:
Consider the following XML document: <?xml version='1.0' encoding='UTF-8'?> <bar:foo xmlns:bar='someuri'> <baz/> </bar:foo> What namespace does baz belong to? What is this namespace bound...
3
10016
by: Mike Dickens | last post by:
hi, i'm sure this has come up before but havn't managed to find an answer. if i have the following xslt <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet method="xml" version="1.0"...
6
555
by: clinton__bill | last post by:
Hi, I usually use "using namespace <namespace_name>" to reference a namespace. Today I run across a code, in its header file it has this, namespace SP1{ class C1; } While SP1::C1 is a...
2
7500
by: Tony Johansson | last post by:
Hello! I'm reading a book about C++ and there is something that I don't understand so I ask you. Below I have the text from the book and the code from the file where main is located and some...
20
3834
by: Patrick Guio | last post by:
Dear all, I have some problem with insertion operator together with namespace. I have a header file foo.h containing declaration of classes, typedefs and insertion operators for the typedefs in...
4
4386
by: Programatix | last post by:
Hi, Normally, I would use Namespace for all the window forms I created. With VS 2005, the code generated by the designer is hidden using partial keyword. The question is, is there an efficient...
32
30459
by: toolmaster | last post by:
Since many of the modern computer languages have built-in namespace features, I can't understand why not add this feature into standard C. I've heard many people complain of the lacking of...
3
2265
by: CrazyJohn | last post by:
Hi guys, This is my first time posting question here, if I break any rules, please kindly point out. And I'm really glad to be a part of this community. Here is my question, Our lecturer...
17
30572
by: Peng Yu | last post by:
Hi, I'm wondering if there is something in namespace like the 'private' keyword in class? I want to define some class or function that can only be used within that namespace. Thanks, Peng
0
7260
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7160
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...
0
7384
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
5685
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,...
1
5086
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...
0
3233
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1594
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 ...
1
799
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
456
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...

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.