|
From: <net...@us...> - 2010-11-01 21:14:37
|
Revision: 64
http://openautomation.svn.sourceforge.net/openautomation/?rev=64&view=rev
Author: netzkind
Date: 2010-11-01 21:14:31 +0000 (Mon, 01 Nov 2010)
Log Message:
-----------
Added XML-Schema/XSD to validate config-XML
Modified Paths:
--------------
CometVisu/trunk/ChangeLog
Added Paths:
-----------
CometVisu/trunk/visu/visu_config.xsd
Modified: CometVisu/trunk/ChangeLog
===================================================================
--- CometVisu/trunk/ChangeLog 2010-11-01 17:37:41 UTC (rev 63)
+++ CometVisu/trunk/ChangeLog 2010-11-01 21:14:31 UTC (rev 64)
@@ -8,6 +8,7 @@
- New Feature: tag for "line" break
- New Feature: tag for images
- New Feature: <text> has new optional attribute "align"
+- Added XML Schema / XSD to validate config-XML
0.5.0
=====
Added: CometVisu/trunk/visu/visu_config.xsd
===================================================================
--- CometVisu/trunk/visu/visu_config.xsd (rev 0)
+++ CometVisu/trunk/visu/visu_config.xsd 2010-11-01 21:14:31 UTC (rev 64)
@@ -0,0 +1,191 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+<!-- basic types -->
+<xsd:simpleType name="address">
+ <xsd:restriction base="xsd:string">
+ <xsd:pattern value="[0-9]{1,2}/[0-9]{1,2}/[0-9]{1,2}" />
+ </xsd:restriction>
+</xsd:simpleType>
+
+<xsd:simpleType name="dimension">
+ <xsd:restriction base="xsd:string" />
+</xsd:simpleType>
+<xsd:simpleType name="uri">
+ <xsd:restriction base="xsd:string" />
+</xsd:simpleType>
+
+<xsd:complexType name="entry">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute ref="value" use="required" />
+ </xsd:extension>
+ </xsd:simpleContent>
+</xsd:complexType>
+
+<!-- simple elements -->
+
+
+<!-- attributes -->
+<xsd:attribute name="address" type="address" />
+<xsd:attribute name="datatype" type="xsd:decimal" />
+<xsd:attribute name="response_address" type="address" />
+<xsd:attribute name="response_datatype" type="xsd:decimal" />
+
+<xsd:attribute name="pre" type="xsd:string" />
+<xsd:attribute name="post" type="xsd:string" />
+
+<xsd:attribute name="min" type="xsd:decimal" />
+<xsd:attribute name="max" type="xsd:decimal" />
+<xsd:attribute name="step" type="xsd:decimal" />
+
+<xsd:attribute name="mapping" type="xsd:string" />
+<xsd:attribute name="style" type="xsd:string" />
+<xsd:attribute name="value" type="xsd:string" />
+
+<!-- complex elements -->
+<xsd:element name="pages">
+ <xsd:complexType>
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element ref="mappings" />
+ <xsd:element ref="styles" />
+ <xsd:element ref="page" minOccurs="1" />
+ </xsd:choice>
+ </xsd:complexType>
+</xsd:element>
+
+<xsd:element name="mappings">
+ <xsd:complexType>
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element ref="mapping" />
+ </xsd:choice>
+ </xsd:complexType>
+</xsd:element>
+
+<xsd:element name="mapping">
+ <xsd:complexType>
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="entry" type="entry" minOccurs="1" />
+ </xsd:choice>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+</xsd:element>
+
+<xsd:element name="styles">
+ <xsd:complexType>
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element ref="style" />
+ </xsd:choice>
+ </xsd:complexType>
+</xsd:element>
+
+<xsd:element name="style">
+ <xsd:complexType>
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="entry" type="entry" minOccurs="1" />
+ </xsd:choice>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+</xsd:element>
+
+<!-- define a page - if you add a new widget, you need to list it here -->
+<xsd:element name="page">
+ <xsd:complexType>
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <!-- list all possbile widgets here -->
+ <xsd:element name="text" type="xsd:string" />
+ <xsd:element name="line" type="line" />
+ <xsd:element name="switch" type="switch" />
+ <xsd:element name="toggle" type="switch" />
+ <xsd:element name="trigger" type="trigger" />
+ <xsd:element name="dim" type="dim" />
+ <xsd:element name="slider" type="dim" />
+ <xsd:element name="info" type="info" />
+ <xsd:element name="shade" type="info" />
+ <xsd:element name="image" type="image" />
+ <xsd:element name="break" type="break" />
+ <xsd:element ref="page" />
+ </xsd:choice>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+</xsd:element>
+
+<!-- more fun part - all widgets - if you add a new widget, you need to define it here -->
+
+<xsd:complexType name="switch">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute ref="address" use="required" />
+ <xsd:attribute ref="datatype" use="required" />
+ <xsd:attribute ref="response_address" use="required" />
+ <xsd:attribute ref="response_datatype" use="required" />
+ <xsd:attribute ref="pre" />
+ <xsd:attribute ref="post" />
+ <xsd:attribute ref="mapping" />
+ <xsd:attribute ref="style" />
+ </xsd:extension>
+ </xsd:simpleContent>
+</xsd:complexType>
+
+
+<xsd:complexType name="trigger">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute ref="address" use="required" />
+ <xsd:attribute ref="datatype" use="required" />
+ <xsd:attribute ref="value" use="required" />
+ <xsd:attribute ref="pre" />
+ <xsd:attribute ref="post" />
+ <xsd:attribute ref="mapping" />
+ <xsd:attribute ref="style" />
+ </xsd:extension>
+ </xsd:simpleContent>
+</xsd:complexType>
+
+<xsd:complexType name="dim">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute ref="address" use="required" />
+ <xsd:attribute ref="datatype" use="required" />
+ <xsd:attribute ref="response_address" use="required" />
+ <xsd:attribute ref="response_datatype" use="required" />
+ <xsd:attribute ref="min" />
+ <xsd:attribute ref="max" />
+ <xsd:attribute ref="step" />
+ <xsd:attribute ref="mapping" />
+ <xsd:attribute ref="style" />
+ </xsd:extension>
+ </xsd:simpleContent>
+</xsd:complexType>
+
+<xsd:complexType name="info">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute ref="address" use="required" />
+ <xsd:attribute ref="datatype" use="required" />
+ <xsd:attribute ref="pre" />
+ <xsd:attribute ref="post" />
+ <xsd:attribute ref="mapping" />
+ <xsd:attribute ref="style" />
+ </xsd:extension>
+ </xsd:simpleContent>
+</xsd:complexType>
+
+<xsd:complexType name="image">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="src" type="uri" use="required" />
+ <xsd:attribute name="width" type="dimension" />
+ <xsd:attribute name="height" type="dimension" />
+ </xsd:extension>
+ </xsd:simpleContent>
+</xsd:complexType>
+
+<xsd:complexType name="break" />
+<xsd:complexType name="line" />
+
+<!-- toggle is not yet implemented -->
+<!-- shade is not yet implemented -->
+<!-- slider is not yet implemented -->
+
+</xsd:schema>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|