[Mono-dev] Mono & .Net difference - handling xs:extension please help

Atsushi Eno atsushieno at veritas-vos-liberabit.com
Wed Nov 12 14:44:45 UTC 2014


Hello,

If you believe xs:complexType/xs:extension is that superficial, could 
you explain why the validation result is wrong?

Dealing with xs:complexType is one of the most complicated XML schema 
validation technology, which involved handful of ambiguity, which may be 
fixed in later specifications, after we have implemented this feature 
mostly in 2003-2004.

Atsushi Eno

On 2014年11月12日 15:15, MarLOne wrote:
> Hello,
>
> Not sure if this issue has been raised as it is driving me nuts as another
> Mono/.Net runtime behavior differences.
>
> I have a xml schema called FamilyTree2.xsd  FamilyTree2.xsd
> <http://mono.1490590.n4.nabble.com/file/n4664552/FamilyTree2.xsd>  . This
> has been validate in Eclipse's Xsd Editor.
>
> Then I have an instance document created using this schema and is called
> FamilyTree2SimplePerson.xml  FamilyTree2SimplePerson.xml
> <http://mono.1490590.n4.nabble.com/file/n4664552/FamilyTree2SimplePerson.xml>
>
> I then use xsd.exe in Mono runtime 2.10.8.1 to generate a C# class from the
> schema. I then use the following code to deserialize the instance document
> into an person object:
>          [Test]
>          public void TestSimplePerson ()
>          {
>              const String testFile = "FamilyTree2SimplePerson.xml";
>              String fileName = Path.Combine( Constants.DataFilesDirectory,
> testFile );
>              Assert.IsTrue( File.Exists( fileName ) );
>              
>              LMar.Demo.person p = null;
>              using( Stream input = File.OpenRead( fileName ) )
>              {
>                  XmlReaderSettings rs = new XmlReaderSettings();
>                  rs.Schemas = new XmlSchemaSet();
>                  rs.Schemas.Add( SchemaLoaders.FamilyTree2 );
>                  rs.ValidationType = ValidationType.Schema;
>                  
>                  using( XmlReader reader = XmlReader.Create( input, rs ) )
>                  {
>                      XmlSerializer ser = new XmlSerializer( typeof(
> LMar.Demo.person ) );
>                      p = ser.Deserialize( reader ) as LMar.Demo.person;  //
> XmlSchemaValiationException
>                      Assert.IsNotNull( p );
>                  }
>              }
>
> The schema is embedded into the assembly as embedded resource,
>
> The exception message is as follows:
> System.Xml.Schema.XmlSchemaValiationException: XmlSchema error: Attribute
> declaration was not found for name XML Line 6, Position 12.
>
> person is the base class of spouse which uses the xs:extension to define it
> in the schema. This error message points to the name for the spouse object.
>
> I believe this is a Mono & MS .Net incompatibility runtime error for the
> following reasons:
> 1) The instance document has been validated by Eclipse xsd/xml editor as
> well as online validator. In fact the instance document was created by
> Eclipse xml editor.
> 2) The same code ( the xsd generated code produced in .Net and Mono appear
> to be the same) shown above runs without error in MS .Net and retrieving all
> the values.
>
> Has anyone discovered this error? It is a simple usage of xs:extension, a
> very commonly used construct and should not cause any incompatibility.
>
> It is so disheartening to see superficial compatibility while beneath the
> surface so much differences. Is there a site that lists this kind of runtime
> incompatibility for people wanting to use Mono as serious tool? Every time I
> push Mono, I end up in a hole like this as I have encountered time and time
> again incompatibilities.
>
> Is there some quirky flags in the XmlReaderSettings to get this going in
> Mono?
>
> Thanks.
>
> MarL
>
>
>
>
> --
> View this message in context: http://mono.1490590.n4.nabble.com/Mono-Net-difference-handling-xs-extension-please-help-tp4664552.html
> Sent from the Mono - Dev mailing list archive at Nabble.com.
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
>



More information about the Mono-devel-list mailing list