You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by rg...@hotmail.com on 2002/06/27 21:43:32 UTC

[Error] :-1:-1: cos-ct-extends.1.4.2.2.2.2.1: Error for type 'ANYTYPE'.

Hello,

When I try to run the below sample code with the sample xsd attached, I get
the
[Error] :-1:-1: cos-ct-extends.1.4.2.2.2.2.1: Error for type 'ANYTYPE'.  The
content type of a derived type and that of its base must both be mixed or
element-only.

Whereas XMLSpy (an editor) allows me to define such datatypes and validates
it.

"2.5.4 anyType
The anyType represents an abstraction called the ur-type which is the base
type from which all simple and complex types are derived. An anyType type
does not constrain its content in any way." - XML Schema Part 0: Primer
W3C Recommendation, 2 May 2001

Looks like a xerces bug to me (or could be my ignorance).

Could some one help me on this.
thanks.

Sample Java Code:

import org.apache.xerces.impl.xs.*;
import org.apache.xerces.xni.parser.*;
import org.apache.xerces.xni.grammars.*;
import java.io.*;
public class SchemaInterpreter
{

 public static void main(String[] args) throws Exception
 {

  InputStream val = new FileInputStream("anyType.xsd");

  XMLInputSource xInput = new XMLInputSource(null, null, null, (InputStream)
val, null);

  XMLSchemaLoader schemaLoader = new XMLSchemaLoader();
  Grammar schemaGrammar = schemaLoader.loadGrammar(xInput);
 }

}



Sample Schema(AnyType.xsd):

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
 <xsd:complexType name="ANYTYPE">
  <xsd:complexContent>
   <xsd:extension base="xsd:anyType"/>
  </xsd:complexContent>
 </xsd:complexType>
</xsd:schema>

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org