[xsd-users] Using regular expressions

Carl xsd at faultline.com
Wed Oct 7 17:11:12 EDT 2009


I am having problems with regular expressions. I am trying to parse the 
XSD files supplied by California to support efiling of payroll tax 
returns. There are several files that reference each other but also 
reuse some element names. These cause conflicts when generating the C++ 
code. I tried using regular expressions and got at least as far as 
generating all the C++ files. Now compiling these files generates errors 
of conflicting class names. So I'm not sure the regular expressions did 
what I thought.

Here is an example of what I am trying to do:

The files StateWH.xsd and StateUI.xsd both contain an element called 
AmendedReturnElect among many others. So after much trial and error I 
came up with this regular expression in the hopes that all classes in 
the StateWH file would have WH_ prepended to the names.

--anonymous-regex ,.*StateWH.xsd .* StateWHType/.*,WH_$0,

But I don't see any evidence of this in the StateWH.hxx file. Without 
this xsd would not generate the .cxx or .hxx files. It just complained 
about name conflicts so the regex did something but I don't know what.

The way I read the regex I used is

in any file matching *StateWH.xsd
any namespace
any element name starting with StateWHType
add WH_ to the start of the name

So what did I really do and how do I get this to actually change the 
class names with a few prepended characters so I avoid the conflicts?

Thanks,
Carl




More information about the xsd-users mailing list