Cannot parse complexType with final="extension restriction"
-----------------------------------------------------------

                 Key: WSCOMMONS-273
                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-273
             Project: WS-Commons
          Issue Type: Bug
          Components: XmlSchema
         Environment: jdk1.5.0_11 on Windows XP

            Reporter: Pierre Buyle


When I try to read to following schema

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema";>

  <xs:complexType name="foo" final="extension restriction">
    <xs:sequence>
      <xs:element name="bar" type="xs:int"/>
    </xs:sequence>
  </xs:complexType>
</xs:schema>

Using this simple code

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;

import javax.xml.transform.stream.StreamSource;

import org.apache.ws.commons.schema.XmlSchema;
import org.apache.ws.commons.schema.XmlSchemaCollection;


public class TestXmlSchema
{
        public static void main(String[] argh)
        {
                InputStream is;
                try
                {
                        is = new FileInputStream("schema1.xsd");
                        XmlSchemaCollection schemaCol = new 
XmlSchemaCollection();
                        XmlSchema schema = schemaCol.read(new StreamSource(is), 
null);
                }
                catch (FileNotFoundException e)
                {
                        e.printStackTrace();
                }
                
        }
}

I get the following exception

Exception in thread "main" 
org.apache.ws.commons.schema.constants.Enum$EnumValueException: Bad Enumeration 
value 'extension restriction'
        at org.apache.ws.commons.schema.constants.Enum.setValue(Enum.java:49)
        at org.apache.ws.commons.schema.constants.Enum.<init>(Enum.java:27)
        at 
org.apache.ws.commons.schema.XmlSchemaDerivationMethod.<init>(XmlSchemaDerivationMethod.java:46)
        at 
org.apache.ws.commons.schema.SchemaBuilder.handleComplexType(SchemaBuilder.java:657)
        at 
org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:157)
        at 
org.apache.ws.commons.schema.SchemaBuilder.build(SchemaBuilder.java:82)
        at 
org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:359)
        at 
org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:304)
        at 
org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:315)
        at 
org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:333)
        at TestXmlSchema.main(TestXmlSchema.java:20)

According to the W3C's XML Schema Validator 
(http://www.w3.org/2001/03/webdata/xsv), the used schema is valid.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to