[xsd-users] Attribute list as a C++ list of token

Klaim - Joël Lamotte mjklaim at gmail.com
Wed Jun 20 05:47:25 EDT 2012


Hi,

So I'm working on my format (
http://code.google.com/p/art-of-sequence/source/browse/aosl/aosl.xsd)
and recently I added several types defined llike this (line 1764 and
following):

-----------CODE----------------------

<!--## References ####-->

        <xs:simpleType name="unique_ref">
                <xs:annotation>
                        <xs:documentation>Type for reference to an unique
Id.</xs:documentation>
                </xs:annotation>

                <xs:restriction base="xs:IDREF" >
                        <xs:pattern value="([a-zA-Z0-9_-])+" />
                </xs:restriction>

        </xs:simpleType>


        <!--# Stages ##-->

        <xs:simpleType name="stage_ref">
                <xs:annotation>
                        <xs:documentation>Reference to a
Stage.</xs:documentation>
                </xs:annotation>

                <xs:restriction base="aos:unique_ref" />

        </xs:simpleType>

        <xs:simpleType name="stage_ref_list">
                <xs:annotation>
                        <xs:documentation>List of references to a
Stages.</xs:documentation>
                </xs:annotation>

                <xs:list itemType="aos:stage_ref" />

        </xs:simpleType> <xs:simpleType name="special_stage_ref">
                <xs:annotation>
                        <xs:documentation>Reference to one or more stages
automatically found by using a search logic. </xs:documentation>
                </xs:annotation>

                <xs:restriction base="xs:string">
                        <xs:enumeration value="#all">
                                <xs:annotation>
                                        <xs:documentation>
                                                Represent all the stages.
                                                Useful to allow a move to
be available from all the stages.
                                        </xs:documentation>
                                </xs:annotation>
                        </xs:enumeration>
                </xs:restriction>

        </xs:simpleType>

        <xs:simpleType name="stage_ref_ex">
                <xs:annotation>
                        <xs:documentation>
                                Reference to one or several stages or to a
special reference to stages.
                        </xs:documentation>
                </xs:annotation>

                <xs:union memberTypes="aos:stage_ref_list
aos:special_stage_ref" />

        </xs:simpleType> -----------CODE----------------------
It works well and xsd-tree generate code without a problem. Notice the
list, and it's usage in stage_ref_ex. (here is my configuration file for
xsd-tree:
http://code.google.com/p/art-of-sequence/source/browse/tools/aoslcpp/script/generate_cpp.cfg)
xsd-tree generates a string-like type for any use of stage_ref_ex,
even
if it's a stage_ref_list inside. So here I wanted to ask if it would be
possible in the case of a list attribute being used (in a union or not), to
provide some kind of iterator that would allow going through the tokens?
Obviously I can use my own string tokenizer (like the one in boost or the
new split function) but it would be easier to manipulate such type as a
list if it is really a list of token. That said I'm not sure about how to
provide such feature in such complex context, so I just start a discussion
about it, see if you have an idea to implement it? Thanks for your work.
Joel Lamotte


More information about the xsd-users mailing list