You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Adrian Sutton <Ad...@Ephox.com> on 2003/07/04 08:54:43 UTC

Specifying the schema location for DOM

This should be really straight forward but I seem to be missing something.
I need to be able to specify the schema location for various namespaces when
creating a DOM (and later validating it in memory using normalizeDocument).
Essentially I need the equivalent of xsi:schemaLocation in the following
snippet:

<p:policy 
	xmlns:p="http://www.ephox.com/examples/policy"
xsi:schemaLocation="http://www.ephox.com/examples/policy
http://boardroom/tesoro/policy.xsd">


Due to the requirements for our appliation (applet to be precise), we're
doing all kinds of things we shouldn't be and using a whole heap of Xerces
internal APIs throughout our application.  So when parsing the DOM I need to
get an instance of org.apache.xerces.dom.DocumentImpl.   On the plus side,
it means we can use pretty much any known means to set the schema location.
:)

Now, from http://xml.apache.org/xerces2-j/properties.html, it looks like
"http://apache.org/xml/properties/schema/external-schemaLocation" is the
property we want to set, but DOMBuilderImpl doesn't recognise that property.
If instead we use "schema-location" we can set what seems to be the
no-namespace schema location, but it doesn't work if namespaces are used and
just produces an error if you try to use the xsi:schemaLocation style
syntax.

We have previously been able to just use xsi:schemaLocation in the document
being parsed and that's worked perfectly, however requiring this to be added
to every document passed into our app is unacceptable - at least to my boss
:).

So what obvious setting am I missing, or have I gone and outsmarted myself
by using APIs I shouldn't be using?

Thanks in advance,

Adrian Sutton, Software Engineer
Ephox Corporation
www.ephox.com 

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


JAXP 1.2, uniform parser configuration for both dtd and w3c schema validation

Posted by Vinay Shukla <vi...@oracle.com>.
Hi All,

I need some help in figuring out this issue. I think as per JAXP 1.2
specification the defined parser behavior makes it difficult in the
below case.

Case: Validate an XML deployment descriptor with out knowing whether it
needs to be validated against a dtd or a w3 xml schema.

Currently as per JAXP  1.2 I could configure my parser to validate an
xml descriptor against either dtd or a w3 xml schema. However these two
configurations are different. I need to find a uniform way to configure
a parser, where I don't have to worry whether I am going to be
validating against a dtd or a schema.

How do I do this.

As per the JAXP 1.2 specification (Table 1 on page 29 of 148) with
validation turned on, and schema language property set, the document is
only validated against a w3 schema (irrespective of the DOCTYPE).

I would like to find out what is the recommended way to use a JAXP 1.2
compliant parser so that I can validate against both schemas and dtds
with out reconfiguring my parser.

I could directly get hold of xerces parser to achieve the above
behavior. However I have to use JAXP 1.2 APIs.

Thank you for your time,

Vinay Shukla


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