[Mono-dev] Mono & .Net difference - handling xs:extension please help
atsushieno at veritas-vos-liberabit.com
Wed Nov 12 16:05:58 UTC 2014
And Microsoft has announced open-sourcing .NET! So you don't have to
spread your hate speech on bugs, we will take their good code.
(No XML Schema implementation yet, but I assume that would happen at
On 2014年11月12日 22:44, Atsushi Eno wrote:
> 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:
>> Not sure if this issue has been raised as it is driving me nuts as
>> 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
>> I then use xsd.exe in Mono runtime 126.96.36.199 to generate a C# class
>> from the
>> schema. I then use the following code to deserialize the instance
>> into an person object:
>> public void TestSimplePerson ()
>> const String testFile = "FamilyTree2SimplePerson.xml";
>> String fileName = Path.Combine(
>> 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; //
>> 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:
>> 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
>> 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
>> 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
>> surface so much differences. Is there a site that lists this kind of
>> 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
>> View this message in context:
>> Sent from the Mono - Dev mailing list archive at Nabble.com.
>> Mono-devel-list mailing list
>> Mono-devel-list at lists.ximian.com
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
More information about the Mono-devel-list