Hi all,
Please somebody help me. The deadline is near and I am not able to
workaround this problem.
Please help me guys.
Thanks in advance.
- Jithin Jayaram, Software Engineer
_____
From: Jithin Jayaram [mailto:jithinjayaram_at_arssoftware.com]
Sent: Tuesday, March 09, 2010 3:16 PM
To: users_at_jaxb.dev.java.net
Subject: Error while trying to parse a xml schema : InvalidRegex
From: Jithin Jayaram [mailto:jithinjayaram_at_arssoftware.com]
Sent: Tuesday, March 09, 2010 3:04 PM
To: 'users_at_jaxb.dev.java.net'
Subject: Error while trying to parse a xml schema : InvalidRegex
Hi,
Jaxb version used : 2.1.9
Java version : 1.5
I am getting the following error while trying to parse an xml schema
document in my program.
org.xml.sax.SAXParseException: InvalidRegex: Pattern value
'[EAN][0-9]{1,3}([NOZWLR])?[-]([abcdefghjkmnpqrstuvwxyz][-])?[0-9]{1,3}[-
]\d{3}-DR[1-9]' is not a valid regular expression. The reported error was:
''-' is an invalid character range. Write '\-'.'.
at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseEx
ception(Unknown Source)
at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown
Source)...73..xmlSchemaPath : F:\workspace\XMLParser\src\conf\cggosall.xsd
at
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchem
aError(Unknown Source)
at
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDAbstractTraverser.r
eportSchemaError(Unknown Source)
at
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDSimpleTypeTraverser
.traverseSimpleTypeDecl(Unknown Source)
at
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDSimpleTypeTraverser
.traverseGlobal(Unknown Source)
at
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getGlobalDe
cl(Unknown Source)
at
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDAttributeTraverser.
traverseNamedAttr(Unknown Source)
at
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDAttributeTraverser.
traverseLocal(Unknown Source)
at
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDAbstractTraverser.t
raverseAttrsAndAttrGrps(Unknown Source)
at
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDComplexTypeTraverse
r.processComplexContent(Unknown Source)
at
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDComplexTypeTraverse
r.traverseComplexTypeDecl(Unknown Source)
at
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDComplexTypeTraverse
r.traverseGlobal(Unknown Source)
at
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.traverseSch
emas(Unknown Source)
at
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema
(Unknown Source)
at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(Unknow
n Source)
at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(Unkno
wn Source)
at
com.sun.org.apache.xerces.internal.jaxp.validation.xs.SchemaFactoryImpl.newS
chema(Unknown Source)
at javax.xml.validation.SchemaFactory.newSchema(Unknown Source)
at javax.xml.validation.SchemaFactory.newSchema(Unknown Source)
at
com.arsse.ossim.util.CggosallXMLParser.parser(CggosallXMLParser.java:88)
at
com.arsse.ossim.util.CggosallXMLParser.<init>(CggosallXMLParser.java:64)
at
com.arsse.ossim.util.CggosAllXMLParserTester.main(CggosAllXMLParserTester.ja
va:25)
The code snippet I used to parse the document is given below.
JAXBContext jcontext = JAXBContext.newInstance(contextPackage);
SchemaFactory sf = SchemaFactory.newInstance(
XMLConstants.W3C_XML_SCHEMA_NS_URI );
Schema mySchema = sf.newSchema(new File(xmlSchemaPath));
Unmarshaller unmarshaller = jcontext.createUnmarshaller();
unmarshaller.setSchema(mySchema);
The error occurs during the execution of third line.
The same error also occurred when I was trying to generate the classes from
the xml schema using the xjc.But by giving the parameters -nv I was able to
generate the classes. I used the following command to generate the classes.
F:\ xjc -nv cggossall.xsd -p com.generated
Thanks & Regards
- Jithin Jayaram, Software Engineer