};
+type record length(3) of XSD.String ElementWithList2 length(4)
+with {
+ variant "list";
+ variant "element";
+};
+
+
type record ChoiceWithList
{
union {
};
+type record ChoiceWithList2
+{
+ union {
+ record length(3) of XSD.Float element1,
+ record of XSD.String element2,
+ record length(3) of XSD.String element3 length(4)
+ } choice
+}
+with {
+ variant (choice) "untagged";
+ variant (choice.element1) "name as capitalized";
+ variant (choice.element1) "list";
+ variant (choice.element2) "name as capitalized";
+ variant (choice.element2) "list";
+ variant (choice.element3) "name as capitalized";
+ variant (choice.element3) "list";
+};
+
+
type XSD.Token Ipv4 (pattern "IPV4")
with {
variant "name as uncapitalized";
import from XSD all;
+type record length(3) of XSD.String ListLength length(4)
+with {
+ variant "name as uncapitalized";
+ variant "list";
+};
+
+
type record of enumerated
{
orange,
};
+type record length(3) of XSD.Float ElementWithList
+with {
+ variant "list";
+ variant "element";
+};
+
+
}
with {
encode "XML";
</xs:simpleType>
</xs:element>
+<xs:element name="ElementWithList2">
+ <xs:simpleType>
+ <xs:restriction>
+ <xs:simpleType>
+ <xs:list>
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:length value="4" />
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:list>
+ </xs:simpleType>
+ <xs:minLength value="3" />
+ <xs:maxLength value="3" />
+ </xs:restriction>
+ </xs:simpleType>
+</xs:element>
+
<xs:complexType name="ChoiceWithList">
<xs:choice>
<xs:element name="Element1">
</xs:choice>
</xs:complexType>
+<xs:complexType name="ChoiceWithList2">
+ <xs:choice>
+ <xs:element name="Element1">
+ <xs:simpleType>
+ <xs:restriction>
+ <xs:simpleType>
+ <xs:list itemType="xs:float" />
+ </xs:simpleType>
+ <xs:minLength value="3" />
+ <xs:maxLength value="3" />
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ <xs:element name="Element2">
+ <xs:simpleType>
+ <xs:list itemType="xs:string" />
+ </xs:simpleType>
+ </xs:element>
+ <xs:element name="Element3">
+ <xs:simpleType>
+ <xs:restriction>
+ <xs:simpleType>
+ <xs:list>
+ <xs:simpleType>
+ <xs:restriction base="string">
+ <xs:length value="4" />
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:list>
+ </xs:simpleType>
+ <xs:minLength value="3" />
+ <xs:maxLength value="3" />
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ </xs:choice>
+</xs:complexType>
+
<xs:simpleType name="ipv4">
<xs:restriction base="xs:token">
<xs:pattern value="IPV4"/>
xmlns:this="www.example.org/list/simpletype"
targetNamespace="www.example.org/list/simpletype">
+<xsd:simpleType name="listLength">
+ <xsd:restriction>
+ <xsd:simpleType>
+ <xsd:list>
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:length value="4" />
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:list>
+ </xsd:simpleType>
+ <xsd:length value="3"/>
+ </xsd:restriction>
+</xsd:simpleType>
+
<xsd:element name="SimpleListEnumeration">
<xsd:simpleType>
<xsd:list>
</xsd:complexType>
</xsd:element>
+<xsd:element name="ElementWithList">
+ <xsd:simpleType>
+ <xsd:restriction>
+ <xsd:simpleType>
+ <xsd:list itemType="xsd:float" />
+ </xsd:simpleType>
+ <xsd:minLength value="3" />
+ <xsd:maxLength value="3" />
+ </xsd:restriction>
+ </xsd:simpleType>
+</xsd:element>
, fromAll(false)
, max_alt(0)
, skipback(0)
-, list(false)
, lastType()
, actualPath(empty_string)
, actfield(this)
, fromAll(other.fromAll)
, max_alt(other.max_alt)
, skipback(other.skipback)
-, list(other.list)
, lastType(other.lastType)
, actualPath(other.actualPath)
, actfield(this)
, fromAll(false)
, max_alt(0)
, skipback(0)
-, list(false)
, lastType()
, actualPath(empty_string)
, actfield(this)
, fromAll(false)
, max_alt(0)
, skipback(0)
-, list(false)
, lastType()
, actualPath(empty_string)
, actfield(this)
complexfields.push_back(f);
basefield = f;
actfield = f;
+
+ // If it is a restriction of a list, then no new basefield will be
+ // present, to we apply the references to the parent.
+ if(parent != NULL && parent->inList) {
+ parent->applyReference(*f, true);
+ }
} else if (cmode == CT_complextype_mode) {
setReference(atts.base);
xsdtype = n_restriction;
break;
case n_list:
if (parent != NULL && parent->basefield == this) {
- parent->list = true;
+ parent->inList = true;
parent->SimpleType::loadWithValues();
parent->basefield = NULL;
setInvisible();
- break;
+ } else if(parent != NULL) {
+ SimpleType::loadWithValues();
}
+ break;
case n_length:
case n_minLength:
case n_maxLength:
skipback = skipback - 1;
}
- //embedded simpletype with list in element
- if(xsdtype == n_simpleType && list) {
- list = false;
- return;
- }
-
if ( parent != NULL &&
(xsdtype == n_element ||
xsdtype == n_attributeGroup ||
xsdtype == n_extension ||
xsdtype == n_restriction ||
- (xsdtype == n_simpleType && !list) ||
+ (xsdtype == n_simpleType && !inList) ||
xsdtype == n_simpleContent ||
(xsdtype == n_sequence && skipback < 0)
)) {
parent->lastType = xsdtype;
}
}
+ if (xsdtype == n_simpleType) {
+ inList = false;
+ }
}
void ComplexType::referenceResolving() {
addNameSpaceAsVariant(this, ct);
}
if(!basefield->parent->top){
- applyReference(*basefield, true);
+ // This is the case of restriction -> list -> simpletype -> restriction
+ // we have to apply the reference to the parent's parent.
+ if(basefield->parent->parent != NULL && !basefield->parent->isVisible()) {
+ basefield->parent->parent->applyReference(*basefield, true);
+ } else {
+ applyReference(*basefield, true);
+ }
basefield->setInvisible();
}
}
bool fromAll;
unsigned max_alt;
int skipback;
- //Special use: true if an element of a complextype is restricted to a list
- // in a simpletype
- bool list;
TagName lastType;
Mstring actualPath;
RootType * actfield;
, typeSubsGroup(NULL)
, addedToTypeSubstitution(false)
, block(not_set)
+, inList(false)
, parent(NULL) {
}
, typeSubsGroup(other.typeSubsGroup)
, addedToTypeSubstitution(other.addedToTypeSubstitution)
, block(other.block)
+, inList(other.inList)
, parent(NULL) {
length.parent = this;
pattern.parent = this;
setMaxOccurs(ULLONG_MAX);
addVariant(V_list);
mode = listMode;
+ inList = true;
break;
case n_union:
{ // generating complextype from simpletype
break;
}
case n_length:
- if (mode == listMode) {
+ if (inList && (xsdtype != n_NOTSET || mode == restrictionAfterListMode)) {
setMinOccurs(strtoull(atts.value.c_str(), NULL, 0));
setMaxOccurs(strtoull(atts.value.c_str(), NULL, 0));
break;
length.modified = true;
break;
case n_minLength:
- if (mode == listMode) {
+ if (inList && (xsdtype != n_NOTSET || mode == restrictionAfterListMode)) {
setMinOccurs(strtoull(atts.value.c_str(), NULL, 0));
break;
}
length.modified = true;
break;
case n_maxLength:
- if (mode == listMode) {
+ if (inList && (xsdtype != n_NOTSET || mode == restrictionAfterListMode)) {
setMaxOccurs(strtoull(atts.value.c_str(), NULL, 0));
break;
}
if (construct == c_element)
return;
- if (mode == listMode)
+ if (mode == listMode || mode == restrictionAfterListMode)
return;
if (!found_ST->builtInBase.empty()) {
value.applyReference(found_ST->value);
mode = found_ST->mode;
- if (found_ST->mode != listMode) {
+ if (found_ST->mode != listMode && found_ST->mode != restrictionAfterListMode) {
type.upload(found_ST->getType().convertedValue);
}
}
, upper(ULLONG_MAX) {
}
-void LengthType::applyReference(const LengthType & other) {
+void LengthType::applyReference(const LengthType & other) {
if (!modified) modified = other.modified;
if (other.facet_minLength > facet_minLength) facet_minLength = other.facet_minLength;
if (other.facet_maxLength < facet_maxLength) facet_maxLength = other.facet_maxLength;
}
case SimpleType::extensionMode:
case SimpleType::listMode:
+ case SimpleType::restrictionAfterListMode:
lower = facet_minLength;
upper = facet_maxLength;
break;
fputc(')', file);
}
+
noMode,
restrictionMode,
extensionMode,
- listMode
+ listMode,
+ restrictionAfterListMode
};
protected:
bool addedToTypeSubstitution;
BlockValue block;
+ //Special use: true if an element of a complexType is restricted to a list
+ // in a simpleType, or a simpleType is a restriction of a list, which is a
+ // restriction of a simpleType
+ bool inList;
+ // We are inside a list if inList is true and mode == listMode
+
//Element substitution
void addToSubstitutions();
return block;
}
+ void setList(const bool value) {
+ inList = value;
+ }
+
void addToNameDepList(SimpleType * t) {
//If the type has a substitution, we add the namedep to the substitution
if(subsGroup != NULL && this != (SimpleType*)subsGroup){
};
#endif /* SIMPLETYPE_H_ */
+
tag == n_documentation){
inside_annotation.pop_back();
}
-
+
+ if(tag == n_list) {
+ if(module->hasDefinedMainType()) {
+ SimpleType& st = (SimpleType&)(module->getLastMainType());
+ if(st.getXsdtype() == n_NOTSET){
+ st.setMode(SimpleType::restrictionAfterListMode);
+ }
+ }
+ }
--actualDepth;
if (actualDepth == 0 || actualDepth == 1) {
}
}
}
+