Author Topic: Hyperion XML Schema/DTD  (Read 19230 times)

0 Members and 1 Guest are viewing this topic.

Jam Flava

  • Associate
  • Posts: 5
Hyperion XML Schema/DTD
« on: November 21, 2005, 02:57:46 PM »
Hi All,

So, it seems that Hyperion needs a Schema/DTD file to make XML easier to type and validate. I propose a poll to find out which one is perfered.

I know XML Schemas, so my vote goes to that. I can also help write such a file.

Regards,

Saqib

JeGX

  • Global Moderator
  • Capo Crimine
  • *****
  • Posts: 2385
    • oZone3D.Net
Hyperion XML Schema/DTD
« Reply #1 on: November 21, 2005, 03:30:47 PM »
I'm not an expert in dtd/schema but dtd seems to be the standard way to validate xml files. Schemes have been introduced by microsoft and i don't know if they are well supported. From what i read, dtd are simpler to create than schemes.
So I don't know which is the best. I vote for dtd.

satyr

  • Thug
  • *
  • Posts: 23
    • http://www.ozone3d.net
Hyperion XML Schema/DTD
« Reply #2 on: November 21, 2005, 06:48:37 PM »
Sorry I misunderstood the original question (shame on me) however it is a great idea!!

Jam Flava

  • Associate
  • Posts: 5
Hyperion XML Schema/DTD
« Reply #3 on: November 22, 2005, 12:30:01 PM »
no worries satyr. Dont forget to vote.

JeGX: Schema are much more powerful and promote re-use by having an Object Oriented way to specifying the XML structure. and XML Schema is a W3C Standard, and fairly well supported.

Regards,

Saqib

JeGX

  • Global Moderator
  • Capo Crimine
  • *****
  • Posts: 2385
    • oZone3D.Net
Hyperion XML Schema/DTD
« Reply #4 on: November 22, 2005, 01:32:59 PM »
Ok JamFlava, if you have time, could you give a little piece of xml schema with a few Hyperion nodes (such as scene and camera for instance)?
I'm curious to try this with Notepad++ (I hope it can exploit such a file)...

What text editor do you use for coding?

Jam Flava

  • Associate
  • Posts: 5
Hyperion XML Schema/DTD
« Reply #5 on: November 22, 2005, 02:23:58 PM »
ok, i will get started on it.

For XML editing, i am using oXygen: http://www.oxygenxml.com/ and also its Eclipse plugin. But its not free :( My copy is thanks to my work. But for XML Editing, i have so far not found a good Open Source editor.

JeGX

  • Global Moderator
  • Capo Crimine
  • *****
  • Posts: 2385
    • oZone3D.Net
Hyperion XML Schema/DTD
« Reply #6 on: November 22, 2005, 03:14:41 PM »
thx for the test!

Have you tried Notepad++ for xml editing? It's very cool and free.
http://notepad-plus.sourceforge.net/uk/site.htm.

JeGX

  • Global Moderator
  • Capo Crimine
  • *****
  • Posts: 2385
    • oZone3D.Net
Hyperion XML Schema/DTD
« Reply #7 on: November 23, 2005, 04:32:49 PM »
I looked more seriously at DTD and XML Schema and I must say that XML Schema are more powerful and sophisticated than the poor dtd. JamFlava, you were right :wink:
But I didn't find many xml text editor that can use XML schema. At first look, Notepad++ isn't able to use XML Schema. Too bad!

Hereunder, a little XML Schema for Hyperion I coded just for testing. It validates the scene node only. I used the command line tool xmllint (shipped with libxml lib) to check my XML Schema against a hypergraph.

Code: [Select]

<?xml version="1.0" encoding="ISO-8859-1"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" >

<!--
=================================================================================
Hyperion basic types
=================================================================================
-->
<xs:simpleType name="HYP_BOOLEAN">
<xs:restriction base="xs:string">
<xs:enumeration value="TRUE"/>
<xs:enumeration value="FALSE"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="HYP_CLAMPED_REAL">
<xs:restriction base="xs:float">
<xs:minInclusive value="0.0" />
<xs:maxInclusive value="1.0" />
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="HYP_STR63">
<xs:restriction base="xs:string">
<xs:minLength value="0"/>
<xs:maxLength value="63"/>  
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="HYP_STR127">
<xs:restriction base="xs:string">
<xs:minLength value="0"/>
<xs:maxLength value="127"/>  
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="HYP_STR255">
<xs:restriction base="xs:string">
<xs:minLength value="0"/>
<xs:maxLength value="255"/>  
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="HYP_STR4095">
<xs:restriction base="xs:string">
<xs:minLength value="0"/>
<xs:maxLength value="4095"/>  
</xs:restriction>
</xs:simpleType>

