Dobry den!
Mam problem s validaci XML schematu pro XAdES. Pokud
nastavuji k dokumentu schema takto
final Schema schema =
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema(schemaURL);
final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
dbf.setSchema(schema);
final DocumentBuilder builder = dbf.newDocumentBuilder();
final Document document = builder.parse(file);
dostanu nasledujici vyjimku:
____________________________________________________________
org.xml.sax.SAXParseException: rcase-Recurse.2: There is not
a complete functional mapping between the particles.
at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
at
com.sun.org.apache.xerces.internal.impl.xs.XSConstraints.reportSchemaError(XSConstraints.java:276)
at
com.sun.org.apache.xerces.internal.impl.xs.XSConstraints.fullSchemaChecking(XSConstraints.java:405)
at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:526)
at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:485)
at
com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.newSchema(XMLSchemaFactory.java:206)
at
javax.xml.validation.SchemaFactory.newSchema(SchemaFactory.java:594)
at
javax.xml.validation.SchemaFactory.newSchema(SchemaFactory.java:626)
at
cz.mathan.crypto.DocumentModel.<init>(DocumentModel.java:94)
at
cz.mathan.multisignature.gui.Desktop.setDocument(Desktop.java:345)
at
cz.mathan.multisignature.gui.ActionFactory.openFile(ActionFactory.java:192)
at
cz.mathan.multisignature.gui.MultisignatureRecentFiles.fileClicked(MultisignatureRecentFiles.java:37)
at
cz.mathan.swing.RecentFiles.actionPerformed(RecentFiles.java:134)
at
javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at
javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at
javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at
javax.swing.AbstractButton.doClick(AbstractButton.java:357)
at
javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1216)
at
javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1257)
at
java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
at
java.awt.Component.processMouseEvent(Component.java:6038)
at
javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
at
java.awt.Component.processEvent(Component.java:5803)
at
java.awt.Container.processEvent(Container.java:2058)
at
java.awt.Component.dispatchEventImpl(Component.java:4410)
at
java.awt.Container.dispatchEventImpl(Container.java:2116)
at
java.awt.Component.dispatchEvent(Component.java:4240)
at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at
java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
at
java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at
java.awt.Container.dispatchEventImpl(Container.java:2102)
at
java.awt.Window.dispatchEventImpl(Window.java:2429)
at
java.awt.Component.dispatchEvent(Component.java:4240)
at
java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at
java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
_____________________________________________________________________________________
Pouziji-li xerces primo, zadnou vyjimku nedostanu:
DOMParser parser = new DOMParser();
parser.setFeature("http://apache.org/xml/features/validation/schema", true);
parser.setProperty("http://apache.org/xml/properties/schema/external-schemaLocation",
schemaURL.toString());
parser.parse(file.toURI().toString());
document = parser.getDocument();
U teto druhe metody mi vsak vadi, ze pouzivam tridu z
interniho baliku: com.sun.org.apache.xerces.internal.parsers.DOMParser
A pouzit xerces jako knihovnu nejde, protoze se to tluce s
ukladanim Java preferenci do xml.
Saxonica i webovy validator na strankach
http://www.w3.org/2001/03/webdata/xsv take zadnou chybu
nenachazeji.
Nemate nekdo nejakou radu, co by se s tim dalo delat, krome
toho, si stezovat nekde na bug a cekat do pristi petiletky?
S pozdravem
Lucie Rut Bittnerova