wood burning stoves 2.0*
The moose likes XML and Related Technologies and the fly likes error creating XMLBeans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "error creating XMLBeans" Watch "error creating XMLBeans" New topic
Author

error creating XMLBeans

Nazmul Bhuiyan
Greenhorn

Joined: May 23, 2002
Posts: 17
Hi,
I'm trying to generate XML beans using a xsd provided by 3rd party and getting the following error. When I put escape character for '-' then it generates XMLBeans without any error. 3rd party says that their XSD is ok.
Can some one please advise me why this is failing and why '-' needs to be escaped?

E:\eFileWorkspace\eFileInterface\xmlBeansCompile>createXMLBeans.bat
Compiling eFile schema and building xmlBeanEFI.jar

E:\eFileWorkspace\eFileInterface\xmlBeansCompile>setlocal

E:\eFileWorkspace\eFileInterface\xmlBeansCompile>SET JAVA_HOME="C:\jdk1.5.0_04"

E:\eFileWorkspace\eFileInterface\xmlBeansCompile>scomp -src .\src -javasource 1.5 -out ..\lib\xmlBeanEFI.jar eFIBatchFile1501.xsd createXMLBeans.xsdconfig
E:\eFileWorkspace\eFileInterface\xmlBeansCompile\eFIXMLFile1501.xsd:169:4: error: pattern-regex: The regular expression '([\.a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(([a-zA-Z0-9_-])*\.([a-zA-Z0-9_-])+)+' is malformed: '-' is an invalid character range. Write '\-'.
Time to build schema type system: 1.437 seconds
BUILD FAILED
E:\eFileWorkspace\eFileInterface\xmlBeansCompile>
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18716
    
    8

Well, I am no schema expert and I don't know much about regular expressions, but the first two references I found on the internet about regexes in XML Schema did say that you escape the minus sign by preceding it by a backslash, if you want to match a minus sign.

Here's the official specification: http://www.w3.org/TR/2000/WD-xmlschema-2-20000407/

But looking more closely, the schema specification does say
The - character is a valid character range only at the beginning or end of a positive character group.
And the - character in that regex is indeed at the end of the group. So maybe it is correct and the error message is wrong. That would be unfortunate for you because you would be blocked by a bug in the schema processor. I suppose you could beg your third-party supplier to escape the minus sign anyway; that would still be well-formed and equivalent as far as I can see.

That's my best guess right now, although as I said I am not an expert in these topics.
 
 
subject: error creating XMLBeans