Re: [xml] XML Schema Help



I'm afraid I can't help out much more, here (you're problem goes
beyond my meager capabilities). But if you haven't tried 
xsdtorngconverter, it may be worth a shot:
http://code.google.com/p/xsdtorngconverter/

I cannot vouch that it works well, but I tried it on the snippet of
XSD you posted, and the resulting RELAX NG looked quite reasonable.
(And quite easy to change to do what you want.)

I apologize if I posted to the wrong list. Anyway, thanks for your help.
The schematron rule appears to be working, however, here's my scenario.
I have an XSD written already and don't have the time to convert it to
Schematron or relax-NG. I know xmllint doesn't fully implement the XSD
specification nor does it support XSD 1.1 but without having to
introduce an alternative validator to the build process, I'm stuck with
xmllint and an XSD. Also, I'm dealing with very large .xml files at
times, in some instances close to 1GB, so memory is of importance here.
I'll break down the process below.

You import your XML file, validation is performed using xmllint, if
validation fails I simply discard the file and throw an error. However,
if validation succeeds, the XML file is parsed using PHP (the SAX
parser). I could use PHP to validate if the TARGET preference is set and
discard the file and throw an error if not found, however, I'd prefer
not to go that route. I'm also dealing with two separate formats of the
XML file but the problem exists with the schema validation for the newer
format.

I've been trying to find the proper XSD rule, without any luck, to
validate the document. I'd prefer not to have to validate the XML file
twice using xmllint. I'm currently executing xmllint from the CLI,
without any luck using both the XSD and schematron (with the --stream
option). I need the --stream option so xmllint doesn't load the entire
document in memory. When executing xmllint with --schematron and the
--stream option, I get no validation messages back, whatsoever.

Examples:
xmllint --noout --stream --schematron file.sch file.xml
xmllint --noout --stream --schema file.xsd --schematron file.sch file.xml

James



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]