Re: [xml] XML Schema Help
- From: James Yerge <james nixsecurity org>
- To: Syd_Bauman Brown edu
- Cc: xml gnome org
- Subject: Re: [xml] XML Schema Help
- Date: Thu, 22 Sep 2011 20:36:37 -0400
On 09/22/2011 08:21 PM, Syd Bauman wrote:
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
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml
I appreciate the time and effort you've taken to help me. I'll check out
that converter, previously I used trang to go to relax-ng, however,
validating with xmllint using the --stream argument seems to throw
continuous validation errors when encountered. I'll mess around with the
arguments to see if I can get xmllint to return a single validation
error, if that doesn't work, I think I can surppress errors and possibly
check the return code from xmllint, if it's set.
Again, thanks for your time and help :)
James
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]