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.

Profile: Peter Pei
About
User Name: Peter Pei
Forum Rank: Newbie
Real Name:
Location Vancouver
Occupation:
Interests:
Gender: None Specified
Statistics
Joined: Monday, May 12, 2008
Last Visit: Tuesday, May 13, 2008 3:48:11 PM
Number of Posts: 2
[0.01% of all post / 0.00 posts per day]
Avatar
Last 10 Posts
Topic: Change node type erases all child elements?
Posted: Monday, May 12, 2008 8:07:52 PM
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.
Topic: Change node type erases all child elements?
Posted: Monday, May 12, 2008 5:30:12 PM
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,

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