-
I'm trying to construct a static code generator for C++ (because all the ones out there that I know of are either paid or they don't really support what I'm trying to do/don't have an intuitive API). However, I'm uncertain about a couple things:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi, about the 1st question: you have to look at the type. Each type has a content type, that can be:
for checking if the content of the element is only a text use:
if you don't mind about empty cases add also For checking if the element has declared attributes use For the second question, if you define a subclass for C++ starting with: class CPPGenerator(AbstractGenerator):
"""A C++ code generator for XSD schemas."""
formal_language = 'CPP'
... the auto-generated filter will be |
Beta Was this translation helpful? Give feedback.
-
Thank you! :) |
Beta Was this translation helpful? Give feedback.
Hi,
about the 1st question: you have to look at the type. Each type has a content type, that can be:
for checking if the content of the element is only a text use:
xsd_element.type.has_simple_content()
if you don't mind about empty cases add also
is_empty()
.For checking if the element has declared attributes use
len(xsd_element.attributes) == 0
(ornot xsd_element.attributes
).For the second question, if you define a subclass for C++ starting with:
the auto-generated filter will be
cpp_type
.