You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2004/04/26 10:36:00 UTC

cvs commit: cocoon-lenya/src/java/org/apache/lenya/xml DocumentHelper.java

andreas     2004/04/26 01:36:00

  Modified:    src/java/org/apache/lenya/xml DocumentHelper.java
  Log:
  added getChildren(Element) without namespace check
  
  Revision  Changes    Path
  1.26      +19 -1     cocoon-lenya/src/java/org/apache/lenya/xml/DocumentHelper.java
  
  Index: DocumentHelper.java
  ===================================================================
  RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/xml/DocumentHelper.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- DocumentHelper.java	1 Mar 2004 16:18:23 -0000	1.25
  +++ DocumentHelper.java	26 Apr 2004 08:35:59 -0000	1.26
  @@ -276,6 +276,24 @@
       }
   
       /**
  +     * Returns all child elements of an element, regardless of the namespace.
  +     * @param element The parent element.
  +     * @return The child elements.
  +     */
  +    public static Element[] getChildren(Element element) {
  +        List childElements = new ArrayList();
  +        NodeList children = element.getElementsByTagName("*");
  +
  +        for (int i = 0; i < children.getLength(); i++) {
  +            if (children.item(i).getParentNode() == element) {
  +                childElements.add(children.item(i));
  +            }
  +        }
  +
  +        return (Element[]) childElements.toArray(new Element[childElements.size()]);
  +    }
  +
  +    /**
        * Returns all child elements of an element that belong to a certain namespace.
        * 
        * @param element The parent element.
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-cvs-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-cvs-help@cocoon.apache.org