| java.lang.Object org.jibx.binding.generator.SchemaMappingDetail
SchemaMappingDetail | public class SchemaMappingDetail (Code) | | Holder for the details of how a mapping is to be represented in a schema.
Each mapping is converted to a complex type, but the complex type may be
either global or local to a containing global element. In the case of a
mapping used as the base for one or more extension types, both a global
complex type and a global element that references the type are required.
This also tracks the content form for the complex type definition.
Should the binding representation of polymorphism use both abstract mappings
with type names, and concrete mappings with element names that reference the
abstract mapping? Then use two complete separate hierarchies? But in order to
do the
book ----\
-----item
dvd -----/
So the concrete for book extends the concrete mapping for item, as
does the concrete mapping for dvd. If book is not extended, there's no need
to have a separate BookType. There is the need for a separate abstract
mapping for ItemType, which the concrete mapping for item then uses. On the
other hand, the way I've changed the code to work there's no need have any
additional mappings - the book and dvd mappings can each just invoke the item
mapping directly.
Now what if I want to extend the book mapping? So I have an arts book type
that adds more details, say the number of plates. Ideally, I'd like to have
the artBook mapping extend the concrete book mapping. But then how do I
distinguish between the artBook and the reference to
a book that's meant to be a element? Here's the logical structure of
what I want:
book --\
artBook ---------- BookType ---\
----- ItemType
dvd -----/
But the extends structure is:
artBook ---------- book ---\
----- item
dvd -----/
Should the BookType abstract mapping in the top diagram extend ItemType? I
don't think that's necessary, as long as the first component of the BookType
definition is a structure reference to ItemType.
So concrete s can be extended to represent substitution groups. If
the base of a extension is an abstract , I'll add an
abstract element definition for that just to serve as a base for
the substitution group. Abstract extensions in the future can be
used for type substitution, but that requires named types for the whol
hierarchy.
If I do it this way, there's no need to allow for names on abstract mappings,
and each abstract mapping corresponds directly to a complexType while each
concrete mapping corresponds directly to an element. Note that the extends
relationship between elements may or may not carry over to the
schema; if a uses extends='...' but doesn't have the structure
reference to the extended type as the first component, or if the reference
uses a name, the extends relationship cannot go into the schema and the user
should get a warning. On the other hand, if the first component is a
structure reference to a with no name, this should be reflected in
the schame as an extends relationship for the complexTypes. s which
are used as groups of elements and/or attributes should be modeled in the
schema as s and s.
What about customizations for schema generation? It seems like this would be
very useful, but the issue here is that the structure doesn't match the form
of the customizations used for going from Java (class-structured). I'd
instead want to make schema customizations follow the structure of a binding
definition.
Can I just generate the schema components on-demand? That would mean a first
pass to generate these details, and a second pass which actually triggered
the generation process. But then I might also need a third pass, etc. I
suppose the best is to do a sort of modified on-demand, where I generate the
default equivalent directly
|
SchemaMappingDetail | public SchemaMappingDetail(MappingElement map, boolean haschild, boolean hastext, MappingElement base, QName tname, QName oname)(Code) | | Constructor.
Parameters: map - mapping definition Parameters: haschild - has child element(s) flag Parameters: hastext - has child text(s) flag Parameters: base - base mapping for schema type extension Parameters: tname - name as type Parameters: oname - name as element/group/attributeGroup |
getExtensionBase | public MappingElement getExtensionBase()(Code) | | Get base mapping for schema type extension.
extension base |
getOtherName | public QName getOtherName()(Code) | | Get element name.
element name for concrete mapping (null if abstract) |
getSubstitution | public QName getSubstitution()(Code) | | Get substitution group base name.
substitution group base name |
getTypeName | public QName getTypeName()(Code) | | Get name for type.
name |
hasAttribute | public boolean hasAttribute()(Code) | | Check if attribute component present.
flag |
hasChild | public boolean hasChild()(Code) | | Check if child element component present.
flag |
hasText | public boolean hasText()(Code) | | Check if text component present.
flag |
isElement | public boolean isElement()(Code) | | Check if generating as an element.
flag |
isGroup | public boolean isGroup()(Code) | | Check if generating as a group.
flag |
isType | public boolean isType()(Code) | | Check if generating as a group.
flag |
setElement | public void setElement(boolean gen)(Code) | | Set generating as an element.
Parameters: gen - |
setGroup | public void setGroup(boolean gen)(Code) | | Set generating as a group.
Parameters: gen - |
setSubstitution | public void setSubstitution(QName qname)(Code) | | Set substitution group base name.
Parameters: qname - |
setType | public void setType(boolean gen)(Code) | | Set generating as a type.
Parameters: gen - |
|
|