|
Hi Caroline, The last fix checked in addresses a derivation by restriction issue. Checkout the latest source and build it and use that jar. I tested using the latest jar and do not get the error (I got the error using an earlier jar) This is the test program. public class XmlBeansTest { public static void main(String[] args) { String schema = "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" elementFormDefault=\"qualified\" attributeFormDefault=\"unqualified\">\n" + " <xs:element name=\"RootElement\">\n" + " <xs:annotation>\n" + " <xs:documentation>Comment describing your root element</xs:documentation>\n" + " </xs:annotation>\n" + " <xs:complexType>\n" + " <xs:sequence>\n" + " <xs:element ref=\"Child\"/>\n" + " <xs:element ref=\"ChildExtended\"/>\n" + " <xs:element ref=\"ChildRestricted\"/>\n" + " </xs:sequence>\n" + " </xs:complexType>\n" + " </xs:element>\n" + " <xs:element name=\"Child\" type=\"MixedType\"/>\n" + " <xs:element name=\"ChildRestricted\" type=\"MixedTypeRestricted\"/>\n" + " <xs:element name=\"ChildExtended\" type=\"MixedTypeExtended\"/>\n" + " <xs:complexType name=\"MixedType\" mixed=\"true\"/>\n" + " <xs:complexType name=\"MixedTypeExtended\" mixed=\"true\">\n" + " <xs:complexContent mixed=\"true\">\n" + " <xs:extension base=\"MixedType\"/>\n" + " </xs:complexContent>\n" + " </xs:complexType>\n" + " <xs:complexType name=\"MixedTypeRestricted\" mixed=\"true\">\n" + " <xs:complexContent mixed=\"true\">\n" + " <xs:restriction base=\"MixedType\"/>\n" + " </xs:complexContent>\n" + " </xs:complexType>\n" + "</xs:schema>"; String testxml = "<RootElement xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n" + " <Child>text</Child> \n" + " <ChildExtended>text1</ChildExtended>\n" + " <ChildRestricted>text2</ChildRestricted>\n" + "</RootElement>"; try { SchemaTypeSystem sts1 = XmlBeans.compileXsd(new XmlObject[]{XmlObject.Factory.parse(schema)}, XmlBeans.getBuiltinTypeSystem(), null); XmlObject x1 = sts1.parse(testxml, sts1.findDocumentType(new QName("", "RootElement")), null); XmlOptions xo = new XmlOptions(); ArrayList<XmlValidationError> errorlist = new ArrayList<XmlValidationError>(); xo.setErrorListener(errorlist); if (!x1.validate(xo)) { for (XmlValidationError e : errorlist) { System.out.println(e.getMessage()); } } } catch (XmlException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } } } regards, Jerry On 6/8/2011 9:06 AM, Caroline Rosin (JIRA) wrote: Mixed and restricted element fails validation --------------------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] |
- [jira] [Created] (XMLBEANS-457) Mixed and restricted... Caroline Rosin (JIRA)
- Re: [jira] [Created] (XMLBEANS-457) Mixed and r... Jerry Sy
- [jira] [Commented] (XMLBEANS-457) Mixed and res... Jerry Sy (JIRA)
- [jira] [Commented] (XMLBEANS-457) Mixed and res... Caroline Rosin (JIRA)
