You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Brian Deep <bd...@cc-sw.com> on 2004/10/06 16:11:13 UTC

Getting an attribute name and value

Hi,

I am trying to figure out how to obtain both an attribute's name and value for a
given node.  I obtain an XmlObject returned from an XPath query for the node.
Once I have this node, I need to return a list of all attribute names and values
for that node.  The value is the easy part, but how do I get the attribute's
name?

XmlObject[] table = doc.selectPath(strNS + "$this//" + name);

Given table[0], how can I list all of the attributes associated with it?

Thanks,
-- Brian



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


RE: Getting an attribute name and value

Posted by Pau Ortega <pa...@doyma.es>.
Hi Brian,

I think the easiest way is XmlCursor. Just use it against the node,
and you can get both name and value of every part of the node.
I only can refer you to the javadocs, because I haven't used this
class yet.

> -----Mensaje original-----
> De: Brian Deep [mailto:bdeep@cc-sw.com] 
> Enviado el: miƩrcoles, 06 de octubre de 2004 16:11
> Para: user@xmlbeans.apache.org
> Asunto: Getting an attribute name and value
> 
> 
> Hi,
> 
> I am trying to figure out how to obtain both an attribute's 
> name and value for a given node.  I obtain an XmlObject 
> returned from an XPath query for the node. Once I have this 
> node, I need to return a list of all attribute names and 
> values for that node.  The value is the easy part, but how do 
> I get the attribute's name?
> 
> XmlObject[] table = doc.selectPath(strNS + "$this//" + name);
> 
> Given table[0], how can I list all of the attributes 
> associated with it?
> 
> Thanks,
> -- Brian
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org