<!--
=================================================================================
Hyperion Scene node.
=================================================================================
-->
<xs:element name="scene">
<xs:complexType>
<xs:all>
<xs:element name="background_color" minOccurs="0" maxOccurs="1" >
<xs:complexType>
<xs:attribute name="r" type="HYP_CLAMPED_REAL" use="optional" default="0.0" />
<xs:attribute name="g" type="HYP_CLAMPED_REAL" use="optional" default="0.0" />
<xs:attribute name="b" type="HYP_CLAMPED_REAL" use="optional" default="0.0" />
</xs:complexType>
</xs:element>

<xs:element name="background_image" minOccurs="0" maxOccurs="1" >
<xs:complexType>
<xs:attribute name="image" type="HYP_STR255" use="optional"  />
</xs:complexType>
</xs:element>

<xs:element name="check_hardware_caps" minOccurs="0" maxOccurs="1" >
<xs:complexType>
<xs:attribute name="oglsl" type="HYP_BOOLEAN" use="optional" default="FALSE" />
<xs:attribute name="dot3" type="HYP_BOOLEAN" use="optional" default="FALSE" />
<xs:attribute name="cube_mapping" type="HYP_BOOLEAN" use="optional" default="FALSE" />
<xs:attribute name="vbo" type="HYP_BOOLEAN" use="optional" default="FALSE" />
<xs:attribute name="shader_model_1_1" type="HYP_BOOLEAN" use="optional" default="FALSE" />
<xs:attribute name="shader_model_2_0" type="HYP_BOOLEAN" use="optional" default="FALSE" />
<xs:attribute name="shader_model_3_0" type="HYP_BOOLEAN" use="optional" default="FALSE" />
<xs:attribute name="shader_model_4_0" type="HYP_BOOLEAN" use="optional" default="FALSE" />
<xs:attribute name="s3tc" type="HYP_BOOLEAN" use="optional" default="FALSE" />
<xs:attribute name="nvidia" type="HYP_BOOLEAN" use="optional" default="FALSE" />
<xs:attribute name="ati" type="HYP_BOOLEAN" use="optional" default="FALSE" />
<xs:attribute name="error_message" type="HYP_STR255" use="optional"  />
</xs:complexType>
</xs:element>

<xs:element name="global_ambient_light" minOccurs="0" maxOccurs="1" >
<xs:complexType>
<xs:attribute name="r" type="HYP_CLAMPED_REAL" use="optional" default="0.0" />
<xs:attribute name="g" type="HYP_CLAMPED_REAL" use="optional" default="0.0" />
<xs:attribute name="b" type="HYP_CLAMPED_REAL" use="optional" default="0.0" />
<xs:attribute name="a" type="HYP_CLAMPED_REAL" use="optional" default="1.0" />
</xs:complexType>
</xs:element>

<xs:element name="ref_grid_color" minOccurs="0" maxOccurs="1" >
<xs:complexType>
<xs:attribute name="r" type="HYP_CLAMPED_REAL" use="optional" default="0.0" />
<xs:attribute name="g" type="HYP_CLAMPED_REAL" use="optional" default="0.0" />
<xs:attribute name="b" type="HYP_CLAMPED_REAL" use="optional" default="0.0" />
</xs:complexType>
</xs:element>

<xs:element name="window_size" minOccurs="0" maxOccurs="1" >
<xs:complexType>
<xs:attribute name="width" type="xs:nonNegativeInteger" use="optional" default="1024" />
<xs:attribute name="height" type="xs:nonNegativeInteger" use="optional" default="768" />
</xs:complexType>
</xs:element>

<xs:element name="wait_screen" minOccurs="0" maxOccurs="1" >
<xs:complexType>
<xs:attribute name="image" type="HYP_STR255" use="optional"  />
</xs:complexType>
</xs:element>

<xs:element name="infos" minOccurs="0" maxOccurs="1" >
<xs:complexType>
<xs:attribute name="title" type="HYP_STR127" use="optional"  />
<xs:attribute name="date" type="HYP_STR127" use="optional"  />
<xs:attribute name="author" type="HYP_STR127" use="optional"  />
<xs:attribute name="description" type="HYP_STR4095" use="optional"  />
</xs:complexType>
</xs:element>

