0

I want to use JiBX to unmarshall huge XML files, but I don't want it to validate against the XSD. How do I do this?

Proof of concept (jUnit snippet that works for XMLs compliant against the XSD):

IBindingFactory bfact = BindingDirectory.getFactory(Customer.class);
IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
Customer customer = (Customer) uctx.unmarshalDocument(new FileInputStream(fileLocation), null);

Why do I need this? I have a RESTful service that allows users to upload humongous XML files. Castor proved to be too slow for the job and I am now in the process of re-writing things in JiBX. Though, I know from experience that users will sometimes upload files that are 99.9% processable, but one extra XML attribute in an element will render the whole XML incorrect. I would still like to unmarshall all that I can in memory and do my validations manually.

1 Answers1

0

Pomario,
What you want to do is possible. I suggest you download our source code from github and test against some xml files. If JiBX complains about XML elements and attributes that are not in the model, find the error in our source code and change the code to ignore the bad XML data rather than throw an error.
I should not be too hard.
Good Luck!
Don

Don Corley
  • 496
  • 2
  • 7