Ticket #117 (closed defect: fixed)

Opened 13 years ago

Last modified 13 years ago

Eliminate invalid characters in generated OME-XML

Reported by: melissa Owned by: melissa
Priority: major Milestone:
Component: bio-formats Severity:
Keywords: Cc:
Blocked By: Blocking:

Description

The OME-XML generated by Bio-Formats sometimes contains invalid characters. This can be tested by running "inf -omexml <file>" - if there are invalid characters, and exception will be thrown, and the XML will not be printed. For example, "inf -omexml data/fluoview/brian/DBTRG 2X 1a-1.tif" produces the following:

ERROR: 'Character reference "&#19" is an invalid XML character.' ERROR: 'com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: Character reference "&#19" is an invalid XML character.' javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: Character reference "&#19" is an invalid XML character.

at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:654) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:281) at org.openmicroscopy.xml.DOMUtil.transform(DOMUtil.java:94) at org.openmicroscopy.xml.OMENode.getOMEDocument(OMENode.java:268) at org.openmicroscopy.xml.OMENode.writeOME(OMENode.java:182) at loci.formats.ome.OMEXMLMetadataStore.dumpXML(OMEXMLMetadataStore.java:88) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at loci.formats.FormatTools.testRead(FormatTools.java:573) at loci.formats.ImageReader.testRead(ImageReader.java:412) at loci.formats.ImageReader.main(ImageReader.java:472)

Caused by: javax.xml.transform.TransformerException: com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: Character reference "&#19" is an invalid XML character.

at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getDOM(TransformerImpl.java:496) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:644) ... 12 more

Caused by: com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: Character reference "&#19" is an invalid XML character.

at com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:393) at com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:228) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getDOM(TransformerImpl.java:474) ... 13 more


javax.xml.transform.TransformerException: com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: Character reference "&#19" is an invalid XML character.

at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getDOM(TransformerImpl.java:496) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:644) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:281) at org.openmicroscopy.xml.DOMUtil.transform(DOMUtil.java:94) at org.openmicroscopy.xml.OMENode.getOMEDocument(OMENode.java:268) at org.openmicroscopy.xml.OMENode.writeOME(OMENode.java:182) at loci.formats.ome.OMEXMLMetadataStore.dumpXML(OMEXMLMetadataStore.java:88) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at loci.formats.FormatTools.testRead(FormatTools.java:573) at loci.formats.ImageReader.testRead(ImageReader.java:412) at loci.formats.ImageReader.main(ImageReader.java:472)

Caused by: com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: Character reference "&#19" is an invalid XML character.

at com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:393) at com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:228) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getDOM(TransformerImpl.java:474) ... 13 more


com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: Character reference "&#19" is an invalid XML character.

at com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:393) at com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:228) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getDOM(TransformerImpl.java:474) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:644) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:281) at org.openmicroscopy.xml.DOMUtil.transform(DOMUtil.java:94) at org.openmicroscopy.xml.OMENode.getOMEDocument(OMENode.java:268) at org.openmicroscopy.xml.OMENode.writeOME(OMENode.java:182) at loci.formats.ome.OMEXMLMetadataStore.dumpXML(OMEXMLMetadataStore.java:88) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at loci.formats.FormatTools.testRead(FormatTools.java:573) at loci.formats.ImageReader.testRead(ImageReader.java:412) at loci.formats.ImageReader.main(ImageReader.java:472)


org.xml.sax.SAXParseException: Character reference "&#19" is an invalid XML character.

at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:215) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:386) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316) at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1438) at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanCharReferenceValue(XMLScanner.java:1304) at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanAttributeValue(XMLScanner.java:838) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanAttribute(XMLNSDocumentScannerImpl.java:578) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:222) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242) at com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:387) at com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:228) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getDOM(TransformerImpl.java:474) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:644) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:281) at org.openmicroscopy.xml.DOMUtil.transform(DOMUtil.java:94) at org.openmicroscopy.xml.OMENode.getOMEDocument(OMENode.java:268) at org.openmicroscopy.xml.OMENode.writeOME(OMENode.java:182) at loci.formats.ome.OMEXMLMetadataStore.dumpXML(OMEXMLMetadataStore.java:88) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at loci.formats.FormatTools.testRead(FormatTools.java:573) at loci.formats.ImageReader.testRead(ImageReader.java:412) at loci.formats.ImageReader.main(ImageReader.java:472)


com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: Character reference "&#19" is an invalid XML character.

at com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:393) at com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:228) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getDOM(TransformerImpl.java:474) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:644) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:281) at org.openmicroscopy.xml.DOMUtil.transform(DOMUtil.java:94) at org.openmicroscopy.xml.OMENode.getOMEDocument(OMENode.java:268) at org.openmicroscopy.xml.OMENode.writeOME(OMENode.java:182) at loci.formats.ome.OMEXMLMetadataStore.dumpXML(OMEXMLMetadataStore.java:88) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at loci.formats.FormatTools.testRead(FormatTools.java:573) at loci.formats.ImageReader.testRead(ImageReader.java:412) at loci.formats.ImageReader.main(ImageReader.java:472)


org.xml.sax.SAXParseException: Character reference "&#19" is an invalid XML character.

at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:215) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:386) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316) at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1438) at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanCharReferenceValue(XMLScanner.java:1304) at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanAttributeValue(XMLScanner.java:838) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanAttribute(XMLNSDocumentScannerImpl.java:578) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:222) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242) at com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:387) at com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:228) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getDOM(TransformerImpl.java:474) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:644) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:281) at org.openmicroscopy.xml.DOMUtil.transform(DOMUtil.java:94) at org.openmicroscopy.xml.OMENode.getOMEDocument(OMENode.java:268) at org.openmicroscopy.xml.OMENode.writeOME(OMENode.java:182) at loci.formats.ome.OMEXMLMetadataStore.dumpXML(OMEXMLMetadataStore.java:88) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at loci.formats.FormatTools.testRead(FormatTools.java:573) at loci.formats.ImageReader.testRead(ImageReader.java:412) at loci.formats.ImageReader.main(ImageReader.java:472)

java.lang.NullPointerException

at java.util.StringTokenizer.<init>(StringTokenizer.java:182) at loci.formats.FormatTools.indentXML(FormatTools.java:889) at loci.formats.FormatTools.indentXML(FormatTools.java:883) at loci.formats.FormatTools.testRead(FormatTools.java:574) at loci.formats.ImageReader.testRead(ImageReader.java:412) at loci.formats.ImageReader.main(ImageReader.java:472)

Attachments

DOMUtil.java Download (14.0 KB) - added by melissa 13 years ago.

Change History

Changed 13 years ago by melissa

comment:1 Changed 13 years ago by melissa

The attached version of org.openmicroscopy.xml.DOMUtil fixes this issue.

comment:2 Changed 13 years ago by melissa

  • Status changed from new to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.