You could try use the dom4j API as follows

Element root = Document.getRootElement();
Element foo = root.element( "foo" );

or to navigate the document to find all <foo> elements you could use XPath

List foos = root.selectNodes( "//foo" );

James
----- Original Message -----
From: "Amber, Zhao Yuan Yuan" <[EMAIL PROTECTED]>
To: "bob mcwhirter" <[EMAIL PROTECTED]>; "Silvain Piree" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, March 14, 2002 7:05 AM
Subject: RE: [dom4j-user] question about getElementsByTagName


> Hi,
>
> I want to get an element by TagName using:
>
> DOMElement.getElementsByTagName(String name)
>
> my problem is:  if I use
>
> Element root = Document.getRootElement();
>
> I can only cast root to "DefaulElement",
> not "DomElement"(casting exception because "DefaultElement" is the default
> implementantion of Element in dom4j)
>
> because of this, I can not use root.getElementsByTagName("...");
>
>
> Can anyone tell me how to solve the problem?
>
>
> thanks,
> Amber
>
>
> _______________________________________________
> dom4j-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/dom4j-user


_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to