[xsd-users] string literal definitions for element names

Boris Kolpackov boris at codesynthesis.com
Wed Jan 13 08:57:05 EST 2010


Hi Leonid,

Leonid Gershanovich <gleonid at yahoo.com> writes:

> is there a way to instruct generator to produce set of string literal 
> definitions for element/attribute names?
>
> ... 
>
> ::xml_schema1::document doc_p (
>   sample_el_p,
>   "http://schemas.247realmedia.com/sample",
>   "sample_el");
> 
> Ideally I do not want to have neither element name nor xml namspace 
> hardcoded in my program, but I could not find in generated code any
> way to do this otherwise.

There is no way to do this at the moment. We cannot add such literals
to the parser skeleton corresponding to the element's type since this
type can be used in more than one global element. So the only way that
I see would be to generate a class for each global element with static
functions that return the element's namespace and name. But that seems
like a significant overhead for not much functionality (there could be 
hundreds of global elements while only some of them are actually 
valid document roots). How many root element do you have to handle 
in your case?

Boris



More information about the xsd-users mailing list