The following comment has been added to this issue:
Author: Ronald Wildenberg
Created: Wed, 9 Jun 2004 12:12 AM
Body:
That's a good point. I did not know this but it might explain the issue. It's a pity
these things are not listed in the JavaDoc, I think. Or is there another more suitable
place for documenting these differences?
---------------------------------------------------------------------
View this comment:
http://issues.apache.org/jira/browse/XERCESJ-898?page=comments#action_35993
---------------------------------------------------------------------
View the issue:
http://issues.apache.org/jira/browse/XERCESJ-898
Here is an overview of the issue:
---------------------------------------------------------------------
Key: XERCESJ-898
Summary: Document creation by hand different than parsed document
Type: Bug
Status: Open
Project: Xerces2-J
Components:
DOM
Versions:
2.6.0
Assignee: Xerces-J Developers Mailing List
Reporter: Ronald Wildenberg
Created: Mon, 23 Feb 2004 3:55 PM
Updated: Wed, 9 Jun 2004 12:12 AM
Environment: Operating System: Other
Platform: Other
Description:
I create an XML document from another document using the org.w3c.dom API. When I
attempt to parse the document using Jaxen, it fails to find nodes that are
obviously present in the document.
However, when I write the document to a stream
(org.apache.xml.serialize.XMLSerializer) and parse it again using a
javax.xml.parsers.DocumentBuilder, the exact same XPath expressions in Jaxen
reproduce the correct nodes. I would expect behavior to be the same, no matter
how I created the document.
Below a code sample for creating the document (sorry for not providing a better
test case). The XPath "/sieve-script/commands" returns no results if I directly
use it on the produced document (both using Jaxen and the Xalan XPath API). If I
serialize the document, parse it again to an org.w3c.dom.Document and then use
the same XPath, it correctly finds nodes.
Creating the document
---------------------
DOMImplementation domImplementation = documentBuilder.getDOMImplementation();
DocumentType docType = domImplementation.createDocumentType(
"sieve-script", "-//Finalist IT Group//DTD Sieve-Script//EN", dtdLocation);
Document document = domImplementation.createDocument(
"http://www.finalist.com/sieve", "sieve-script", docType);
Element commandsElement = document.createElement("commands");
document.getDocumentElement().appendChild(commandsElement);
Element requireCommandElement = document.createElement("require-command");
commandsElement.appendChild(requireCommandElement);
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]