Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>One way of doing it would be to do the following:</p> <ul> <li>Use the JAXB compiler to create Java classes out of your XSD</li> <li>Use a product similar to <a href="http://flatworm.sourceforge.net/" rel="nofollow noreferrer">Flatworm</a> to automatically/declaratively parse your records (or the whole file) into the Java classes created above, or simply by hand, etc.</li> <li>Use an approach such as the one posted <a href="https://stackoverflow.com/questions/1560422/how-to-validate-against-schema-in-jaxb-2-0-without-marshalling/13360785#13360785">here on SO</a> to validate your graph. Just make sure you cache appropriately i.e. reuse the validator and the JAXBContext object. </li> </ul> <p>Given the nature of the ask, the overhead incurred by marshalling to XML, even as a JAXBSource, is inevitable. What you could do is make the best out of it... If CPU bandwidth is not an issue, you could try to parallelize to increase throughput (you will need one validator per thread, JAXBContent was thread safe last time I've used it). And I would avoid loading the whole file, if one is thinking that an XSD for all the records (as in the element matching the record would be a particle with maxOccurs="unbounded") would be a more efficient way of validating... For large files, you'll run out of memory, most likely...</p> <p>For large volumes of data, using XSD could be labeled elegant, but is not that efficient. For someone which runs into this post while looking for a .NET solution, validating <strong>individual</strong> fields is way more efficient (assuming the XSD has no cross-field constraints, etc.) by doing a call to <a href="http://msdn.microsoft.com/en-ca/library/4t690ysw.aspx" rel="nofollow noreferrer">XmlSchemaDatatype.ParseValue</a> instead.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload