You are viewing a plain text version of this content. The canonical link for it is here.
Posted to alexandria-dev@jakarta.apache.org by ru...@apache.org on 2002/01/04 21:24:25 UTC
cvs commit: jakarta-alexandria/proposal/gump/java Jenny.java
rubys 02/01/04 12:24:25
Modified: proposal/gump/java Jenny.java
Log:
Ensure workspace trumps profile
Revision Changes Path
1.8 +18 -12 jakarta-alexandria/proposal/gump/java/Jenny.java
Index: Jenny.java
===================================================================
RCS file: /home/cvs/jakarta-alexandria/proposal/gump/java/Jenny.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Jenny.java 2 Jan 2002 19:12:58 -0000 1.7
+++ Jenny.java 4 Jan 2002 20:24:25 -0000 1.8
@@ -84,7 +84,7 @@
* Expand hrefs in place, recursively.
* @param node source element
*/
- private void expand(Element node) throws Exception {
+ private Element expand(Element node) throws Exception {
// expand hrefs
Attr href = node.getAttributeNode("href");
if (href != null && !node.getNodeName().equals("url")) {
@@ -106,24 +106,30 @@
Element copy=(Element)doc.importNode(sub.getFirstChild(), true);
moveChildren(node, copy);
- Element parent = (Element)node.getParentNode();
- if (node.getNodeName().equals("profile")) {
- copy.removeAttribute("defined-in");
- moveChildren(copy, parent);
- } else {
- parent.replaceChild(copy,node);
+ node.getParentNode().replaceChild(copy,node);
+ node = copy;
+ }
+
+ // move all profile information to the front
+ Node first = node.getFirstChild();
+ for (Node child=first; child!=null; child=child.getNextSibling()) {
+ if (child.getNodeName().equals("profile")) {
+ child = expand((Element)child);
+ while (child.getFirstChild() != null) {
+ node.insertBefore(child.getFirstChild(), first);
+ }
}
}
// recurse through the children
- Node child=node.getFirstChild();
- while (child != null) {
- Node next=child.getNextSibling();
+ first = node.getFirstChild();
+ for (Node child=first; child != null; child=child.getNextSibling()) {
if (child.getNodeType()==Node.ELEMENT_NODE) {
- expand((Element)child);
+ child=expand((Element)child);
}
- child=next;
}
+
+ return node;
}
/**
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>