Broken XML in CEGUI tutorial

Issue #1117 resolved
Marvin Gülker
created an issue

Hi everyone,

the section about XML layout in the CEGUI tutorial contains this broken XML:

<?xml version="1.0" ?>
<GUILayout version="4">
    <Window type="DefaultWindow" name="root">
        <Window type="TaharezLook/FrameWindow" name="testWindow">
            <Property name="UnifiedPosition" value="{ {0.25, 0}, {0.25, 0} }" />
            <Property name="UnifiedSize" value="{ {0.5, 0}, {0.5, 0} }" />
            <Property name="Text" value="Hello World!" />
        </Window>
    </Window>
</GUILayout>

"UnifiedPosition" and "UnifiedSize" do not exist. The properties are named "Position" and "Size". Otherwise the following console output results and the window is positioned with default position and default size:

CEGUI::UnknownObjectException in function 'void CEGUI::PropertySet::setProperty(const CEGUI::String&, const CEGUI::String&)' (/home/quintus/Downloads/cegui/cegui/src/PropertySet.cpp:138) : There is no Property named 'UnifiedPosition' available in the set.
CEGUI::UnknownObjectException in function 'void CEGUI::PropertySet::setProperty(const CEGUI::String&, const CEGUI::String&)' (/home/quintus/Downloads/cegui/cegui/src/PropertySet.cpp:138) : There is no Property named 'UnifiedSize' available in the set.

Also, the spaces before the closing /> are unnecessary. I have doubts anybody parses CEGUI XML files with InternetExplorer 6.

Greetings Marvin

Comments (8)

  1. Lukas Meindl

    I have doubts anybody parses CEGUI XML files with InternetExplorer 6.

    I hope nobody looks at CEGUI XML files with their internet explorer or any other explorer at all :D We got CEED after all for this purpose, which is much more powerful ;) (unless you wanna do skinning atm.)

    The tags you mention are empty-element tags : https://www.w3.org/TR/xml/#sec-starttags and it is absolutely correct to use them in the context we use them here. This is valid XML. See self-closing tags: http://www.w3schools.com/xml/xml_elements.asp If you think about it, it also makes more sense for the parser to have code formatted this way, since the parser will know it does not have to expect any closing tags afterwards.

  2. Marvin Gülker reporter

    it is absolutely correct to use them in the context we use them here

    I don’t mean the self-closing tags themselves, I am aware they’re correct there. I only refer to the space between the end of the attribute value and the closing />.The spec declares the space as optional, so from a specification point of view you are correct. It is possible to leave a space there (see Nr. 44 of the spec). However, the reason it has been made optional there is an awkard backward compatibility issue, see here. It has actually to do something with Netscape 4, so IE 6 was actually way too new. Netscape 4 was unable to parse self-closing XHTML tags if they contained no space, so the spec was altered to allow for the space. It appears the space jumped from the XHTML spec to the XML one on some time.

    Since what counts is the spec after all, feel free to leave the space there. It is a fairly unimportant issue that today probably is merely a matter of taste. The nonexisting property names are still a problem, though.

    Greetings Marvin

  3. Paul Turner

    Just for the sake of interest, because I wrote those tutorials...

    Since the tutorials in the documentation are intended to be read by humans, the spaces are there to attempt to aid, as far as possible, people's reading of those XML snippets. Granted, some people would be able to read and comprehend just fine without a space, but equally, others may have better clarity of the things being shown with the space. Overall it's not a big deal.

    Similarly, if spaces exist in the actual data files (can't recall if the XML writing code adds a space or not), it's for a similar reason. Back in the day, we had no tools like CEED, and the files needed to be read and edited by humans... so same reasoning there.

  4. Log in to comment