• Post Reply Bookmark Topic Watch Topic
  • New Topic

error creating XMLBeans  RSS feed

Nazmul Bhuiyan
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

Compiling eFile schema and building xmlBeanEFI.jar


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
Paul Clapham
Posts: 22509
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!