[xsd-users] "Unable to open in read mode" using --namespace-regex

Lenz, Timothy K timothy.k.lenz at lmco.com
Tue Mar 25 11:45:57 EDT 2008


Hello!

 

I've only recently started using Code Synthesis XSD for a medium-scale
application.  We are in the process of trying multiple XML/C++ binding
tools to find one that best fits our needs.  In that light, I am pretty
new to most of this stuff (XML namespaces and schemas, Perl regular
expressions, etc), so be gentle.  This could be an entirely simple
issue, but I can't find out how to fix it.

 

Basically, I have multiple XML schemas from a 3rd party which include
multiple namespaces in the format "Foo:bar" (note the single colon).

 

These don't translate to valid C++ namespaces, so I need to replace all
of those single colons with double colons.  However, every time I try, I
get the error "Unable to open in read mode".

 

I have tried various permutations of the following command:

 

/usr/bin/xsd cxx-tree --namespace-regex "%(\w):{1}(\w)%\$1::\$2%"
myfile.xsd

 

I have used double quotes, single quotes, and no quotes.  I have used %,
/, and ^ as delimiters.  I have even tried putting the regular
expression in its own file and using the filename as the argument to the
namespace-regex parameter.  Then I get something along the lines of
invalid file structure.  I got the same "read mode" error when using the
simplistic replacement:

 

/usr/bin/xsd cxx-tree --namespace-regex "%foo%bar%" myfile.xsd

 

I am able to continue using the --namespace-map, but considering there
are numerous different cases following the same structure (e.g.
"Foo:bar", "Foo:man", "Foo:choo"), doing so is not remotely desirable.

 

How do I use this?  The "man" pages were pretty useless on this point
(no actual example using namespace-regex).  I found a hit on these
threads that gave an example of usage, but I'm using it right (based on
those examples) and still no joy.  Anything anyone could provide would
be much appreciated.

 

Thanks! 

Tim Lenz 

 




More information about the xsd-users mailing list