----- Original Message -----
From: "Mike Aizatsky" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 12, 2002 9:31 AM
Subject: RE: [Eap-list] Still no results when validating against a schema


> Tim,
>
>
> > But if I remove the schemaLocation attribute, my application will not
> be
> > validated when I run outside of IDEA. The schemaLocation is the only
> > "hint" provided to parsing applications as to how the schema may be
> > located.
>
> Not the only. You might also implement your EntityResolver.
>

I do implement the entity resolver. It is invoked when it hits my
schemaLocation attribute, as it should be. Of course I could try and instead
put my schema name within a document type declaration, but it is my
understanding that this is not the correct way to identify schemas. Schemas
are supposed to be identified within instance documents using either the
schemaLocation or noNamespaceSchemaLocation attributes: Please correct me if
I am misunderstanding this.

> > I understand that a relative location is being specified. Why is it
> > being treated relative to IDEA_HOME/bin instead of relative to the
> > working directory that has been configured for my project's run?
>
> Fairly speaking: I don't know. At this moment I think that it's some
> xerces-specific behaviour. It doesn't ask our EntityResolver for
> resolving your schema. I'm still investigating this issue and hopefully
> will find the solution.

I have been working with Xerces for a while now - This schema works under
Xerces 1.4.X. I had held off trying under Xerces 2 because it did not
support schemas in the earlier versions. The current (2.0.1) version does
claim to support schemas, but it seems to be at an alpha (or at best beta)
level. If you are using Xerces 2, then I wonder if complete and consistent
support for XML schemas is possible... Any thoughts?

For what it's worth - The failure to get your entity resolver might be
caused by a lack of turning on the right features in the parser. Under
Xerces 1, all you had to do was invoke the setValidating() method to enable
validation: Once enabled any schemaLocation attribute would result in a call
to your entity resolver. Under Xerces 2, it doesn't work that way. You
actually have to turn on validation *and* the schema-support feature. Code
like the following is what I use:

        DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
        factory.setNamespaceAware(true);
        factory.setValidating(true);

factory.setAttribute("http://apache.org/xml/features/validation/schema";, new
Boolean(true));

Once I have added the last line above, I once again get calls to my
EntityResolver implementation as the schemaLocation attribute is
encountered.

I'm going to go ahead and report a bunch of apparent schema-support errors
to this page as I encounter them, with the full understanding that some of
these might be Xerces problems and not IDEA.... I'm assuming that you will
tell me when it's a Xerces problem, but maybe you'll be able to come up with
some clever workarounds ;)

- Tim



_______________________________________________
Eap-list mailing list
[EMAIL PROTECTED]
http://www.intellij.com/mailman/listinfo/eap-list

Reply via email to