Any XML Schema experts out there? Options
hartvig
Posted: Thursday, August 17, 2006 9:52:16 AM

Rank: Addict

Joined: 3/17/2008
Posts: 952
Location: Nyborg, Denmark
We need an XML Schema for the umbraco xml format, but it's a long time since I played with schemas so I thought that some one in the community could give me a hand.

The format is very simple: The document element is "root" with no attributes and 0 or more node elements. A node element can have 0 or more node elements and 0 or more data elements. Data elements cannot have children.

More info on the format and the attributes of data and node elements.

Any takers?

Jeeeez, did I really start this :-)
larsbuur
Posted: Thursday, August 17, 2006 10:06:08 AM

Rank: Enthusiast

Joined: 8/2/2006
Posts: 27
Location: Copenhagen, Denmark
Hi Niels,

Altova XML Spy has the ability to create an xml shema file from an example xml file. Afterwards the schema needs some cleaning up - but its well worth it. An example of this can be seen here ->
http://www.myagent.dk/2006/02/umbraco_21_pack.html

I will try to create a schema file - and post it so you and others can test it.

Lars

umbraco entusiast - building a highly customized eCommerce solutions to MBS C5. (Just outside Copenhagen)
larsbuur
Posted: Thursday, August 17, 2006 10:55:50 AM

Rank: Enthusiast

Joined: 8/2/2006
Posts: 27
Location: Copenhagen, Denmark
Hi Niels,

I have <a href="http://www.myagent.dk/2006/08/xml_schema_for_.html">created an xml schema file </a>for the umbraco data xml file. I used the umbraco forum xml file. It validates beautifully with the schema. Please try it out and post any problems :)

Lars

umbraco entusiast - building a highly customized eCommerce solutions to MBS C5. (Just outside Copenhagen)
larsbuur
Posted: Thursday, August 17, 2006 10:56:35 AM

Rank: Enthusiast

Joined: 8/2/2006
Posts: 27
Location: Copenhagen, Denmark
the link button in the post editor seems broken. The link for the xml schema post is:

http://www.myagent.dk/2006/08/xml_schema_for_.html


umbraco entusiast - building a highly customized eCommerce solutions to MBS C5. (Just outside Copenhagen)
kalpa
Posted: Thursday, August 17, 2006 5:22:30 PM

Rank: Fanatic

Joined: 7/19/2006
Posts: 492
Location: Göteborg, Sweden
@Lars -> I don't think it's broken, just out of sync with the new code escaping features recently added by Daniel...

" - Yeah I'd like to share your point of view, as long as it's my view too... (http://www.d-a-d.dk/lyrics/pointofview)
larsbuur
Posted: Thursday, August 17, 2006 7:21:22 PM

Rank: Enthusiast

Joined: 8/2/2006
Posts: 27
Location: Copenhagen, Denmark
that means broken :)

umbraco entusiast - building a highly customized eCommerce solutions to MBS C5. (Just outside Copenhagen)
shana
Posted: Monday, September 04, 2006 2:44:25 PM
Rank: Newbie

Joined: 9/4/2006
Posts: 3
Niels Hartvig wrote:

We need an XML Schema for the umbraco xml format, but it's a long time since I played with schemas so I thought that some one in the community could give me a hand.

The format is very simple: The document element is &quot;root&quot; with no attributes and 0 or more node elements. A node element can have 0 or more node elements and 0 or more data elements. Data elements cannot have children.

More info on the format and the attributes of data and node elements.

Any takers?


Here's a first go, without restrictions and with standard datatypes that could use some refining. Haven't tested it yet. The node and data types are mapped with complexTypes so that the xml cannot have more than one valid starting point. The only valid starting point is &lt;root&gt;.

Code:


