473,231 Members | 2,013 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,231 software developers and data experts.

xmlns

hi all,
I pretty new to xml, what does xmlns mean?
like in:
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://purl.org/rss/1.0/"
xmlns:perljobs="http://jobs.perl.org/rss/"
xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:syn="http://purl.org/rss/1.0/modules/syndication/"
xmlns:admin="http://webns.net/mvcb/"

tia
--
http://www.kolumbus.fi/bob.smith
Aug 3 '05 #1
8 1885
Bob Smith wrote:
I pretty new to xml, what does xmlns mean?
like in:
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://purl.org/rss/1.0/"
xmlns:perljobs="http://jobs.perl.org/rss/"
xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:syn="http://purl.org/rss/1.0/modules/syndication/"
xmlns:admin="http://webns.net/mvcb/"


It maps a namespace prefix to the corresponding namespace URI. See
<http://www.w3.org/TR/REC-xml-names/>
--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
Aug 3 '05 #2
On Wed, 03 Aug 2005 19:23:37 +0200, Bob Smith <bo*******@marketweighton.com>
wrote:
hi all,
I pretty new to xml, what does xmlns mean?
like in:
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://purl.org/rss/1.0/"
xmlns:perljobs="http://jobs.perl.org/rss/"
xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:syn="http://purl.org/rss/1.0/modules/syndication/"
xmlns:admin="http://webns.net/mvcb/"

tia


Each xmlns... attribute means that, for the RDF element and any elements it
contains, those are the prefixes used to qualify specific namespaces of
elements (and attributes if required).

xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
means that any element prefixed with rdf: (including the rdf:RDF element
belongs to the namespace http://www.w3.org/1999/02/22-rdf-syntax-ns#.

xmlns="http://purl.org/rss/1.0/"
means that any element with no prefix at all belongs to the
http://purl.org/rss/1.0/ namespace.
Aug 4 '05 #3
Steve Jorgensen wrote:
On Wed, 03 Aug 2005 19:23:37 +0200, Bob Smith
<bo*******@marketweighton.com> wrote:
hi all,
I pretty new to xml, what does xmlns mean?
like in:
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://purl.org/rss/1.0/"
xmlns:perljobs="http://jobs.perl.org/rss/"
xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:syn="http://purl.org/rss/1.0/modules/syndication/"
xmlns:admin="http://webns.net/mvcb/"

tia


Each xmlns... attribute means that, for the RDF element and any elements
it contains, those are the prefixes used to qualify specific namespaces of
elements (and attributes if required).

xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
means that any element prefixed with rdf: (including the rdf:RDF element
belongs to the namespace http://www.w3.org/1999/02/22-rdf-syntax-ns#.

xmlns="http://purl.org/rss/1.0/"
means that any element with no prefix at all belongs to the
http://purl.org/rss/1.0/ namespace.

right, so what is the idea on the client side?
okey so we have namespaces, but what are they good for? Does the namespace
declare data types or only names?
--
http://www.kolumbus.fi/bob.smith
Aug 4 '05 #4
Bob Smith wrote:
hi all,
I pretty new to xml, what does xmlns mean?
like in:
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://purl.org/rss/1.0/"
xmlns:perljobs="http://jobs.perl.org/rss/"
xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:syn="http://purl.org/rss/1.0/modules/syndication/"
xmlns:admin="http://webns.net/mvcb/"

tia


xmlns is used to bound prefixes to namespace URIs

it means that the *universal name* of the <rdf:RDF> element is
[ http://www.w3.org/1999/02/22-rdf-syntax-ns# , RDF ]
this notation [ URI , local-name ] denotes that the *universal name* is
in 2 parts (in most XML papers, it is displayed with another notation :
{http://www.w3.org/1999/02/22-rdf-syntax-ns#}RDF but I prefer the
former) ; notice that these notations are only for explanation and NEVER
appear in real XML documents

such names are *universal names* because URIs are unique ; notice that
an URI is not necessary an URL :
xmlns:foo="urn:guid:88d969c9-f192-11d4-a65f-0040963251e6"
xmlns:book="urn:isbn:2-84177-230-6"
xmlns:office="urn:schemas-microsoft-com:office:office"
namespace URIs are just use to qualify XML names

the prefix is just an alias for the URI, but its mean is local to the
xmlns declaration (that is to say, applies on its host element and its
descendents)
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<foo:RDF xmlns:foo="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
are the same ; the last form doesn't use a prefix, it uses the default
namespace

attributes are told "owned" by their host elements, so they don't need
additional information ; that's why the default namespace doesn't apply
to attributes ; sometimes, it is necessary to "add" to an element
special purpose attributes, that are often called "foreign attributes" :
<image xmlns:xlink="http://www.w3.org/1999/xlink">
xlink:type="simple"
xlink:actuate="onLoad"
xlink:show="embed"
xlink:href="http://www.acme.com/foo/bar.jpg"
width="123"
height="234" />

some application may recognize a particular namespace URI :
-for example, an application might expose an hyperlink in conformance to
the XLink specification if it encounters attributes like those above
-an XSLT processor will do something special when it encounters
<xsl:template> not because the prefix is "xsl" but because this element
is in the scope of the xmlns declaration :
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-a graphic application that recognize SVG could draw a rectangle :
<svg:svg xmlns:svg "http://www.w3.org/2000/svg"
width="18cm" height="6cm" viewBox="0 0 200 120">
<svg:rect x="1" y="1" width="198" height="118"
fill="#888888" stroke="blue" />
</svg:svg>

if you have to design XML datas, I encourage you to use your own
namespace URI with your elements : thus, your application will be able
to process these elements without ambiguity ; XML namespaces have been
design for that purpose : distinguish elements that could have the same
local name, and grouping a set of names "related to the same feature"

--
Cordialement,

///
(. .)
-----ooO--(_)--Ooo-----
| Philippe Poulard |
-----------------------
Aug 4 '05 #5
"Bob Smith" <bo*******@marketweighton.com> wrote in message
news:dc**********@phys-news1.kolumbus.fi...
Steve Jorgensen wrote:
On Wed, 03 Aug 2005 19:23:37 +0200, Bob Smith
<bo*******@marketweighton.com> wrote:
hi all,
I pretty new to xml, what does xmlns mean?
like in:
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://purl.org/rss/1.0/"
xmlns:perljobs="http://jobs.perl.org/rss/"
xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:syn="http://purl.org/rss/1.0/modules/syndication/"
xmlns:admin="http://webns.net/mvcb/"

tia
Each xmlns... attribute means that, for the RDF element and any elements
it contains, those are the prefixes used to qualify specific namespaces of elements (and attributes if required).

xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
means that any element prefixed with rdf: (including the rdf:RDF element
belongs to the namespace http://www.w3.org/1999/02/22-rdf-syntax-ns#.

xmlns="http://purl.org/rss/1.0/"
means that any element with no prefix at all belongs to the
http://purl.org/rss/1.0/ namespace.

right, so what is the idea on the client side?
okey so we have namespaces, but what are they good for? Does the namespace
declare data types or only names?


Namespaces are used for creating globally unique names, using URIs in much
the same way as package names are used in Java. When a URI you control is
combined with a name, that combination is guaranteed to be unique. This
mechanism makes it possible to identify names from different XML
vocabularies, and to mix different vocabularies without conflicts between
names.

// Magnus
Aug 4 '05 #6
What a namespace really gives you is composition. You're using RSS
1.0, which is a powerful syndication protocol made from lots of little
sub-components plugged together by namespaces.

RSS 1.0 itself is small and easily learned. It knows about
"syndication", but no more.
Dublin Core knows about cataloguing metadata, so it understands
"Authors" and "Rights". By adding it to RSS 1.0, you can gain
properties that can represent a much deeper description of your content
than RSS' own trivial model, but you don't need to extend RSS itself.

In contrast there is RSS 2.0. This takes the opposite approach and
ignores namespacing. So every time it's realised that there's a useful
feature missing, the RSS 2.0 autocrat inventor adds yet another random
property to it. The 2.0 protocol is an ugly rag-bag of random rubbish
tacked onto it. It's big and bloated for most purposes, but it still
isn't as simply and elegantly extensible as the much simpler RSS 1.0.

In one sense there is nothing that RSS1.0 and namespaces can give you
that a well though-out RSS 2.1 could give you without namespaces. But
this hypothetical 2.1 version would be bigger, it would be more
specific to one subset of users' requirements, and it would not offer
the huge re-use potential that a smaller namespace like DC does.

On your next project you might be cataloguing a library of video clips.
You bump into Dublin Core again and you gain the advantage of _already_
knowing this namespace and how to use it - an advantage for you. Then
you add a syndication feed to this library and you choose to do it in
RSS 1.0 with DC. Now there's a synergy effect too - the project is
simpler and better because it's using the same representation
throughout. This has advantages for the finished project, as well as
for you.

RDF is also a useful part of this. RDF doesn't have an "application
area" like syndication, it's much more general. It isn't even a
"metadata protocol", as is sometimes claimed. All it adds is a
graph-like model of obejcts and properties, so that any application
understanding RDF but not (for instance) DC can still extract a useful
data model that "knows" there are entities called "Item", "Author" etc.
and that "phoneNumber" is a _property_ of an _entity_ called "Author"
(XML alone can't do this).

Aug 4 '05 #7
Philippe Poulard wrote:
Bob Smith wrote:
hi all,
I pretty new to xml, what does xmlns mean?
like in:
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://purl.org/rss/1.0/"
xmlns:perljobs="http://jobs.perl.org/rss/"
xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:syn="http://purl.org/rss/1.0/modules/syndication/"
xmlns:admin="http://webns.net/mvcb/"

tia


xmlns is used to bound prefixes to namespace URIs

it means that the *universal name* of the <rdf:RDF> element is
[ http://www.w3.org/1999/02/22-rdf-syntax-ns# , RDF ]
this notation [ URI , local-name ] denotes that the *universal name* is
in 2 parts (in most XML papers, it is displayed with another notation :
{http://www.w3.org/1999/02/22-rdf-syntax-ns#}RDF but I prefer the
former) ; notice that these notations are only for explanation and NEVER
appear in real XML documents

such names are *universal names* because URIs are unique ; notice that
an URI is not necessary an URL :
xmlns:foo="urn:guid:88d969c9-f192-11d4-a65f-0040963251e6"
xmlns:book="urn:isbn:2-84177-230-6"
xmlns:office="urn:schemas-microsoft-com:office:office"
namespace URIs are just use to qualify XML names

the prefix is just an alias for the URI, but its mean is local to the
xmlns declaration (that is to say, applies on its host element and its
descendents)
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<foo:RDF xmlns:foo="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
are the same ; the last form doesn't use a prefix, it uses the default
namespace

attributes are told "owned" by their host elements, so they don't need
additional information ; that's why the default namespace doesn't apply
to attributes ; sometimes, it is necessary to "add" to an element
special purpose attributes, that are often called "foreign attributes" :
<image xmlns:xlink="http://www.w3.org/1999/xlink">
xlink:type="simple"
xlink:actuate="onLoad"
xlink:show="embed"
xlink:href="http://www.acme.com/foo/bar.jpg"
width="123"
height="234" />

some application may recognize a particular namespace URI :
-for example, an application might expose an hyperlink in conformance to
the XLink specification if it encounters attributes like those above
-an XSLT processor will do something special when it encounters
<xsl:template> not because the prefix is "xsl" but because this element
is in the scope of the xmlns declaration :
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-a graphic application that recognize SVG could draw a rectangle :
<svg:svg xmlns:svg "http://www.w3.org/2000/svg"
width="18cm" height="6cm" viewBox="0 0 200 120">
<svg:rect x="1" y="1" width="198" height="118"
fill="#888888" stroke="blue" />
</svg:svg>

if you have to design XML datas, I encourage you to use your own
namespace URI with your elements : thus, your application will be able
to process these elements without ambiguity ; XML namespaces have been
design for that purpose : distinguish elements that could have the same
local name, and grouping a set of names "related to the same feature"

T H A N K ... Y O U !!!!!!!!!!!!!
:-)
--
http://www.kolumbus.fi/bob.smith
Aug 4 '05 #8
di*****@codesmiths.com wrote:
What a namespace really gives you is composition. You're using RSS
1.0, which is a powerful syndication protocol made from lots of little
sub-components plugged together by namespaces.

RSS 1.0 itself is small and easily learned. It knows about
"syndication", but no more.
Dublin Core knows about cataloguing metadata, so it understands
"Authors" and "Rights". By adding it to RSS 1.0, you can gain
properties that can represent a much deeper description of your content
than RSS' own trivial model, but you don't need to extend RSS itself.

In contrast there is RSS 2.0. This takes the opposite approach and
ignores namespacing. So every time it's realised that there's a useful
feature missing, the RSS 2.0 autocrat inventor adds yet another random
property to it. The 2.0 protocol is an ugly rag-bag of random rubbish
tacked onto it. It's big and bloated for most purposes, but it still
isn't as simply and elegantly extensible as the much simpler RSS 1.0.

In one sense there is nothing that RSS1.0 and namespaces can give you
that a well though-out RSS 2.1 could give you without namespaces. But
this hypothetical 2.1 version would be bigger, it would be more
specific to one subset of users' requirements, and it would not offer
the huge re-use potential that a smaller namespace like DC does.

On your next project you might be cataloguing a library of video clips.
You bump into Dublin Core again and you gain the advantage of _already_
knowing this namespace and how to use it - an advantage for you. Then
you add a syndication feed to this library and you choose to do it in
RSS 1.0 with DC. Now there's a synergy effect too - the project is
simpler and better because it's using the same representation
throughout. This has advantages for the finished project, as well as
for you.

RDF is also a useful part of this. RDF doesn't have an "application
area" like syndication, it's much more general. It isn't even a
"metadata protocol", as is sometimes claimed. All it adds is a
graph-like model of obejcts and properties, so that any application
understanding RDF but not (for instance) DC can still extract a useful
data model that "knows" there are entities called "Item", "Author" etc.
and that "phoneNumber" is a _property_ of an _entity_ called "Author"
(XML alone can't do this).

THANKS A WHOLE BUNCH...:-)

--
http://www.kolumbus.fi/bob.smith
Aug 4 '05 #9

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

Similar topics

1
by: Chris Bedford | last post by:
Hi: this question has been driving me crazy. would be grateful for any help. I am writing a version of the identity transformation to filter some documents (they happen to be wsdl docs)....
3
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"...
1
by: jorgen.wahlund | last post by:
Hi I have problems with transforming a xml document with Xalan and javax.xml.Transformer. Following xsl is used: <xsl:stylesheet version='1.0'...
0
by: chris.stromberger | last post by:
New to SOAP. I am working on something that uses the paypal web services. All the examples have this as the first portion of the soap doc <?xml version="1.0" encoding="UTF-8"?>...
4
by: David S. Alexander | last post by:
I am trying to transform XML to XML using an XSLT in C#, but the root node of my XML is not being matched by the XSLT if it has an xmlns attribute. Am I handling my namespaces incorrectly? My C#...
3
by: dhurwitz | last post by:
I am trying to create an XML spreadsheet for use with Excel. I first saved a simple spreadsheet as an XML file, and now I am trying to recreate that file in code, using .NET 2.0. The beginning of...
0
by: jts2077 | last post by:
I am trying to create a large nested XML object using E4X methods. The problem is the, the XML I am trying to create can only have xmlns set at the top 2 element levels. Such as: <store ...
2
by: CI | last post by:
I have the following XML file: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/ main"...
1
by: nwbabcock | last post by:
I'm using XmlSerializer to deserialize an xml into classes. The error I recieve is: Exception:There is an error in XML document (2, 2). Inner Exception: <applications...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
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...
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, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.