<xs:element name="infos_color" minOccurs="0" maxOccurs="1" >
<xs:complexType>
<xs:attribute name="r" type="HYP_CLAMPED_REAL" use="optional" default="0.0" />
<xs:attribute name="g" type="HYP_CLAMPED_REAL" use="optional" default="0.0" />
<xs:attribute name="b" type="HYP_CLAMPED_REAL" use="optional" default="0.0" />
</xs:complexType>
</xs:element>

<xs:element name="nx_gravity" minOccurs="0" maxOccurs="1" >
<xs:complexType>
<xs:attribute name="x" type="xs:float" use="optional" default="0.0" />
<xs:attribute name="y" type="xs:float" use="optional" default="-9.81" />
<xs:attribute name="z" type="xs:float" use="optional" default="0.0" />
</xs:complexType>
</xs:element>

</xs:all>

<xs:attribute name="name" type="HYP_STR127" use="optional" default="myScene" />
<xs:attribute name="archive_filename" type="xs:string" use="optional" />
<xs:attribute name="screenshots_dir" type="xs:string" use="optional" />
<xs:attribute name="warm_up_caches_cycles" type="xs:nonNegativeInteger" use="optional" default="2" />
<xs:attribute name="display_fps" type="HYP_BOOLEAN" use="optional" default="FALSE" />
<xs:attribute name="show_ref_grid" type="HYP_BOOLEAN" use="optional" default="FALSE" />
<xs:attribute name="vsync" type="HYP_BOOLEAN" use="optional" default="TRUE" />
<xs:attribute name="clear_color_buffer" type="HYP_BOOLEAN" use="optional" default="TRUE" />
<xs:attribute name="use_fbo" type="HYP_BOOLEAN" use="optional" default="FALSE" />
<xs:attribute name="nx_physics_simulation" type="HYP_BOOLEAN" use="optional" default="FALSE" />
<xs:attribute name="nx_collision_detection" type="HYP_BOOLEAN" use="optional" default="TRUE" />
<xs:attribute name="display_elapsed_time" type="HYP_BOOLEAN" use="optional" default="FALSE" />
<xs:attribute name="display_texture_memory_occupation" type="HYP_BOOLEAN" use="optional" default="FALSE" />
<xs:attribute name="display_all_statistics" type="HYP_BOOLEAN" use="optional" default="FALSE" />

</xs:complexType>
</xs:element>


<!--
=================================================================================
Hyperion root node.
=================================================================================
-->
<xs:element name="hyperion">
<xs:complexType>
<xs:all>
<xs:element ref="scene" minOccurs="0" maxOccurs="1" />
</xs:all>

<xs:attribute name="version" type="xs:float" use="required" />

</xs:complexType>
</xs:element>

</xs:schema>

Jam Flava

  • Associate
  • Posts: 5
XML Editor
« Reply #8 on: November 24, 2005, 12:49:39 PM »
Hi

wow, that looks very much like my version  of the Schmea...  mine is still not finsihed. but here is what i got...

Code: [Select]


<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
   
    <!-- scene element -->
    <xs:element name="scene">
        <xs:complexType>
            <xs:all>
                <!-- picking element -->
                <xs:element name="picking">
                    <xs:complexType>
                        <xs:attribute name="active" type="hyperion_boolean" default="FALSE"/>
                        <xs:attribute name="script" type="xs:string"/>
                    </xs:complexType>
                </xs:element>
               
                <!-- wait_screen element -->
                <xs:element name="wait_screen">
                    <xs:complexType>
                        <xs:attribute name="image" type="xs:string"/>
                    </xs:complexType>
                </xs:element>
               
                <!-- window_size element -->
                <xs:element name="window_size">
                    <xs:complexType>
                        <xs:attribute name="width" type="xs:int" default="1024"/>
                        <xs:attribute name="height" type="xs:int" default="768"/>
                    </xs:complexType>
                </xs:element>
               
                <!-- infos element -->
                <xs:element name="infos">
                    <xs:complexType>
                        <xs:attribute name="author" type="xs:string"/>
                        <xs:attribute name="date" type="xs:string"/> <!-- should be xs:date type -->
                        <xs:attribute name="title" type="xs:string"/>
                        <xs:attribute name="description" type="xs:string"/>
                    </xs:complexType>
                </xs:element>
               
            </xs:all>
            <xs:attribute name="name" type="xs:string"/>
            <xs:attribute name="archive_filename" type="xs:string"/>
            <xs:attribute name="display_fps" type="hyperion_boolean" default="FALSE"/>
            <xs:attribute name="show_ref_grid" type="hyperion_boolean" default="FALSE"/>
            <xs:attribute name="vsync" type="hyperion_boolean" default="TRUE"/>
            <xs:attribute name="clear_color_buffer" type="hyperion_boolean" default="TRUE"/>
            <xs:attribute name="warm_up_caches_cycles" type="xs:int" default="2"/>
            <xs:attribute name="display_elasped_time" type="hyperion_boolean" default="FALSE"/>
            <xs:attribute name="display_texture_memory_occupation" type="hyperion_boolean" default="FALSE"/>
            <xs:attribute name="display_all_statistics" type="hyperion_boolean" default="FALSE"></xs:attribute>
            <xs:attribute name="screenshots_dir" type="xs:string"/>
            <xs:attribute name="nx_physics_simulation" type="hyperion_boolean" default="FALSE"/>
            <xs:attribute name="nx_collision_detection" type="hyperion_boolean" default="TRUE"/>
        </xs:complexType>
    </xs:element>
   
    <!-- Hyperion Boolean: TRUE or FALSE -->
    <xs:simpleType name="hyperion_boolean">
        <xs:restriction base="xs:string">
            <xs:enumeration value="TRUE"/>
            <xs:enumeration value="FALSE"/>
        </xs:restriction>
    </xs:simpleType>
   
    <!-- color range of a float between 0.0 and 1.0 -->
    <xs:simpleType name="color_value">
        <xs:restriction base="xs:float">
            <xs:minInclusive value="0.0"/>
            <xs:maxInclusive value="1.0"/>
        </xs:restriction>
    </xs:simpleType>
   
    <xs:attributeGroup name="hyperion_color">
        <xs:attribute name="r" type="color_value"/>
        <xs:attribute name="g" type="color_value"/>
        <xs:attribute name="b" type="color_value"/>
        <xs:attribute name="a" type="color_value"/>
    </xs:attributeGroup>
