Groups and global elements

This should cover W3C XML Schema, Relax NG and DTD related problems.
RigdenWannaBe
Posts: 1
Joined: Thu Feb 10, 2005 10:44 pm
Location: Eastern Mass.

Groups and global elements

Post by RigdenWannaBe »

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

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>
And here is the using code. Delete everything and start from < to get groupContainer

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>
:!: :arrow: :!:
Respond to:
replasce WER with TZ4125
jkWER@msn.com
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi,

Thanks, indeed there is a problem in determining all the possible elements defined by the schema when the new elements are defined locally different local elements having the same name. We will fix that. A workaround: if you add
<xs:element name="ShouldNotAppearInPickList"/>
to your schema then the content completion will offer the ShouldNotAppearInPickList element inside XYZParent/groupContainer/XYZ.

Best Regards,
George
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi,

FYI this was just fixed in CVS. the fix will be available in the next release.

Best Regards,
George
Post Reply