Shoutbox

Schema for Interfaces - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: WLM Plus! General (/forumdisplay.php?fid=23)
+----- Thread: Schema for Interfaces (/showthread.php?tid=95537)

Schema for Interfaces by effection on 10-02-2010 at 11:06 AM

It seems to me this schema doc is pretty inaccurate and not very user friendly for checking against the schema in the end (every plus script i try to check fails for simple little things).

For example

code:

<xs:element name="BottomBar" minOccurs="0">
    <xs:complexType>
        <xs:sequence>
            <xs:choice>

                <xs:element name="LeftControls" minOccurs="0">
                    <xs:complexType>
                        <xs:sequence minOccurs="0" maxOccurs="unbounded">
                            <xs:element name="Margin" type="xs:unsignedInt" default="10" minOccurs="0">
                                <xs:annotation>
                                    <xs:documentation>Adjusts the space between this button and the last one.</xs:documentation>
                                </xs:annotation>
                            </xs:element>
                            <xs:element name="Control" type="pli:Control"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:choice>
            <xs:choice>

                <xs:element name="RightControls" minOccurs="0">
                    <xs:complexType>
                        <xs:sequence minOccurs="0" maxOccurs="unbounded">
                            <xs:element name="Margin" type="xs:unsignedInt" default="10" minOccurs="0">
                                <xs:annotation>
                                    <xs:documentation>Adjusts the space between this button and the next one.</xs:documentation>
                                </xs:annotation>
                            </xs:element>
                            <xs:element name="Control" type="pli:Control"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:choice>
        </xs:sequence>

        <xs:attribute name="Style" use="required">
            <xs:annotation>
                <xs:documentation>Changes the look of the bottom bar.</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:enumeration value="None"/>
                    <xs:enumeration value="Plain"/>
                    <xs:enumeration value="Light"/>
                    <xs:enumeration value="Default"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
    </xs:complexType>
</xs:element>


As you can see in this code the types "LeftControl" and "RightControl" are in SEPARATE blocks "Choice". Now this is obviously inccorrect because you CAN have either LeftControl or RightControl or both within the "BottomBar" object and Plus parses it fine. Now the way that is laid out is fine because you can have both (they are in separate choice blocks) but when it comes to using this schema it messes up certain things (relating to my IDE for Plus! in the end) so this object should have the "Choice" tags removed.

This is only one example which is making my life more difficult in making an Development Environment for everyone here.

There are many more such as objects being marked as use="optional" or having a default attribute (makes them optional) or having no attribute (also makes them optional) when some are actually required elements (as far as i can remember).

On top of this most complexTypes are using "sequence" tags which means, All types within the sequence must appear in the same order as defined within the schema. Now when Plus! parses a file it doesn't care what order they are in! At least on most objects it doesn't care. All of them should use "<all>" instead of "sequence" as it allows for any order.

The reason i bring this up is that if i change these to be more inkeeping with what the actual Plus! engine does and then there is eventually a new update to the schema not taking into account my changes it will become a nightmare to go and change all of these again.

It would be nice if someone with some xsd knowledge would help to go through and fix a lot of it but only if Patchou would commit these changes
RE: Schema for Interfaces by matty on 10-08-2010 at 11:25 AM

Hey effection,

I had Patchou fix a bug in the schema and he also fixed yours.

Here is his email response:

Fixed.

Although the way it was written wouldn't have prevented any valid xml to be parsed, it was just a useless additional condition.

As for having "many more" of those, I wouldn't bet on it. Even if Plus! Parses something, if I set it as optional or required in the schema, it's because I have a reason. Go against your schema and you go against the internal design choices of Messenger Plus!. Having said that, if there are other known problems or incoherence in the schema, I'll gladly fix them :).


RE: Schema for Interfaces by effection on 10-09-2010 at 04:20 PM

I'll have another look at the XML and the C# files it produces this week and try to pick out other things. Basically i want to make sure that all required fields are definitely required. I have written a tool (based off xsd.exe) to do custom serialization on all optional fields so that if its the default value the xml doesn't get unnecessarily written to the file. For now it should be fine as long as the <choice> tags are fixed