IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

Change node type erases all child elements? Options · View
Peter Pei
Posted: Monday, May 12, 2008 5:30:12 PM
Rank: Newbie

Joined: 5/12/2008
Posts: 2
Location: Vancouver
Hi,

In my XSD, I have this element called shipCase:
1) its type is someType1, and
2) it also has bunch of other child elements hanging from it, which are unrelated to shipCaseType.

Now I am trying to change its type to someType2. What I expected is: all those child elements that I mentioned in above point 2 will remain; however what really happened is that they got all erased.

This is annoying. Is there a preference or set up somewhere that lets me to customize this and make it more useful?

Thanks,
Peter Pei
Posted: Monday, May 12, 2008 8:07:52 PM
Rank: Newbie

Joined: 5/12/2008
Posts: 2
Location: Vancouver
To make it simpler and less specific, I made up the following XSD:
Code:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xs:element name="root">
        <xs:annotation>
            <xs:documentation>Comment describing your root element</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element name="someChild">
                    <xs:complexType>
                        <xs:complexContent>
                            <xs:extension base="someType1">
                                <xs:sequence>
                                    <xs:element name="someGrandChild"/>
                                </xs:sequence>
                            </xs:extension>
                        </xs:complexContent>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:complexType name="someType1"/>
    <xs:complexType name="someType2"/>
</xs:schema>

As you can see, node someChild has type someType1, and it has a child someGrandChild. Now if I switch someChild's type from someType1 to someType2 from the GUI tool, node someGrandCHild is erased:
Code:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xs:element name="root">
        <xs:annotation>
            <xs:documentation>Comment describing your root element</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element name="someChild" type="someType2"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:complexType name="someType1"/>
    <xs:complexType name="someType2"/>
</xs:schema>

Obviously I can go to the text view of the XSD and switch the type myself by change one character from 1 to 2, the XSD is still valid:
Code:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xs:element name="root">
        <xs:annotation>
            <xs:documentation>Comment describing your root element</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element name="someChild">
                    <xs:complexType>
                        <xs:complexContent>
                            <xs:extension base="someType2">
                                <xs:sequence>
                                    <xs:element name="someGrandChild"/>
                                </xs:sequence>
                            </xs:extension>
                        </xs:complexContent>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:complexType name="someType1"/>
    <xs:complexType name="someType2"/>
</xs:schema>

However I should not have to do this myself, and the GUI interface should handle this properly for me.
Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.