</xs:schema>




agains this one is just for the scene element and still not finished...

And i got a free XML Editor for you: Altova XML Spy Home Edition:

http://www.altova.com/ -> Products -> XMLSpy -> FREE Home Edtion

Seems to cover the basics of XML and Schema.

JeGX

  • Global Moderator
  • Capo Crimine
  • *****
  • Posts: 2385
    • oZone3D.Net
Hyperion XML Schema/DTD
« Reply #9 on: November 24, 2005, 10:05:28 PM »
yeahh! I downloaded xmlspy 2006 home edition and it works very fine. This free version is able to load automatically the schema with xml file and provides auto completion for all elements and attributes! Really cool  :D

Now with that kind of editor, a full w3c xml schema is worth while. So what do we do? Do you want to deal with the whole schema or rather some parts only?

Jam Flava

  • Associate
  • Posts: 5
Hyperion XML Schema/DTD
« Reply #10 on: November 25, 2005, 09:07:55 PM »
good to hear that XML Spy Home is working for you :)

I think it would be good to have a single XML Schema file just to make it easier. However it is also possible to include a Schema within another ala http://www.w3schools.com/schema/el_include.asp

so what we can do is make a single Schema that contains all the common items like the Hyperson Booleans, String types and color values.

Once we have this, we can split up and each develop the other files. And finally link them in once central file.

Have you got Subversion (or CVS), where we can start putting this up?

what do you think.

JeGX

  • Global Moderator
  • Capo Crimine
  • *****
  • Posts: 2385
    • oZone3D.Net
Hyperion XML Schema/DTD
« Reply #11 on: November 26, 2005, 03:46:53 PM »
For a start, a single xml schema file is a good idea. I havn't got cvs or subversion system for the moment. I've just found CVSDude (https://secure.cvsdude.org/) and seems to offer free subversion hosting. I'll glance at it as soon as possible.

JeGX

  • Global Moderator
  • Capo Crimine
  • *****
  • Posts: 2385
    • oZone3D.Net
Hyperion XML Schema/DTD
« Reply #12 on: November 29, 2005, 10:29:55 AM »
Hello JamFlava,
I created an account on CVSDude for hosting our schemas. I send you a PM for more explanation...

Groove

  • Soldier
  • **
  • Posts: 51
    • http://www.g-truc.net
Hyperion XML Schema/DTD
« Reply #13 on: January 03, 2006, 04:36:53 PM »
What do you use to validate XML Schema?

XML Schema is a W3C standard as well.

The other problem is that a few number of library manage XML Schema. Xerces does as MSXML but it wasn't the case of libxml2 when I have used it. May be it is now. (after a quick screach, it seems that libxml2 still doesn't handle XML Schema validation)

mike789

  • Associate
  • Posts: 1
Re: Hyperion XML Schema/DTD
« Reply #14 on: April 07, 2011, 11:45:43 AM »
you can google validation tools and you should be able to find a free online validation tool