Nice library.
I am still learning how to use the library, but i keep hitting a problem which
i am sure is a silly mistake on my part.
I tried to tar up the files-core and files-fpml folders (removing files-
fpml/examples and files-fpml/test-cases to reduce size), so that my
application would simply rely upon handcoded.jar and handcode-resources.jar.
When i try to make the demo example validate work, i keep getting the error
below.
The error does not occur when the files-core and files-fpml are folder in my
eclipse project.
Any ideas?
Gary
03-Mar-2012 12:32:25 com.handcoded.xml.resolver.Catalog <init>
INFO: Creating catalog 'files-fpml/catalog-fpml-5-2.xml'
03-Mar-2012 12:32:25 com.handcoded.meta.Specification <clinit>
INFO: Bootstrapping Specifications
03-Mar-2012 12:32:28 com.handcoded.meta.Specification <clinit>
INFO: Completed
03-Mar-2012 12:32:28 com.handcoded.xml.resolver.Catalog <init>
INFO: Creating catalog 'files-fpml/catalog-fpml.xml'
03-Mar-2012 12:32:28 com.handcoded.xml.SchemaSet getSchema
SEVERE: Unexpected SAX Exception
org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name 'Document'
to a(n) 'type definition' component.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown
Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.xs.traversers.XSDHandler.reportSchemaError(Unknown
Source)
at org.apache.xerces.impl.xs.traversers.XSDHandler.getGlobalDecl(Unknown
Source)
at org.apache.xerces.impl.xs.traversers.XSDElementTraverser.traverseNamedEleme
nt(Unknown Source)
at org.apache.xerces.impl.xs.traversers.XSDElementTraverser.traverseGlobal(Unk
nown Source)
at org.apache.xerces.impl.xs.traversers.XSDHandler.traverseSchemas(Unknown
Source)
at org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source)
at org.apache.xerces.jaxp.validation.XMLSchemaFactory.newSchema(Unknown
Source)
at com.handcoded.xml.SchemaSet.getSchema(SchemaSet.java:119)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I did not get it to work after several attempts. I switched to use xmlbeans to get some basic interaction with FpML, however I will try again soon. I am sure it is something silly, but I just ran out of time.
gary
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I created 'an all in one' JAR version for a previous version. The code will
attempt to locate schemas and other data files from the JAR if they are not
found in the local file system (see Application.openStream). I haven't
rechecked this with the latest release recently.
The only other magic incantation needed is that you need to define the XML
catalog as a JAR file like this:
I tried again with no luck. I wrote a small ant build, the contents are below.
I did wonder if the catalogs having relative reference might be a problem, for example, files-fpml/catalog-fpml.xml has a reference
The changes at revision 706 have done the trick, schema files can be packed into a jar for deployment. Yippee!!!
One minor change I made to the build file demo target in previous post, I changed the schemaOnly argument to look at the local files which I think is OK for the demo code.
Nice library.
I am still learning how to use the library, but i keep hitting a problem which
i am sure is a silly mistake on my part.
I tried to tar up the files-core and files-fpml folders (removing files-
fpml/examples and files-fpml/test-cases to reduce size), so that my
application would simply rely upon handcoded.jar and handcode-resources.jar.
When i try to make the demo example validate work, i keep getting the error
below.
The error does not occur when the files-core and files-fpml are folder in my
eclipse project.
Any ideas?
Gary
03-Mar-2012 12:32:25 com.handcoded.xml.resolver.Catalog <init>
INFO: Creating catalog 'files-fpml/catalog-fpml-5-2.xml'
03-Mar-2012 12:32:25 com.handcoded.meta.Specification <clinit>
INFO: Bootstrapping Specifications
03-Mar-2012 12:32:28 com.handcoded.meta.Specification <clinit>
INFO: Completed
03-Mar-2012 12:32:28 com.handcoded.xml.resolver.Catalog <init>
INFO: Creating catalog 'files-fpml/catalog-fpml.xml'
03-Mar-2012 12:32:28 com.handcoded.xml.SchemaSet getSchema
SEVERE: Unexpected SAX Exception
org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name 'Document'
to a(n) 'type definition' component.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown
Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.xs.traversers.XSDHandler.reportSchemaError(Unknown
Source)
at org.apache.xerces.impl.xs.traversers.XSDHandler.getGlobalDecl(Unknown
Source)
at org.apache.xerces.impl.xs.traversers.XSDElementTraverser.traverseNamedEleme
nt(Unknown Source)
at org.apache.xerces.impl.xs.traversers.XSDElementTraverser.traverseGlobal(Unk
nown Source)
at org.apache.xerces.impl.xs.traversers.XSDHandler.traverseSchemas(Unknown
Source)
at org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source)
at org.apache.xerces.jaxp.validation.XMLSchemaFactory.newSchema(Unknown
Source)
at com.handcoded.xml.SchemaSet.getSchema(SchemaSet.java:119)
Hello Gary,
Im also facing the same exact issue.
Can you tell me how was your approach to tackle this problem.
Regards,
Abhijit
I did not get it to work after several attempts. I switched to use xmlbeans to get some basic interaction with FpML, however I will try again soon. I am sure it is something silly, but I just ran out of time.
gary
It seems similar to this issue https://forums.oracle.com/forums/thread.jspa?t
hreadID=1623997
I created 'an all in one' JAR version for a previous version. The code will
attempt to locate schemas and other data files from the JAR if they are not
found in the local file system (see Application.openStream). I haven't
rechecked this with the latest release recently.
The only other magic incantation needed is that you need to define the XML
catalog as a JAR file like this:
java -cp HandCoded.jar;xml-apis.jar;xercesImpl.jar
demo.com.handcoded.fpml.Validate -catalog jar:file:HandCoded.jar!/files
/catalog-fpml.xml -schemaOnly examples
I tried again with no luck. I wrote a small ant build, the contents are below.
I did wonder if the catalogs having relative reference might be a problem, for example, files-fpml/catalog-fpml.xml has a reference
nextCatalog catalog="../files-core/catalog-toolkit.xml"
However, I think the real problem I am encountering is the schema which include other schema files are not being resolved. Similar errors are seen at
http://techtips.sevenmountz.com/saxparseissuekeyvaluepair.html
http://mail-archives.apache.org/mod_mbox/xerces-j-users/200304.mbox/%3COFC8C7ACD7.3E0FA6E4-ON85256D0B.0051FC76-85256D0B.00543691@towers.com%3E
http://stackoverflow.com/questions/2342808/problem-validating-an-xml-file-using-java-with-an-xsd-having-an-include
I have still not found a simple solution.
Gary
ant build file attached
Last edit: Gary Kennedy 2013-01-01
The changes at revision 706 have done the trick, schema files can be packed into a jar for deployment. Yippee!!!
One minor change I made to the build file demo target in previous post, I changed the schemaOnly argument to look at the local files which I think is OK for the demo code.
arg value="${basedir}/files-fpml/examples/fpml5-4/confirmation"
instead of
arg value="files-fpml/examples/fpml5-4/confirmation"