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

Reply via email to