logo       

Related Msgs: audio.musicbrai...    enbd.general/20...    ietf.idr/2002-0...    java.ant-contri...    gnu.make.genera...    qplus.devel/200...    video.freevo.cv...    os.netbsd.ports...    yellowdog.gener...    xfree86.cvs/200...    search.nutch.us...    freedesktop.xse...    programming.swi...    capabilities.ge...    telephony.pbx.a...    mail.sylpheed.c...    db.firebase.por...    boot-loaders.u-...    recreation.radi...    netbsd.bugs/200...    web.zope.plone....    user-groups.lin...   

Re: SchemaFactory - check of non-valid imports: msg#00051

Subject: Re: SchemaFactory - check of non-valid imports
Hi Michael,

You were right about that, thanks :-)

Simon

On Nov 21, 2007 5:15 AM, Michael Glavassevich <mrglavas@xxxxxxxxxx> wrote:
> Hi Simon,
>
> Failure to resolve an import [1] is not an error however Xerces does report
> a warning to let the user know that it failed. I suspect that you haven't
> registered a an ErrorHandler with the SchemaFactory. By default (see
> DraconianErrorHandler) [2] it will silently ignore warnings.
>
> If you write your own ErrorHandler and register it with the SchemaFactory
> you should get a warning which looks like:
>
> schema_reference.4: Failed to read schema document
> 'file:///C:/bar/foo.xsd', because 1) could not find the document; 2) the
> document could not be read; 3) the root element of the document is not
> <xsd:schema>.
>
> If you want this warning to be fatal throw an exception from your
> ErrorHandler.
>
> Thanks.
>
> [1] http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/#src-import
> [2]
> http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/validation/SchemaFactory.html#setErrorHandler(org.xml.sax.ErrorHandler)
>
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrglavas@xxxxxxxxxx
> E-mail: mrglavas@xxxxxxxxxx
>
> "Simon Bøggild" <simon.hjorth@xxxxxxxxx> wrote on 11/20/2007 05:05:25 AM:
>
>
> > Hi,
> >
> > When using SchemaFactory to load and check a schema file, it seems to
> > ignore if the schema imports other schemas that doesn't exist. If for
> > instance there's a typo in the import line in the schema: <import
> > schemaLocation="file.xsdd" namespace=...>, where the "file.xsdd"
> > should have been written as "file.xsd", this seems to be ignored.
> > Sure, it generates an error when trying to process elements in the
> > schema deriving from the (wrongly spelled) imported schema file, but
> > it's not the actual misspelling in the import that raises the error.
> > Is there an option to set somewhere that causes SchemaFactory to throw
> > an exception if the imported schema does not exist? or is it necessary
> > to write your own LSResourceResolver implementation that manually
> > checks if the imported files exist?
> >
> > Thanks,
> > Simon
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: j-users-unsubscribe@xxxxxxxxxxxxxxxxx
> > For additional commands, e-mail: j-users-help@xxxxxxxxxxxxxxxxx
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xxxxxxxxxxxxxxxxx
> For additional commands, e-mail: j-users-help@xxxxxxxxxxxxxxxxx
>
>



Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>