Lulseged Zerfu (TN/EAB) wrote:
> But when I do the following it complains because schema
> "oma-list-service.xsd" is referencing to another schema.
>
> JAXBContext jc =
> JAXBContext.newInstance(value);
> Unmarshaller u = jc.createUnmarshaller();
> SchemaFactory sf =
> SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI);
> Schema schema = sf.newSchema(new
> File("oma-list-service.xsd"));
> u.setSchema(schema);
>
> What I am trying to do is to validate XML document againest a schema. I
> don't know if there are other ways to validate XML document.
Ah, OK, so this is really a JAXP question. That's where SchemaFactory
belongs.
Now I'm putting my JAXP hat on, and I think the issue is that you need
to place your ietf-common-policy.xsd along side so that the reference
resolves.
> It would be nice to have a validating function created when compiling a
> schema. Are there any today?
No.
--
Kohsuke Kawaguchi
Sun Microsystems kohsuke.kawaguchi_at_sun.com