[Mono-devel-list] Hi All!! XSD + XML Doubt

Luis Santos Teixeira luis.santos at wedoconsulting.com
Tue Dec 30 08:00:02 EST 2003


 	  
First of all, happy new year to all!! :)

i've got one doubt 'bout XML vs Mono.Net. i think my doubt is quite
simple:
 
i've got this XSD Schema File:
 
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema
<BLOCKED::http://www.w3.org/2001/XMLSchema> "
xmlns="urn:dac-entity-conf-2004-v1.0"
 elementFormDefault="qualified"
targetNamespace="urn:dac-entity-conf-2004-v1.0">
 
 <xsd:element name="dacEntity" type="dac.Entity" />
 
 <xsd:complexType name="dac.Entity">
  <xsd:sequence>
   <xsd:element name="entitySpecific" type="dac.Entity.Specific" />
   <xsd:element name="dacConfig" type="dac.Entity.Config" />
  </xsd:sequence>
  <xsd:attribute name="id" type="xsd:string" />
  <xsd:attribute name="name" type="xsd:string" />
 </xsd:complexType>
 
 <xsd:complexType name="dac.Entity.Specific">
  <xsd:sequence maxOccurs="1" minOccurs="1">
   <xsd:element name="entityDescription"
type="xsd:string"></xsd:element>
  </xsd:sequence>
 </xsd:complexType>
 
 <xsd:complexType name="dac.Entity.Config">
  <xsd:sequence maxOccurs="1" minOccurs="1">
   <xsd:element name="relations"
type="dac.Entity.Config.Relation"></xsd:element>
  </xsd:sequence>
 </xsd:complexType>
 
 <xsd:complexType name="dac.Entity.Config.Relation">
  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
   <xsd:element name="relation" type="xsd:string"></xsd:element>
  </xsd:sequence>
  <xsd:attribute name="basens" type="dac.NameSpaces" />
 </xsd:complexType>
 
 <xsd:simpleType name="dac.NameSpaces">
  <xsd:restriction base="xsd:string">
   <xsd:enumeration value="urn:dac-entity-conf-2004-v1.0" />
   <xsd:enumeration value="urn:dac-group-conf-2004-v1.0" />
   <xsd:enumeration value="urn:dac-privilege-conf-2004-v1.0" />
   <xsd:enumeration value="urn:dac-property-conf-2004-v1.0" />
   <xsd:enumeration value="urn:dac-relation-conf-2004-v1.0" />
   <xsd:enumeration value="urn:dac-user-conf-2004-v1.0" />
  </xsd:restriction>
 </xsd:simpleType>
 
</xsd:schema> 
 
to validate this XML file:
 
<?xml version="1.0"?>
<config>
 <dacEntity id="company.a" name="Empresa A"
xmlns="urn:dac-entity-conf-2004-v1.0">
  <entitySpecific>
   <entityDescription>zzzz</entityDescription>
  </entitySpecific>
  <dacConfig>
   <relations basens="urn:dac-relation-conf-2004-v1.0">
    <relation>relation.dep.a</relation>
   </relations>
  </dacConfig>
 </dacEntity> 
</config>
 
 
The problem is:
 
I just want to ensure that only the dacEntity is verified, so, in the
xsd file i 
set the targetNamespace="urn:dac-entity-conf-2004-v1.0" and, in the xml
file relate dacEntity to xmlns="urn:dac-entity-conf-2004-v1.0".
 
i'm geting this runtime exception: 
 
System.Xml.Schema.XmlSchemaException: XmlSchema error: Element
declaration for config is missing. XML  Line 1, Position 21.
 
My question is:
with mono.net, i can validate fragments of XML using xsd schemas or i
must ensure validation to a hole xml file?
 
 
Thaks!! :)
 
	 Luis Santos
WeDo Consulting, SA	
	 [mailto:luis.santos at wedoconsulting.com]||
+351 93 9650076||+351 25 3101436 (Ext: 1036)	
	 	
	  	 Centro Empresarial de Braga
Pavilhão C4 - Lugar da Misericórdia
Ferreiros 4700-319 Braga - Portugal
Tlf. + 351 253 101 400   Fax + 351 253 101 401
www.wedoconsulting.com	
	 
	
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20031230/eb5a4acc/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 49 bytes
Desc: transp.gif
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20031230/eb5a4acc/attachment.gif 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 4333 bytes
Desc: logo_wedo_anim.gif
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20031230/eb5a4acc/attachment-0001.gif 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 51 bytes
Desc: quadrado.gif
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20031230/eb5a4acc/attachment-0002.gif 


More information about the Mono-devel-list mailing list