|
|
|
| is it possible to a complex type with attribute pointing to another member
of teh 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
| |
| S. Huseyin Ulger 2007-03-29, 11:16 pm |
| No you can not do that. Attribute's type attribute(if present) should
reference to global (or build in like xsd:string) simple type. Also
<attributeGroup> in context of a <complexType> can only be a reference to a
global <attributeGroup>
You can find more info at
http://www.w3.org/TR/xmlschema-1/#e...-attributeGroup
--
S. Huseyin Ulger [MSFT]
MSXML Dev
"GS" wrote:
> is it possible to a complex type with attribute pointing to another member
> of teh 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
>
>
>
>
>
| |
|
| thx.
I tried changing regexName to element instead of attribute in the complex
type and VStudio seems to accept that
you are definitely right that it still does not conform to w3 spec as
witnessed by the rejection by netbean 5.5 IDE
Netbean does accept something like this
<xsd:group name="RegexCollection">
<xsd:sequence>
...
<xsd:element ref="comment" />
<xsd:element name="regexType" type="RegexTypes" />
<xsd:element name="nextRegexLink" type="regexNameType" />
</xsd:sequence>
</xsd:group>
<xsd:complexType name="regexNameType">
<xsd:sequence>
<xsd:unique name="item-name-uniqueness">
<xsd:selector xpath="item" />
<xsd:field xpath="name" />
</xsd:unique>
<xsd:element name="regexNameBase" type="xsd:Name" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="RegexTypes">
<xsd:sequence>
<xsd:element name="regexName" type="regexNameType" />
...
</xsd:sequence>
</xsd:complexType>
I tired to effect the same orginal end result by specifying uniqueness on
the complexType regexNameType
|
|
|
|
| Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |