You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org> on 2005/02/10 20:50:12 UTC

[jira] Resolved: (XERCESJ-1043) LSSerializer fails when validating external entities with namespaces

     [ http://issues.apache.org/jira/browse/XERCESJ-1043?page=history ]
     
Michael Glavassevich resolved XERCESJ-1043:
-------------------------------------------

    Resolution: Fixed

NamespaceSupport is working as designed. This class expects that the prefix and namespace will be identical references for equal strings. The problem was that the serializer was not passing in unique string for the prefix. We now retrieve such a string from the SymbolTable. Should be fixed now in CVS. Thanks for reporting.

> 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: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org