You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2001/10/22 17:46:53 UTC
DO NOT REPLY [Bug 4336] New: -
Xalan 2.2.D11 adds a strange Attribute
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4336>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4336
Xalan 2.2.D11 adds a strange Attribute
Summary: Xalan 2.2.D11 adds a strange Attribute
Product: XalanJ2
Version: 2.2.x
Platform: All
OS/Version: All
Status: NEW
Severity: Blocker
Priority: Other
Component: org.apache.xpath
AssignedTo: xalan-dev@xml.apache.org
ReportedBy: geuer-pollmann@nue.et-inf.uni-siegen.de
CC: mmidy@apache.org
Hi all,
dear Myriam,
A bug in Xalan v.2.2D11 in the namespace behaviour. To demonstrate this bug,
the following XML file is converted to a NodeSet using the XPathAPI and then,
all Nodes in the node set are printed out. In Version D10, it's the correct
size, in D11, a curious
org.apache.xml.dtm.ref.dom2dtm.DOM2DTM$defaultNamespaceDeclarationNode
Attribute is added to the tree.
The XML File:
<?xml version=\1.0"?>
<!DOCTYPE doc [
<!ELEMENT doc (n+)>
<!ELEMENT n (#PCDATA)>
]>
<!-- full document with decl -->
<doc><n>1</n></doc>
The XPath used for Selection:
(.//. | .//@* | .//namespace::*)
Output from both versions:
Apache Xerces Xerces 1.4.3
Apache Xalan Xalan Java 2.2.D10
0 DOCUMENT [#document: null]
1 COMMENT [#comment: full document with decl ]
2 ELEMENT [doc: null]
3 ELEMENT [n: null]
4 TEXT_NODE [#text: 1]
Apache Xerces Xerces 1.4.3
Apache Xalan Xalan Java 2.2.D11
0 DOCUMENT [#document: null]
1 COMMENT [#comment: full document with decl ]
2 ELEMENT [doc: null]
3 ATTRIBUTE
org.apache.xml.dtm.ref.dom2dtm.DOM2DTM$defaultNamespaceDeclarationNode@6b017e
4 ELEMENT [n: null]
5 TEXT_NODE [#text: 1]
Code to reproduce this bug:
import java.io.*;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import org.xml.sax.SAXException;
import org.apache.xpath.XPathAPI;
public class XPathBug {
static final String _nodeSetInput1 =
"<?xml version=\"1.0\"?>\n"
+ "<!DOCTYPE doc [\n"
+ "<!ELEMENT doc (n+)>\n"
+ "<!ELEMENT n (#PCDATA)>\n"
+ "]>\n"
+ "<!-- full document with decl -->"
+ "<doc><n>1</n></doc>";
public static void main(String unused[]) throws Exception {
System.out.println("Apache Xerces "
+ org.apache.xerces.framework.Version.fVersion);
System.out.println("Apache Xalan "
+ org.apache.xalan.processor.XSLProcessorVersion.S_VERSION);
DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
dfactory.setValidating(false);
dfactory.setNamespaceAware(true);
DocumentBuilder db = dfactory.newDocumentBuilder();
Document document =
db.parse(new ByteArrayInputStream(_nodeSetInput1.getBytes()));
NodeList nl = XPathAPI.selectNodeList(document,
"(.//. | .//@* | .//namespace::*)");
for (int i=0; i<nl.getLength(); i++) {
System.out.println(i + " " + getNodeTypeString(nl.item(i)) + " " +
nl.item(i));
}
}
static String[] nodeTypeString = new String[]{
"", "ELEMENT", "ATTRIBUTE", "TEXT_NODE", "CDATA_SECTION",
"ENTITY_REFERENCE", "ENTITY", "PROCESSING_INSTRUCTION",
"COMMENT", "DOCUMENT","DOCUMENT_TYPE","DOCUMENT_FRAGMENT","NOTATION" };
public static String getNodeTypeString(short nodeType) {
if ((nodeType > 0) && (nodeType < 13)) {
return nodeTypeString[nodeType];
} else {
return "";
}
}
public static String getNodeTypeString(Node n) {
return getNodeTypeString(n.getNodeType());
}
}