[jdom-interest] Re: Very basic question about namespaces.

Bart Read bart at wdi.co.uk
Wed Apr 17 04:30:56 PDT 2002


Thanks very much.  That's great!
Bart


----- Original Message -----
From: "Elliotte Rusty Harold" <elharo at metalab.unc.edu>
To: "Bart Read" <bart at wdi.co.uk>; <jdom-interest at jdom.org>
Sent: Wednesday, April 17, 2002 11:40 AM
Subject: [jdom-interest] Re: Very basic question about namespaces.


> At 11:37 AM +0100 4/17/02, Bart Read wrote:
> >Hi All,
> >
> >
> >Just a quick query about namespaces.  Can't seem to find what I'm looking
> >for in any of my books or on the web but somebody here is bound to know.
> >
> >We're using JDOM b8 in a messaging application that is used to transfer
data
> >between various organisations.  I have an element like this:
> >
> ><spoxml:entity name="aaa">
> >      <spoxml:parameter>
> >       <spoxml:name>bbb</spoxml:name>
> >       <spoxml:value>ccc</spoxml:value>
> >      </spoxml:parameter>
> >     ...
> >     ...
> ></spoxml:entity>
> >
> >I want to extract the value of the 'name' attribute from the
'spoxml:entity'
> >element, so do I use
> >
> >public java.lang.String getAttributeValue(java.lang.String name)
> >
> >or
> >
> >public java.lang.String getAttributeValue(java.lang.String name,
> >                                           Namespace ns)
> >
> >to do it?
> >
>
> THe former.
>
> >Is the attribute included within the 'spoxml' namespace because its
parent
> >element is within this namespace, or is it in the default namespace (i.e.
> >would I need to call it 'spoxml:name' for it to be in the 'spoxml'
> >namespace)?
> >
>
> Unprefixed attributes are never in any namespace. This is a
> fundamental rule of namespaces in XML.
> --
>
> +-----------------------+------------------------+-------------------+
> | Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
> +-----------------------+------------------------+-------------------+
> |          The XML Bible, 2nd Edition (Hungry Minds, 2001)           |
> |             http://www.cafeconleche.org/books/bible2/              |
> |   http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/   |
> +----------------------------------+---------------------------------+
> |  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      |
> |  Read Cafe con Leche for XML News: http://www.cafeconleche.org/    |
> +----------------------------------+---------------------------------+
> _______________________________________________
> To control your jdom-interest membership:
>
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com
>
> ---------- Automatically inserted by WDI Mailserver ----------------
> This message has been scanned for virus, trojans, illegal relays and
> spam. If you have any comments, problems or questions please do not
> hesitate to contact:
> Abbotsbury Software Ltd
> Tel: +44 1305 871543 Fax: +44 1305 871688
> Email: postmaster at wdi.co.uk
> Web: http://www.wdi.co.uk/virus.phtml




More information about the jdom-interest mailing list