[Mono-bugs] [Bug 496205] New: XmlSchema error: Not allowed character content was found while reading a XML file

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Apr 17 17:41:33 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=496205


           Summary: XmlSchema error: Not allowed character content was
                    found while reading a XML file
    Classification: Mono
           Product: Mono: Class Libraries
           Version: unspecified
          Platform: i686
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.XML
        AssignedTo: atsushi at ximian.com
        ReportedBy: stu_dan at hispeed.cH
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Created an attachment (id=286608)
 --> (http://bugzilla.novell.com/attachment.cgi?id=286608)
Demo project with prefixed elements and types in xml

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.0.8)
Gecko/2009032711 Ubuntu/8.10 (intrepid) Firefox/3.0.8

Hi

After using a prefix for elements and xsi-types as a workaround in my demo
project, I got another error information:
Unhandled Exception: System.Xml.Schema.XmlSchemaValidationException: XmlSchema
error: Not allowed character content was found. XML  Line 7, Position 111.

The problem is based on empty complex types or complex types containing only
attributes in the XSD file. i.e.
<xs:complexType name="Address"/> or
<xs:complexType name="Address">
  <xs:attribute name="Street" type="xs:string"/>
</xs:comlexType>

-- Workaround --
As a workaround for this problem is to use a dummy element in complex types.
i.e.
<xs:complexType name="Address">
  <xs:sequence>
    <!-- Workaround for Mono to prevent the error "Not allowed character
content was found." in
         XmlSchemaValidatingReader.Read () -->
    <xs:element name="dummy" type="xs:string" minOccurs="0"/>
  </xs:sequence>
  <xs:attribute name="Street" type="xs:string"/>
</xs:complexType>
--

-- Full error information --
Unhandled Exception: System.Xml.Schema.XmlSchemaValidationException: XmlSchema
error: Not allowed character content was found. XML  Line 7, Position 111.
  at System.Xml.XmlReaderSettings.OnValidationError (System.Object o,
System.Xml.Schema.ValidationEventArgs e) [0x00000] 
  at
Mono.Xml.Schema.XmlSchemaValidatingReader+<XmlSchemaValidatingReader>c__AnonStorey2.<>m__1
(System.Object o, System.Xml.Schema.ValidationEventArgs e) [0x00000] 
  at System.Xml.Schema.XmlSchemaValidator.HandleError
(System.Xml.Schema.XmlSchemaValidationException exception, Boolean isWarning)
[0x00000] 
  at System.Xml.Schema.XmlSchemaValidator.HandleError (System.String message,
System.Exception innerException, Boolean isWarning) [0x00000] 
  at System.Xml.Schema.XmlSchemaValidator.HandleError (System.String message)
[0x00000] 
  at System.Xml.Schema.XmlSchemaValidator.ValidateText
(System.Xml.Schema.XmlValueGetter getter) [0x00000] 
  at System.Xml.Schema.XmlSchemaValidator.ValidateWhitespace
(System.Xml.Schema.XmlValueGetter getter) [0x00000] 
  at Mono.Xml.Schema.XmlSchemaValidatingReader.Read () [0x00000] 
  at System.Xml.XmlReader.Skip () [0x00000] 
  at
System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstance
(System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean
checkType) [0x00000] 
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObject
(System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean
checkType) [0x00000] 
  at
System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstance
(System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean
checkType) [0x00000] 
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObject
(System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean
checkType) [0x00000] 
  at
System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObjectElement
(System.Xml.Serialization.XmlTypeMapElementInfo elem) [0x00000] 
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadListElement
(System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable,
System.Object list, Boolean canCreateInstance) [0x00000] 
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadMembers
(System.Xml.Serialization.ClassMap map, System.Object ob, Boolean isValueList,
Boolean readByOrder) [0x00000] 
  at
System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstanceMembers
(System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob) [0x00000] 
  at
System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstance
(System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean
checkType) [0x00000] 
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObject
(System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean
checkType) [0x00000] 
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadRoot
(System.Xml.Serialization.XmlTypeMapping rootMap) [0x00000] 
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadRoot ()
[0x00000] 
  at System.Xml.Serialization.XmlSerializer.Deserialize
(System.Xml.Serialization.XmlSerializationReader reader) [0x00000] 
--

Reproducible: Always

Steps to Reproduce:
1. Compile and run
2.
3.
Actual Results:  
Works fine under Microsoft .NET
Fails under Mono

Expected Results:  
<?xml version="1.0" encoding="utf-8"?>
<tns:Person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Firstname="Daniel" Lastname="Stutz" xmlns:tns="http://tempuri.org/Person.xsd">
  <tns:Addresses>
    <tns:Address Street="Teststreet" ZIP="8000" City="Zürich" />
    <tns:Address xsi:type="tns:HotelAddress" Street="" ZIP="" City="Angaga"
Country="Maldives" RoomNo="34" />
  </tns:Addresses>
</tns:Person>

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list