Help with tag that can appear anywhere
Brought to you by:
dkuhlman
Hello,
I'm using the classes created with generateds only to write XML files and not read them. In particular, there is a type of tag which can be put inside any other tag, and I was wondering how to use the class. Usually when I have to add a tag inside another I just use the method "set_subtag" or "add_subtag", but in this case there is nothing. I attached the XML schema if it helps, the tag I'm referring to is called "userData".
Claudio,
Good to hear from you.
I generated a module from the OpenDRIVE XML schema with the
following command:
Looking in the generated file (
opendrivelib.py) and searching for classt_userData... It has an instance variable (member) namedanytypeobjs_. It is the result of thexs:anyelement insidexs:complexClassnamedt_userData. It's a list, and you can, Ibelieve, add anything to it that you want. See methods in that
class named:
get_anytypeobjs_,set_anytypeobjs_,insert_anytypeobjs_, andadd_anytypeobjs_. However, sincegenerateDS.pydoesn't know what these objects are, it's supportfor them is weak.
The
xs:anyinside oft_userDataallows you to insert any otherobject inside this one. However, in your message you ask about an
object that you want to insert inside of any
otherobject. So, Iguess I have still not answered your question.
However, as a partial answer to that question you need to look in
the OpenDRIVE XML schema. Look where
t_userDatais referenced.It's referred to in
<xs:group name="g_additionalData">. And, thatis referred to (included in ?) lots of other complex types, for
example, in
OpenDRIVEandt_headerandt_header_GeoReferenceand many more. In each of the classes generated from those complex
types, you will find methods
get_userData,set_userData, and, ifit's a list also
add_userDataandinsert_userData. You can adda
t_userDatain any of those objects.So, does that answer your question? Or, am I still not
understanding you correctly?
Dave
Okay, it does and apparently, I don't know why, I was using a file that was incomplete. Now I recreated the python file and the userData arguments are there. Thanks for your answer, if I'm still having problem I'll write again!