Groups and global elements
Posted: Thu Feb 10, 2005 10:58 pm
Having a problem with this code. The problem is that I have a global Group that contains an element with the same name (XYZ) as a global element (XYZ).
The problem is that the Tag-Insight does not always pick the correct child node. You'd expect that in the element 'groupContainer,' the Group's XYZ->SHouldNotAppearInPickList. would appear (ignore its name) in the choices for children of the groupContainer->XYZ node. Yet it does not.
In my real code, I'm actually getting the reverse problem. In my element which references a "UniBar" element, I'm only being offered the choices in a global group's UniBar element child, not the choices in the global element'schildren.
P.S: Your Viennese competitor does not have this problem
Here's the XSD
And here is the using code. Delete everything and start from < to get groupContainer
The problem is that the Tag-Insight does not always pick the correct child node. You'd expect that in the element 'groupContainer,' the Group's XYZ->SHouldNotAppearInPickList. would appear (ignore its name) in the choices for children of the groupContainer->XYZ node. Yet it does not.
In my real code, I'm actually getting the reverse problem. In my element which references a "UniBar" element, I'm only being offered the choices in a global group's UniBar element child, not the choices in the global element'schildren.
P.S: Your Viennese competitor does not have this problem
Here's the XSD
Code: Select all
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="grouptest" xmlns="grouptest" elementFormDefault="qualified">
<xs:element name="XYZParent">
<xs:complexType>
<xs:sequence>
<xs:element name="groupContainer">
<xs:complexType>
<xs:sequence>
<xs:group ref="globalGroup"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element ref="XYZ" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Global Types -->
<xs:group name="globalGroup">
<xs:sequence>
<xs:element name="XYZ" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="ShouldNotAppearInPickList" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:group>
<xs:element name="XYZ">
<xs:complexType>
<xs:sequence>
<xs:element name="ShouldAppearInPickList" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<XYZParent xmlns="grouptest" elementFormDefault="qualified" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="grouptest ./GlobalGroups.xsd">
<groupContainer><XYZ></XYZ></groupContainer>
<XYZ><ShouldAppearInPickList></ShouldAppearInPickList></XYZ>
</XYZParent>