Hi all, I am using a schema that makes use of xsd:any with processContents=lax in order to integrate extensions that are defined in another schema file.
XML instances that don't use xsi:type within the extension are considered as valid (as expected): - if the schema definition of the extension is available then the content is checked - if the schema definition of the extension is not available then the content is skipped However, if an XML instance makes use of xsi:type within the extension and the schema definition of the extension is not available, then the xerces parser reports the following error message: cvc-elt.4.2: Cannot resolve 'ext2:B-INTEGER' to a type definition for element 'ext2:B'. If the schema file is available, no errors are reported. I validated the XML instance with the following parsers: * xerces-j 2.9.0: Error: cvc-elt.4.2 * xerces-j 2.11.0: Error: cvc-elt.4.2 * xerces-c 3.1.1: Error: grammar not found for namespace '..... * AltovaXML: XML instance is considered as valid * XML Notepad 2007: XML instance is considered as valid Did I find a bug or are there any properties which can be set in order to make xerces ignore the xsi:type? I would like to be able to handle extensions from third-parties that do not provide a XML schema. regards, mark I used the following Schema and XML instance files: ============== exampleWithXsiType_lax_NoExt2SchemaHint.xml ============== <ROOT xmlns="http://www.eclipse.org/rmf/example/toolextension/xsd" xmlns:ext2="http://www.eclipse.org/rmf/example/toolextension/xsd/ext2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eclipse.org/rmf/example/toolextension/xsd base_lax.xsd"> <TOOL-EXTENSIONS> <TOOL-EXTENSION> <ext2:B xsi:type="ext2:B-INTEGER"> <ext2:NAME>myIntegerValue</ext2:NAME> <ext2:VALUE>1</ext2:VALUE> </ext2:B> </TOOL-EXTENSION> </TOOL-EXTENSIONS> </ROOT> ============== base_lax.xsd ============== <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:base="http://www.eclipse.org/rmf/example/toolextension/xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.eclipse.org/rmf/example/toolextension/xsd"> <xsd:element name="ROOT" type="base:ROOT"/> <xsd:complexType name="ROOT"> <xsd:sequence> <xsd:element maxOccurs="1" minOccurs="0" name="TOOL-EXTENSIONS"> <xsd:complexType> <xsd:choice maxOccurs="unbounded" minOccurs="0"> <xsd:element name="TOOL-EXTENSION" type="base:TOOL-EXTENSION"/> </xsd:choice> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> <xsd:complexType name="TOOL-EXTENSION"> <xsd:sequence> <xsd:any namespace="##other" processContents="lax" maxOccurs="unbounded" minOccurs="0"/> </xsd:sequence> </xsd:complexType> </xsd:schema> ============== ext2.xsd (for information) ============== <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:ext2="http://www.eclipse.org/rmf/example/toolextension/xsd/ext2" xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.eclipse.org/rmf/example/toolextension/xsd/ext2"> <xsd:element name="B" type="ext2:B-ABSTRACT"/> <xsd:complexType name="B-ABSTRACT" abstract="true"> <xsd:sequence> <xsd:element maxOccurs="1" minOccurs="1" name="NAME" type="xsd:string"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="B-STRING" > <xsd:complexContent> <xsd:extension base="ext2:B-ABSTRACT"> <xsd:sequence> <xsd:element maxOccurs="1" minOccurs="0" name="VALUE" type="xsd:string"/> </xsd:sequence> </xsd:extension> </xsd:complexContent> </xsd:complexType> <xsd:complexType name="B-INTEGER" > <xsd:complexContent> <xsd:extension base="ext2:B-ABSTRACT"> <xsd:sequence> <xsd:element maxOccurs="1" minOccurs="0" name="VALUE" type="xsd:integer"/> </xsd:sequence> </xsd:extension> </xsd:complexContent> </xsd:complexType> </xsd:schema> -- Mark Brörkens Softwarearchitekt, Projekt- und Produktmanager http://www.itemis.de https://www.xing.com/profile/mark_broerkens http://twitter.com/MarkBroerkens itemis AG Niederlassung Berlin Ohlauer Straße 43 10999 Berlin Rechtlicher Hinweis: Amtsgericht Dortmund, HRB 20621 Vorstand: Jens Wagener (Vors.), Wolfgang Neuhaus, Dr. Georg Pietrek, Jens Trompeter, Sebastian Neus Aufsichtsrat: Dr. Burkhard Igel (Vors.), Stephan Grollmann, Michael Neuhaus --------------------------------------------------------------------- To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org For additional commands, e-mail: j-users-h...@xerces.apache.org