Skip to main content


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 10:28
moritz du is currently offline moritz duFriend
Messages: 102
Registered: February 2010
Senior 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: Mon Sep 23 11:19:00 GMT 2024

Powered by FUDForum. Page generated in 0.04843 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top