You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mo...@apache.org on 2001/08/03 17:23:21 UTC
cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/dom DOMImpl.java UnionIterator.java
morten 01/08/03 08:23:21
Modified: java/src/org/apache/xalan/xsltc/compiler CopyOf.java
Step.java
java/src/org/apache/xalan/xsltc/dom DOMImpl.java
UnionIterator.java
Log:
Fix for union-iterators wrapping one or more attribute-iterators.
Attributes should be wrapped in TypedAttributeIterator objects and not
SingletonIterator objects when they occur insude unions.
Fix for copying attribute nodes using <xsl:copy> and <xsl:copy-of>
PR: bugzilla 2603
Obtained from: n/a
Submitted by: morten@xml.apache.org
Reviewed by: morten@xml.apache.org
Revision Changes Path
1.6 +1 -3 xml-xalan/java/src/org/apache/xalan/xsltc/compiler/CopyOf.java
Index: CopyOf.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/CopyOf.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- CopyOf.java 2001/06/17 12:23:27 1.5
+++ CopyOf.java 2001/08/03 15:23:21 1.6
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: CopyOf.java,v 1.5 2001/06/17 12:23:27 curcuru Exp $
+ * @(#)$Id: CopyOf.java,v 1.6 2001/08/03 15:23:21 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -110,8 +110,6 @@
final InstructionList il = methodGen.getInstructionList();
final String DOM_CLASS = classGen.getDOMClass();
final Type tselect = _select.getType();
-
-
if (tselect instanceof NodeSetType) {
il.append(methodGen.loadDOM());
1.8 +2 -1 xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Step.java
Index: Step.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Step.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Step.java 2001/08/01 11:52:58 1.7
+++ Step.java 2001/08/03 15:23:21 1.8
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: Step.java,v 1.7 2001/08/01 11:52:58 morten Exp $
+ * @(#)$Id: Step.java,v 1.8 2001/08/03 15:23:21 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -166,6 +166,7 @@
SyntaxTreeNode parent = getParent();
if ((parent instanceof ParentPattern) ||
(parent instanceof ParentLocationPath) ||
+ (parent instanceof UnionPathExpr) ||
(parent instanceof FilterParentPath))
return(true);
else
1.17 +21 -9 xml-xalan/java/src/org/apache/xalan/xsltc/dom/DOMImpl.java
Index: DOMImpl.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/DOMImpl.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- DOMImpl.java 2001/08/03 14:18:21 1.16
+++ DOMImpl.java 2001/08/03 15:23:21 1.17
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: DOMImpl.java,v 1.16 2001/08/03 14:18:21 morten Exp $
+ * @(#)$Id: DOMImpl.java,v 1.17 2001/08/03 15:23:21 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -2285,8 +2285,6 @@
int attr, child, col;
- if (node >= _treeNodeLimit) return;
-
switch(_type[node]) {
case ROOT:
for (child = _offsetOrChild[node];
@@ -2305,6 +2303,9 @@
_offsetOrChild[node],
_lengthOrAttr[node]);
break;
+ case ATTRIBUTE:
+ shallowCopy(node, handler);
+ break;
default:
if (isElement(node)) {
final String name = getNodeName(node);
@@ -2335,7 +2336,6 @@
makeStringValue(attr));
}
}
- // Copy element namespace declarations ???
// Copy element children
for (child = _offsetOrChild[node];
@@ -2343,10 +2343,13 @@
child = _nextSibling[child]) {
copy(child, handler);
}
+
+ // Copy element end-tag
handler.endElement(name);
}
+ // Shallow copy of attribute to output handler
else {
- System.err.println("NYI: non element in copy");
+ shallowCopy(node, handler);
}
break;
}
@@ -2396,14 +2399,23 @@
return null;
default: // element or attribute
final String name = getNodeName(node);
- if (node < _treeNodeLimit) { // element
- handler.startElement(name);
- return name;
+ if (isElement(node)) {
+ // Copy element name - start tag
+ int col = name.lastIndexOf(':');
+ if (col > 0) {
+ final String prefix = generateNamespacePrefix();
+ handler.startElement(prefix+':'+name.substring(col+1));
+ handler.namespace(prefix, name.substring(0,col));
+ }
+ else {
+ handler.startElement(name);
+ }
+ handler.endElement(name);
}
else { // attribute
handler.attribute(name, makeStringValue(node));
- return null;
}
+ return null;
}
}
1.4 +5 -2 xml-xalan/java/src/org/apache/xalan/xsltc/dom/UnionIterator.java
Index: UnionIterator.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/UnionIterator.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- UnionIterator.java 2001/06/17 12:23:36 1.3
+++ UnionIterator.java 2001/08/03 15:23:21 1.4
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: UnionIterator.java,v 1.3 2001/06/17 12:23:36 curcuru Exp $
+ * @(#)$Id: UnionIterator.java,v 1.4 2001/08/03 15:23:21 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -100,6 +100,7 @@
node = markedNode;
iterator.gotoMark();
}
+
} // end of LookAheadIterator
private static final int InitSize = 8;
@@ -139,6 +140,7 @@
System.arraycopy(_heap, 0, newArray, 0, _free);
_heap = newArray;
}
+ _heapSize++;
_heap[_free++] = new LookAheadIterator(iterator);
return this;
}
@@ -151,8 +153,9 @@
// replace it with last
_heap[0] = _heap[--_heapSize];
}
- else
+ else {
return END;
+ }
}
else if (smallest == _last) { // duplicate
_heap[0].step(); // value consumed
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org