G
gg
is it possible to have a complex type with attribute pointing to another
member
of the complex type?
for example, I tried
<xsd:complexType name="RegexTypes" />
<xsd:sequence>
<xsd:element name="regexName" type="xsd:Name" />
<xsd:element ref="comment" />
</xsd:sequence>
<xsd:attribute name="level" type="xsd:string" />
...
<xsd:attributeGroup ref="RegexTypes">
<!-- error on next line's xsd:attribute, same for replacing with
element -->
<xsd:attribute name="nextRegexLink" type="regexName" minOccurs="0"
maxOccurs="unbounded" />
</xsd:attributeGroup>
</xsd:complexType>
</xsd:complexType>
<xsd:element name="comment" type="xsd:string">
</xsd:element>
and I get:
Warning 2 The element 'attributeGroup' in namespace
'http://www.w3.org/2001/XMLSchema' has invalid child element 'attribute' in
namespace 'http://www.w3.org/2001/XMLSchema'. List of possible elements
expected: 'annotation' in namespace 'http://www.w3.org/2001/XMLSchema'.
D:\data\Ieproj\Util\RegexDotNet\regex.xsd 34 8 Miscellaneous Files
Warning 1 The 'http://www.w3.org/2001/XMLSchema:attribute' element is not
supported in this context. D:\data\Ieproj\Util\RegexDotNet\regex.xsd 34 8
Miscellaneous Files
I tried another approach that seem to be acceptable to ms visual studio but
not to NetBean IDE 5.5:
<xsd:group name="RegexCollection">
<xsd:sequence>
<xsd:element name="favorite" type="xsd:string" />
..............
<xsd:element ref="comment" />
<xsd:element name="regexType" type="RegexTypes" />
<xsd:element name="nextRegexLink" type="regexName" minOccurs="0"
maxOccurs="unbounded" />
</xsd:sequence>
</xsd:group>
<xsd:complexType name="RegexTypes">
<xsd:sequence>
<xsd:element name="regexName" type="xsd:Name" />
<xsd:element ref="comment" />
</xsd:sequence>
.............
</xsd:complexType>
src-resolve: Cannot resolve the name 'regexName' to a(n) 'type definition'
component. [47]
XML validation finished.
member
of the complex type?
for example, I tried
<xsd:complexType name="RegexTypes" />
<xsd:sequence>
<xsd:element name="regexName" type="xsd:Name" />
<xsd:element ref="comment" />
</xsd:sequence>
<xsd:attribute name="level" type="xsd:string" />
...
<xsd:attributeGroup ref="RegexTypes">
<!-- error on next line's xsd:attribute, same for replacing with
element -->
<xsd:attribute name="nextRegexLink" type="regexName" minOccurs="0"
maxOccurs="unbounded" />
</xsd:attributeGroup>
</xsd:complexType>
</xsd:complexType>
<xsd:element name="comment" type="xsd:string">
</xsd:element>
and I get:
Warning 2 The element 'attributeGroup' in namespace
'http://www.w3.org/2001/XMLSchema' has invalid child element 'attribute' in
namespace 'http://www.w3.org/2001/XMLSchema'. List of possible elements
expected: 'annotation' in namespace 'http://www.w3.org/2001/XMLSchema'.
D:\data\Ieproj\Util\RegexDotNet\regex.xsd 34 8 Miscellaneous Files
Warning 1 The 'http://www.w3.org/2001/XMLSchema:attribute' element is not
supported in this context. D:\data\Ieproj\Util\RegexDotNet\regex.xsd 34 8
Miscellaneous Files
I tried another approach that seem to be acceptable to ms visual studio but
not to NetBean IDE 5.5:
<xsd:group name="RegexCollection">
<xsd:sequence>
<xsd:element name="favorite" type="xsd:string" />
..............
<xsd:element ref="comment" />
<xsd:element name="regexType" type="RegexTypes" />
<xsd:element name="nextRegexLink" type="regexName" minOccurs="0"
maxOccurs="unbounded" />
</xsd:sequence>
</xsd:group>
<xsd:complexType name="RegexTypes">
<xsd:sequence>
<xsd:element name="regexName" type="xsd:Name" />
<xsd:element ref="comment" />
</xsd:sequence>
.............
</xsd:complexType>
src-resolve: Cannot resolve the name 'regexName' to a(n) 'type definition'
component. [47]
XML validation finished.