[ http://issues.apache.org/jira/browse/XERCESJ-1043?page=history ]
Michael Glavassevich updated XERCESJ-1043:
------------------------------------------
Version: 2.6.2
Component: DOM
(was: SAX)
> LSSerializer fails when validating external entities with namespaces
> --------------------------------------------------------------------
>
> Key: XERCESJ-1043
> URL: http://issues.apache.org/jira/browse/XERCESJ-1043
> Project: Xerces2-J
> Type: Bug
> Components: DOM
> Versions: 2.6.2
> Environment: Linux Debian
> Reporter: ijorge
> Assignee: Michael Glavassevich
> Priority: Minor
>
> When I try to write a Document with this code:
> System.setProperty(DOMImplementationRegistry.PROPERTY,
> org.apache.xerces.dom.DOMImplementationSourceImpl");
> DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
> DOMImplementationLS impl
> =(DOMImplementationLS)registry.getDOMImplementation("LS");
> LSOutput output = impl.createLSOutput();
> output.setSystemId(uri);
> LSSerializer writer = impl.createLSSerializer();
> writer.write(document, output);
> I recieve this error:
> [java] java.io.IOException: The replacement text of the entity node
> 'entity' contains an element node 'example1' with an attribute 'xmlns:exa' an
> undeclared prefix 'xmlns'.
> [java] at
> org.apache.xml.serialize.BaseMarkupSerializer.fatalError(Unknown Source)
> [java] at
> org.apache.xml.serialize.XMLSerializer.checkUnboundNamespacePrefixedNode(Unknown
> Source)
> [java] at
> org.apache.xml.serialize.BaseMarkupSerializer.serializeNode(Unknown Source)
> [java] at
> org.apache.xml.serialize.XMLSerializer.serializeElement(Unknown Source)
> [java] at
> org.apache.xml.serialize.BaseMarkupSerializer.serializeNode(Unknown Source)
> [java] at
> org.apache.xml.serialize.BaseMarkupSerializer.serializeNode(Unknown Source)
> [java] at
> org.apache.xml.serialize.BaseMarkupSerializer.serialize(Unknown Source)
> [java] at org.apache.xml.serialize.DOMSerializerImpl.write(Unknown
> Source)
> These are the xml files that I am using:
> XML:
> <?xml version="1.0" encoding="iso-8859-1"?>
> <!DOCTYPE Root PUBLIC "-//Example//DTD Example/EN"
> "http://www.example.com/example" [
> <!ENTITY entity SYSTEM 'entity.inc'>
> ]>
> <Root
> name="root"
> xmlns="http://www.example.com/example"
> xmlns:exa="http://www.example.com/example">
> &entity;
> </Root>
> ENTITY:
> <?xml version="1.0" encoding="iso-8859-1"?>
> <example1 xmlns:exa="http://www.example.com/example">
> <exa:example2>ss</exa:example2>
> </example1>
> I have been investigating the source code of Xerces and I think that the error
> is in org/apache/xerces/util/NamespaceSupport.java. The method "String
> getURI(String prefix)" compare two string but uses "==" instead of "equals". I
> have modified this code and previous example does not produce errors.
> DIFF between original code and my modified code:
> 232c232
> < if (fNamespace[i - 2] == prefix) {
> ---
> > if (fNamespace[i - 2].equals(prefix)) {
--
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]