Author: janguenot
Date: Mon Oct  3 16:19:51 2005
New Revision: 27866

Modified:
   z3lab/zope/xmlschema/trunk/demo/configure.zcml
   z3lab/zope/xmlschema/trunk/demo/foo.xs
   z3lab/zope/xmlschema/trunk/handler.py
   z3lab/zope/xmlschema/trunk/tests/examples/simple.xs
   z3lab/zope/xmlschema/trunk/tests/examples/simple.xsd
Log:
Fix schema validity

Modified: z3lab/zope/xmlschema/trunk/demo/configure.zcml
==============================================================================
--- z3lab/zope/xmlschema/trunk/demo/configure.zcml      (original)
+++ z3lab/zope/xmlschema/trunk/demo/configure.zcml      Mon Oct  3 16:19:51 2005
@@ -23,7 +23,6 @@
       schema=".interfaces.IFoo"
       label="Add a Foo content object"
       content_factory=".foo.Foo"
-      
       name="addFoo.html"
       permission="zope.ManageContent"
       />

Modified: z3lab/zope/xmlschema/trunk/demo/foo.xs
==============================================================================
--- z3lab/zope/xmlschema/trunk/demo/foo.xs      (original)
+++ z3lab/zope/xmlschema/trunk/demo/foo.xs      Mon Oct  3 16:19:51 2005
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
-  <xs:attribute name="title" use="required" type="xs:normalizedString" />
-  <xs:attribute name="description" use="required" type="xs:string"/>
+  <xs:element name="title" type="xs:normalizedString" />
+  <xs:element name="description" type="xs:string"/>
 </xs:schema>

Modified: z3lab/zope/xmlschema/trunk/handler.py
==============================================================================
--- z3lab/zope/xmlschema/trunk/handler.py       (original)
+++ z3lab/zope/xmlschema/trunk/handler.py       Mon Oct  3 16:19:51 2005
@@ -42,6 +42,7 @@
     """XML Schema handler
     """
 
+    # Common XML Data Types
     _mapping = {
         'string'  : StringField,
         'normalizedString' : NormalizedStringField,
@@ -57,6 +58,7 @@
         # Lookup the schema from the global utility given it's name.
         # Check the XMLSchema meta directive for more information on
         # the Schema registration
+
         schema = zope.component.getUtility(IXMLSchema, schema_id)
         self._doc = schema._doc
 
@@ -87,14 +89,15 @@
     def __call__(self, attrs):
 
         # Handle top level elements
-        for elt in self._getElements(self._root, 'attribute'):
+        for elt in self._getElements(self._root, 'element'):
             _name = elt.attrib.get('name')
             _type = self._getElementType(elt)
             # Add a zope interface fields to the schema
             field_mapper = self._mapping.get(_type)
             if field_mapper is None:
                 raise NotImplementedError(
-                    "%s xsd data type is not implemented yet sorry !"
+                    "%s xsd data type "
+                    "is not implemented yet sorry !"
                     %_type
                     )
             attrs[_name] = field_mapper(elt)()

Modified: z3lab/zope/xmlschema/trunk/tests/examples/simple.xs
==============================================================================
--- z3lab/zope/xmlschema/trunk/tests/examples/simple.xs (original)
+++ z3lab/zope/xmlschema/trunk/tests/examples/simple.xs Mon Oct  3 16:19:51 2005
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
-  <xs:attribute name="title" type="xs:string"/>
-  <xs:attribute name="description" type="xs:string"/>
+  <xs:element name="title" type="xs:string" />
+  <xs:element name="description" type="xs:string"/>
 </xs:schema>

Modified: z3lab/zope/xmlschema/trunk/tests/examples/simple.xsd
==============================================================================
--- z3lab/zope/xmlschema/trunk/tests/examples/simple.xsd        (original)
+++ z3lab/zope/xmlschema/trunk/tests/examples/simple.xsd        Mon Oct  3 
16:19:51 2005
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
-  <xsd:attribute name="title" type="xsd:string"/>
-  <xsd:attribute name="description" type="xsd:string"/>
+  <xsd:element name="title" type="xsd:string"/>
+  <xsd:element name="description" type="xsd:string"/>
 </xsd:schema>
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to