[ 
https://issues.apache.org/jira/browse/UIMA-2155?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13150875#comment-13150875
 ] 

Marshall Schor commented on UIMA-2155:
--------------------------------------

I was able to reproduce this, given the zipped test case, when using Sun Java 
(IBM Java worked OK, but probably because adding the XALAN 2.6.0 maven 
dependency didn't have any effect).  

I found a way to work around this apparent bug in 2.6.0 XALAN (which dates from 
2005).  I confirmed, also, that switching the XALAN dependency to 2.7.1 doesn't 
show this problem.

However, 2.7.1 is the "latest" version of XALAN, and dates from 2008.  
Both of these versions make another uimaj-core test case (which tests for 
serialization using the XML 1.1 standard) fail (that standard came into 
existence after 2008, I think).

Modern Java implementations (Sun and IBM are the 2 I checked) have their own 
versions of this, which pass the XML 1.1 serialization test as well as not 
having the NAMESPACE_ERR issue.  

The work around in UIMA for this bug is to scan the attributes in the 
"startElement" method of the SAX parsing, and if the attribute "xmlns" is 
found, to make it have it's URI default namespace as well.  This scanning would 
slightly slow parsing down, so I'm not sure we want to put it in.

The other work-around appears to be something like: use a modern Java 
implementation, and remove any XALAN jars from the classpath, allowing the more 
modern version packaged within Java itself, to be used. *_Can those who are 
experiencing this difficulty, comment further on this issue, saying if they can 
do this workaround, or if they really need the 
inside-UIMA-hack-for-xmlns-attribute workaround?_*
                
> XML parsers coming with Sun JDK fail to parser UIMA XML descriptors
> -------------------------------------------------------------------
>
>                 Key: UIMA-2155
>                 URL: https://issues.apache.org/jira/browse/UIMA-2155
>             Project: UIMA
>          Issue Type: Bug
>          Components: Core Java Framework
>            Reporter: Richard Eckart de Castilho
>         Attachments: testcase-UIMA-2155.zip
>
>
> Several people in our group that run Linux with the Sun JDK have run into 
> problems that UIMA fails to parse descriptors unless Xerces 2.9.1 and Xalan 
> 2.7.1. are on the classpath. 
> It might be a good idea to add these two as standard dependencies to 
> uimaj-core. 
> {noformat}
> org.apache.uima.util.InvalidXMLException: Invalid descriptor at Chunks.xml.
>     at org.apache.uima.util.impl.XMLParser_impl.parse(XMLParser_impl.java:194)
>     at 
> org.apache.uima.util.impl.XMLParser_impl.parseTypeSystemDescription(XMLParser_impl.java:708)
>     at 
> org.apache.uima.util.impl.XMLParser_impl.parseTypeSystemDescription(XMLParser_impl.java:695)
>     at 
> org.uimafit.factory.TypeSystemDescriptionFactory.createTypeSystemDescription(TypeSystemDescriptionFactory.java:145)
>     at 
> org.uimafit.factory.AnalysisEngineFactory.createPrimitiveDescription(AnalysisEngineFactory.java:229)
>     at wikicounts.RunCountExperiment.run(RunCountExperiment.java:66)
>     at wikicounts.RunCountExperiment.main(RunCountExperiment.java:27)
> Caused by: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to 
> create or change an object in a way which is incorrect with regard to 
> namespaces.
>     at org.apache.xml.utils.DOMBuilder.startElement(DOMBuilder.java:322)
>     at 
> org.apache.xalan.transformer.TransformerIdentityImpl.startElement(TransformerIdentityImpl.java:1020)
>     at 
> org.apache.uima.util.impl.SaxDeserializer_impl.startElement(SaxDeserializer_impl.java:202)
>     at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown 
> Source)
>     at 
> org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown 
> Source)
>     at 
> org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown
>  Source)
>     at 
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
>  Source)
>     at 
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown 
> Source)
>     at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>     at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>     at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
>     at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
>     at org.apache.uima.util.impl.XMLParser_impl.parse(XMLParser_impl.java:177)
>     ... 6 more
> Caused by: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to 
> create or change an object in a way which is incorrect with regard to 
> namespaces.
>     at org.apache.xerces.dom.AttrNSImpl.setName(Unknown Source)
>     at org.apache.xerces.dom.AttrNSImpl.<init>(Unknown Source)
>     at org.apache.xerces.dom.CoreDocumentImpl.createAttributeNS(Unknown 
> Source)
>     at org.apache.xerces.dom.ElementImpl.setAttributeNS(Unknown Source)
>     at org.apache.xml.utils.DOMBuilder.startElement(DOMBuilder.java:307)
>     ... 18 more
> {noformat}
>     

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to