From: "Volkmann, Mark" Date: 2002-09-28T00:18:28+09:00 Subject: RE: REXML namespace support This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C26639.1B8957F0 Content-Type: text/plain; charset="iso-8859-1" In my case I'm given a string which is a namespace prefix and I want to determine the namespace it is associated with. I don't have an Element object so I can't use the namespace method. > -----Original Message----- > From: Kouhei Sutou [mailto:kou@cneti.net] > Sent: Friday, September 27, 2002 9:33 AM > To: ruby-talk@ruby-lang.org > Subject: Re: REXML namespace support > > From: "Volkmann, Mark" > Subject: REXML namespace support > Date: Fri, 27 Sep 2002 22:45:45 +0900 > Message-ID: > <89539780CB9BD51182270002A5897DF602C6D670@hqempn04.agedwards.com> > > > Is there an easy way in REXML to get the namespace that is > associated with a > > given prefix? > > You can use REXML::Element#namespace if you are using a-la DOM API. > > ----------Example----------------- > require 'rexml/document' > > xml = < > > > > > > > XML > > doc = REXML::Document.new(xml) > > p doc.root.namespace("fuga") > p doc.elements["/a/b"].namespace("fuga") > p doc.elements["/a/b/c"].namespace("fuga") > p doc.elements["/a/d"].namespace("fuga") > ----------Example----------------- > > ----------Output------------------ > "foo" > "foo" > "hoge" > "bar" > ----------Output------------------ *********************************************************************************** WARNING: All e-mail sent to and from this address will be received or otherwise recorded by the A.G. Edwards corporate e-mail system and is subject to archival, monitoring or review by, and/or disclosure to, someone other than the recipient. ************************************************************************************ ------_=_NextPart_001_01C26639.1B8957F0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable RE: REXML namespace support

In my case I'm given a string which is a namespace prefix= and I want to determine the namespace it is associated with.  I don't= have an Element object so I can't use the namespace method.

> -----Original Message-----
> From: Kouhei Sutou [mailto:kou@cneti.net]
> Sent: Friday, September 27, 2002 9:33 AM
> To: ruby-talk@ruby-lang.org
> Subject: Re: REXML namespace support
>
> From: "Volkmann, Mark" <Mark.Volkmann@= AGEDWARDS.com>
> Subject: REXML namespace support
> Date: Fri, 27 Sep 2002 22:45:45 +0900
> Message-ID:
> <89539780CB9BD51182270002A5897DF602C6D670@hqempn= 04.agedwards.com>
>
> > Is there an easy way in REXML to get the names= pace that is
> associated with a
> > given prefix?
>
> You can use REXML::Element#namespace if you are usi= ng a-la DOM API.
>
> ----------Example-----------------
> require 'rexml/document'
>
> xml =3D <<XML
> <?xml version=3D'1.0'?>
> <a xmlns:fuga=3D'foo'>
>  <b>
>   <c xmlns:fuga=3D'hoge'/>
>  </b>
>  <d xmlns:fuga=3D'bar'/>
> </a>
> XML
>
> doc =3D REXML::Document.new(xml)
>
> p doc.root.namespace("fuga")
> p doc.elements["/a/b"].namespace("fu= ga")
> p doc.elements["/a/b/c"].namespace("= fuga")
> p doc.elements["/a/d"].namespace("fu= ga")
> ----------Example-----------------
>
> ----------Output------------------
> "foo"
> "foo"
> "hoge"
> "bar"
> ----------Output------------------



***************************************************************************= ********
WARNING: All e-mail sent to and from this address will be received or
otherwise recorded by the A.G. Edwards corporate e-mail system and is
subject to archival, monitoring or review by, and/or disclosure to,
someone other than the recipient.
***************************************************************************= *********
------_=_NextPart_001_01C26639.1B8957F0--