changeset 9:5899df8c289e

DOM schema
author Sergey
date Thu, 27 Aug 2009 17:49:42 +0400
parents fffb153be599
children 63f6653b094e
files Lib/IMPL/DOM/Schema/ComplexNode.pm _test/Resources/test.form _test/Resources/test.schema
diffstat 3 files changed, 31 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/Lib/IMPL/DOM/Schema/ComplexNode.pm	Tue Aug 25 17:36:37 2009 +0400
+++ b/Lib/IMPL/DOM/Schema/ComplexNode.pm	Thu Aug 27 17:49:42 2009 +0400
@@ -6,7 +6,6 @@
 use IMPL::Class::Property;
 
 BEGIN {
-    public property nodeType => prop_all;
     public property content => {
         get => \&_getContent,
         set => \&_setContent
@@ -55,11 +54,6 @@
 
 =over
 
-=item C<nodeType>
-
-Тип описанный в схеме, экземпляром которого является данный узел. При этом
-свойство C<content> должно быть пустым.
-
 =item C<content>
 
 Содержимое узла, может быть либо C<IMPL::DOM::Schema::NodeSet> либо
--- a/_test/Resources/test.form	Tue Aug 25 17:36:37 2009 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-<form>
-    <name>Peter</name>
-    <passport>
-        <code>sssddd-ffd-ssd</code>
-    </passport>
-    <passport>
-        <code></code>
-    </passport>
-</form>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/_test/Resources/test.schema	Thu Aug 27 17:49:42 2009 +0400
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<schema>
+    <Include src="basic.types.schema"/>
+    <TypeNodeMapping>
+        <ListBox type="IMPL::Web::Control::ListBox"/>
+        <RadioList type="IMPL::Web::Control::RadioList"/>
+        <EditBox type="IMPL::Web::Control::EditBox"/>
+        <DateTimeBox type="IMPL::Web::Control::EditBox"/>
+    </TypeNodeMapping>
+    <ComplexNode nodeName="Form">
+        <NodeSet>
+            <SimpleNode nodeName="FirstName">
+                <Regexp>\w+</Regexp>
+            </SimpleNode>
+            <SimpleNode nodeName="LastName">
+                <Regexp>\w+</Regexp>
+            </SimpleNode>
+            <TypeNode nodeName="BirthDate" type="DateTime" />
+            <TypeNode nodeName="Email" type="Email" minOccur="0" maxOccur="unbounded" />
+            <ComplexNode nodeName="AviaTicket" minOccur="0">
+                <TypeNode nodeName="From" type="Airport" control="ListBox" datasource="Airports"/>
+                <TypeNode nodeName="To" type="Airport" >
+                    <DiffersFrom query="From"/>
+                </TypeNode>
+            </ComplexNode>
+        </NodeSet>
+    </ComplexNode>
+    <Type typeName="DateTime" deriveFrom="SimpleNode">
+        <Regexp>\d{4}-\d{2}-\d{2}((T|\s)\d{2}\:\d{2}:\d{2})?</Regexp>
+    </Type>
+</schema>
\ No newline at end of file