Thanks.  I got it to work using w3c.dom with the following code (in case
anyone interested)...

 private void processChildren(NodeList nList) {
   for (int i=0; i<nList.getLength(); i++) {
     // pass each node into traverse for processing
     _attrib_name = traverse(nList.item(i));
     String nodeStr = _attrib_name;
     Node node = nList.item(i);
     do {
      node = node.getParentNode();
      if (node!=null) {
       nodeStr = node.getNodeName()+"."+nodeStr;
      } // end if
     } while(node!=null);
System.out.println("node path = " + nodeStr);
    } // end for
 }


----- Original Message -----
From: "Joost Diepenmaat" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Friday, April 08, 2005 1:01 PM
Subject: Re: [Developers] fully-qualified xml fields


> On Fri, Apr 08, 2005 at 12:26:55PM +0200, Emile wrote:
> > I'm referring to the actual XML document, in particular the class names.
> >
> > Given the following example:
> >
> > <grandad name="gramps">
> >     <parents name="mom">
> >         <kids name="John">
> >             <attribute name="haircolour" value="blonde">
> >         </kids>
> >     </parents>
> >     <parents name="dad">
> >         <kids name="Jill">
> >             <attribute name="haircolour" value="brunette">
> >         </kids>
> >     </parents>
> > </grandad>
> >
> > I'm trying to list the attrributes as:
> > gramps.mom.John.haircolour = "blonde"
> >
> > Regards
> > Emile
> >
>
> that depends on the kind of parser you're using.
>
> pseudo-code for DOM level 1:
>
> value = node.getAttribute("haircolour");
> name = "haircolour";
> do {
>     node = node.parentNode;
>     name = node.getAttribute("name")+"."+name;
> } while (node);
>
>
> J.
>
>
> _______________________________________________
> Developers mailing list
> [email protected]
> http://lists.mmbase.org/mailman/listinfo/developers
>

_______________________________________________
Developers mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/developers

Reply via email to