 |
 |
 |
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
|
 | 

|  |
These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.
|  |
| |
 |
 |
 |