You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2002/11/18 17:34:47 UTC

DO NOT REPLY [Bug 14641] New: - Prototypical task that uses Xerces-J 2.2.1 to validate an XML file against it's Schema (XSD)

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14641>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14641

Prototypical <schemavalid> task that uses Xerces-J 2.2.1 to validate an XML file against it's Schema (XSD)

           Summary: Prototypical <schemavalid> task that uses Xerces-J 2.2.1
                    to validate an XML file against it's Schema (XSD)
           Product: Ant
           Version: 1.5.1
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Optional Tasks
        AssignedTo: ant-dev@jakarta.apache.org
        ReportedBy: ddevienne@lgc.com


I'm not even sure this couldn't be mode to work or integrate with 
<XmlValidate>, but the latter didn't appear to validate against Schema (but I 
could be wrong).

Anyhow, this task simply rips off the dom.Writer example of Xerces-J 2.2.1 to 
load an XML file, with schema validation ON (can be configured to be strict or 
not). If the XML is schema vaild, then nothing happens (and nothing is output). 
If it's not, outputs the Xerces error (which is kinda human readable...), and 
throws a build exception.

I didn't try to make this task Jaxp-compatible, and directly used Xerces-J 
which is a compile-time (and thus runtime) dependency. I was surprised to 
discover the xmlParserAPIs.jar of Xerces has range classes not in JDK 1.4 which 
are required by Xerces-J!!!

Feeble attempt to make this a condition too. Hopefully someone will find this 
useful. I couldn't have written a schema for my XML without this task (Schemas 
are such strange beats).

Thanks for any comments, --DD

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>