Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Validate xml against multiple schema(org.xml.sax.SAXParseException; lineNumber: 1353; columnNumber: 40; src-resolve: Cannot resolve the name 'xenc:EncryptedData' to a(n) 'element declaration' component.)
Validate xml against multiple schema [message #1025288] Tue, 26 March 2013 06:28
moritz du is currently offline moritz du
Messages: 98
Registered: February 2010
Member
I am using moxy to read in given xml with given schema (see attachments!). Validation in Eclipse passes but online or using java/moxy fails with

org.xml.sax.SAXParseException; lineNumber: 1353; columnNumber: 40; src-resolve: Cannot resolve the name 'xenc:EncryptedData' to a(n) 'element declaration' component.

(what a line number??)

In Java it seems to make no difference if only one schema is loaded or all 3 schemas are loaded - the error persists.

My test code for this use case looks like that at the moment:
    @Test
    public void test() throws Exception {
        Unmarshaller um;
        JAXBContext jaxbContext = JAXBContext
                .newInstance("...generatedClasses.invoice.general430.request");
        um = jaxbContext.createUnmarshaller();
        InputStream mainSchemaIs = this.getClass().getResourceAsStream("/xsd/" + "generalInvoiceRequest_430.xsd");
        InputStream encodeSchemaIs = this.getClass().getResourceAsStream("/xsd/" + "xenc-schema.xsd");
        InputStream sigSchemaIs = this.getClass().getResourceAsStream("/xsd/" + "xmldsig-core-schema.xsd");

        InputStream xmlIs = SingleTests.class.getResourceAsStream("/430_requests/dentist_ersred_TG_430.xml");

        SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
        Schema schema = sf.newSchema(new Source[] { new StreamSource(mainSchemaIs), new StreamSource(encodeSchemaIs), new StreamSource(sigSchemaIs) });
        um.setSchema(schema);
        // XMLInputFactory xif = XMLInputFactory.newFactory();
        // xif.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, true);
        um.unmarshal(new StreamSource(xmlIs), ...generatedClasses.invoice.general430.request.RequestType.class);

    }


So how to get this xml validated?
Previous Topic:Batch fetch for type IN results in sql exception
Next Topic:how to store a page of text as string in JPA 2.0
Goto Forum:
  


Current Time: Fri Aug 01 01:59:04 EDT 2014

Powered by FUDForum. Page generated in 0.01827 seconds