&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
&lt;xs:schema xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot;&gt;

  &lt;xs:complexType name=&quot;data&quot; mixed=&quot;true&quot;&gt;
    &lt;xs:sequence&gt;&lt;/xs:sequence&gt;

    &lt;xs:attribute name=&quot;versionID&quot; type=&quot;xs:int&quot; /&gt;
    &lt;xs:attribute name=&quot;alias&quot; type=&quot;xs:string&quot; /&gt;
  &lt;/xs:complexType&gt;

  &lt;xs:complexType name=&quot;node&quot;&gt;
    &lt;xs:sequence&gt;
      &lt;xs:element name=&quot;data&quot; type=&quot;data&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;unbounded&quot;/&gt;
    &lt;/xs:sequence&gt;

    &lt;xs:attribute name=&quot;id&quot; type=&quot;xs:int&quot; /&gt;
    &lt;xs:attribute name=&quot;version&quot; type=&quot;xs:string&quot; /&gt;
    &lt;xs:attribute name=&quot;parentID&quot; type=&quot;xs:int&quot; /&gt;
    &lt;xs:attribute name=&quot;level&quot; type=&quot;xs:int&quot; /&gt;
    &lt;xs:attribute name=&quot;writerID&quot; type=&quot;xs:int&quot; /&gt;
    &lt;xs:attribute name=&quot;nodeType&quot; type=&quot;xs:int&quot; /&gt;
    &lt;xs:attribute name=&quot;template&quot; type=&quot;xs:int&quot; /&gt;
    &lt;xs:attribute name=&quot;sortOrder&quot; type=&quot;xs:int&quot; /&gt;
    &lt;xs:attribute name=&quot;createDate&quot; type=&quot;xs:dateTime&quot; /&gt;
    &lt;xs:attribute name=&quot;updateDate&quot; type=&quot;xs:dateTime&quot; /&gt;
    &lt;xs:attribute name=&quot;nodeName&quot; type=&quot;xs:string&quot; /&gt;
    &lt;xs:attribute name=&quot;urlName&quot; type=&quot;xs:string&quot; /&gt;
    &lt;xs:attribute name=&quot;writerName&quot; type=&quot;xs:int&quot; /&gt;
    &lt;xs:attribute name=&quot;nodeTypeAlias&quot; type=&quot;xs:string&quot; /&gt;
    &lt;xs:attribute name=&quot;path&quot; type=&quot;xs:string&quot; /&gt;

  &lt;/xs:complexType&gt;

 
  &lt;xs:element name=&quot;root&quot;&gt;
    &lt;xs:complexType&gt;
      &lt;xs:sequence&gt;
        &lt;xs:element name=&quot;node&quot; type=&quot;node&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;unbounded&quot;/&gt;
      &lt;/xs:sequence&gt;

      &lt;xs:attribute name=&quot;id&quot; type=&quot;xs:int&quot; use=&quot;required&quot;/&gt;     

    &lt;/xs:complexType&gt;
   
  &lt;/xs:element&gt;
&lt;/xs:schema&gt;



andreia gaita
shana
Posted: Monday, September 04, 2006 3:35:42 PM
Rank: Newbie

Joined: 9/4/2006
Posts: 3
A second version with no attributes in the root and node children in node elements.

Code:

&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
&lt;xs:schema xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot;&gt;

  &lt;xs:complexType name=&quot;data&quot; mixed=&quot;true&quot;&gt;
    &lt;xs:sequence&gt;&lt;/xs:sequence&gt;

    &lt;xs:attribute name=&quot;versionID&quot; type=&quot;xs:int&quot; /&gt;
    &lt;xs:attribute name=&quot;alias&quot; type=&quot;xs:string&quot; /&gt;
  &lt;/xs:complexType&gt;

  &lt;xs:complexType name=&quot;node&quot;&gt;
    &lt;xs:sequence&gt;
      &lt;xs:element name=&quot;node&quot; type=&quot;node&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;unbounded&quot;/&gt;
      &lt;xs:element name=&quot;data&quot; type=&quot;data&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;unbounded&quot;/&gt;
    &lt;/xs:sequence&gt;

    &lt;xs:attribute name=&quot;id&quot; type=&quot;xs:int&quot; /&gt;
    &lt;xs:attribute name=&quot;version&quot; type=&quot;xs:string&quot; /&gt;
    &lt;xs:attribute name=&quot;parentID&quot; type=&quot;xs:int&quot; /&gt;
    &lt;xs:attribute name=&quot;level&quot; type=&quot;xs:int&quot; /&gt;
    &lt;xs:attribute name=&quot;writerID&quot; type=&quot;xs:int&quot; /&gt;
    &lt;xs:attribute name=&quot;nodeType&quot; type=&quot;xs:int&quot; /&gt;
    &lt;xs:attribute name=&quot;template&quot; type=&quot;xs:int&quot; /&gt;
    &lt;xs:attribute name=&quot;sortOrder&quot; type=&quot;xs:int&quot; /&gt;
    &lt;xs:attribute name=&quot;createDate&quot; type=&quot;xs:dateTime&quot; /&gt;
    &lt;xs:attribute name=&quot;updateDate&quot; type=&quot;xs:dateTime&quot; /&gt;
    &lt;xs:attribute name=&quot;nodeName&quot; type=&quot;xs:string&quot; /&gt;
    &lt;xs:attribute name=&quot;urlName&quot; type=&quot;xs:string&quot; /&gt;
    &lt;xs:attribute name=&quot;writerName&quot; type=&quot;xs:int&quot; /&gt;
    &lt;xs:attribute name=&quot;nodeTypeAlias&quot; type=&quot;xs:string&quot; /&gt;
    &lt;xs:attribute name=&quot;path&quot; type=&quot;xs:string&quot; /&gt;

  &lt;/xs:complexType&gt;

 
  &lt;xs:element name=&quot;root&quot;&gt;
    &lt;xs:complexType&gt;
      &lt;xs:sequence&gt;
        &lt;xs:element name=&quot;node&quot; type=&quot;node&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;unbounded&quot;/&gt;
      &lt;/xs:sequence&gt;
    &lt;/xs:complexType&gt;
   
  &lt;/xs:element&gt;
&lt;/xs:schema&gt;




andreia gaita
Users browsing this topic
Guest


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.