jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r498220 - in /jackrabbit/trunk/contrib/jackrabbit-spi-xml/src/main/java/org/apache/jackrabbit/spi/xml: XMLNodeId.java XMLNodeIdIterator.java
Date Sun, 21 Jan 2007 00:52:31 GMT
Author: jukka
Date: Sat Jan 20 16:52:31 2007
New Revision: 498220

URL: http://svn.apache.org/viewvc?view=rev&rev=498220
Log:
contrib/jackrabbit-spi-xml: Ignore text elements (etc.) for now.

Removed:
    jackrabbit/trunk/contrib/jackrabbit-spi-xml/src/main/java/org/apache/jackrabbit/spi/xml/XMLNodeIdIterator.java
Modified:
    jackrabbit/trunk/contrib/jackrabbit-spi-xml/src/main/java/org/apache/jackrabbit/spi/xml/XMLNodeId.java

Modified: jackrabbit/trunk/contrib/jackrabbit-spi-xml/src/main/java/org/apache/jackrabbit/spi/xml/XMLNodeId.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-spi-xml/src/main/java/org/apache/jackrabbit/spi/xml/XMLNodeId.java?view=diff&rev=498220&r1=498219&r2=498220
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-spi-xml/src/main/java/org/apache/jackrabbit/spi/xml/XMLNodeId.java
(original)
+++ jackrabbit/trunk/contrib/jackrabbit-spi-xml/src/main/java/org/apache/jackrabbit/spi/xml/XMLNodeId.java
Sat Jan 20 16:52:31 2007
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.spi.xml;
 
+import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Iterator;
 
 import org.apache.jackrabbit.name.MalformedPathException;
@@ -52,7 +54,15 @@
     }
 
     public Iterator getChildInfos() {
-        return new XMLNodeIdIterator(node.getChildNodes());
+        Collection infos = new ArrayList();
+        NodeList nodes = node.getChildNodes();
+        for (int i = 0; i < nodes.getLength(); i++) {
+            Node child = nodes.item(i);
+            if (child.getNodeType() == Node.ELEMENT_NODE) {
+                infos.add(new XMLNodeId(child));
+            }
+        }
+        return infos.iterator();
     }
 
     public XMLNodeId getNodeId(Path path) {
@@ -75,7 +85,8 @@
                 NodeList nodes = current.getChildNodes();
                 for (int j = 0; index > 0 && j < nodes.getLength(); j++) {
                     Node child = nodes.item(j);
-                    if (name.equals(new XMLNodeId(child).getName())) {
+                    if (child.getNodeType() == Node.ELEMENT_NODE
+                            && name.equals(new XMLNodeId(child).getName())) {
                         if (--index == 0) {
                             current = child;
                         }
@@ -152,10 +163,11 @@
             NodeList nodes = parent.getChildNodes();
             for (int i = 0; i < nodes.getLength(); i++) {
                 Node current = nodes.item(i);
-                if (current == node) {
-                    index = i + 1;
-                } else if (node.getNamespaceURI().equals(current.getNamespaceURI())
-                        && node.getLocalName().equals(current.getLocalName())) {
+                if (current.getNodeType() != Node.ELEMENT_NODE) {
+                    // skip
+                } else if (current == node) {
+                    index = count + 1;
+                } else if (getName().equals(new XMLNodeId(current).getName())) {
                     count++;
                 }
             }



Mime
View raw message