ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paul.ar...@sadalbari.com
Subject Re: xmlvalidate: check for well-formedness *only*
Date Fri, 22 Dec 2006 06:26:42 GMT
Quoting Jacob Kjome <hoju@visi.com>:

> 
> According to the Xerces features doc [1], set validation [2] and 
> nonvalidating.load-external-dtd [3] features to "false" to turn off 
> DTD/Schema validation/loading.  I haven't tried this myself. so YMMV.

thanks jacob. i thought i'd already tried every combination of those options...
but it's working with:

<xmlvalidate failonerror="false"
             lenient="true"
             warn="true">
  <attribute name="http://xml.org/sax/features/validation" value="false" />
  <attribute
name="http://apache.org/xml/features/nonvalidating/load-external-dtd"
value="false" />

  <fileset refid="xml.files" />
</xmlvalidate>

i was using <property> instead of <attribute> which sets parser properties as
opposed to parser features. it would be great to see this is the faq.

- p


> [1] http://xerces.apache.org/xerces2-j/features.html
> [2] http://xerces.apache.org/xerces2-j/features.html#validation
> [3] 
>
http://xerces.apache.org/xerces2-j/features.html#nonvalidating.load-external-dtd
> 
> 
> Jake
> 
> At 03:42 AM 12/20/2006, you wrote:
>  >I do not know how to tell xerces to not follow a dtd.
>  >Note that a dtd does not only have validity stuff, but it
>  >can also define entities so turning of validation does not have
>  >to mean do not look at the dtd.
>  >
>  >I ran into a similar problem at work, and could be be
>  >bothered to figure out what magic I need to do
>  >to tell xerces not to follow the DTD, so I wrote a
>  >DtdFilter to filter out the DTD <!DOCTYPE> from
>  >the input string.
>  >
>  >Peter
>  >
>  >On 12/19/06, paul.arzul@sadalbari.com <paul.arzul@sadalbari.com> wrote:
>  >> Quoting paul.arzul@sadalbari.com:
>  >>
>  >> > any progress or workaround on that (for ant stable 1.6.5)?
>  >>
>  >> i've got this working, but at a snail's pace... not surprising since the
>  >> following is rather io intensive (as well as unidiomatic):
>  >>
>  >>   <taskdef resource="net/sf/antcontrib/antlib.xml"/>
>  >>   <taskdef name="jing"
>  >classname="com.thaiopensource.relaxng.util.JingTask" />
>  >>
>  >>   <for param="file">
>  >>     <path>
>  >>       <fileset casesensitive="false"
>  >>                dir="."
>  >>                id="xml.files"
>  >>                includes="**/*.xml"
>  >>       />
>  >>     </path>
>  >>
>  >>     <sequential>
>  >>       <jing rngfile="wellformed.rng" file="@{file}" failonerror="false"
> />
>  >>     </sequential>
>  >>   </for>
>  >>
>  >> you'll notice 2 optional tasks:
>  >>
>  >> - jing for an alternate well-formedness checker (specified in the
> relax-ng
>  >> file wellformed.rng). also using the undocumented jing attribute 
> failonerror
>  >> here, to stop jing from failing the build. however, just like 
> xmlvalidate, it
>  >> stops processing after the first problem anyway, so we can't use a
> nested
>  >> fileset, but:
>  >>
>  >> - antcontrib and the <for> task to iterate over the lot
>  >>
>  >> i've got 400 xml files, and this took just short of 5 minutes, so about
> 1
>  >> second per file. xmllint did it near instantly.
>  >>
>  >> still hoping to hear of a better solution. anyone?
>  >>
>  >> - p


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message