Michael,

Thanks a lot, it works. I have a question for you.

Is Validator smart enough to figure out when LSResourceResolver is giving 
compiled schema or uncompiled schema just to avoid compiling of schema at 
runtime ?

Thanks
Ajay   

--- On Fri, 11/20/09, Michael Glavassevich <mrgla...@ca.ibm.com> wrote:

> From: Michael Glavassevich <mrgla...@ca.ibm.com>
> Subject: Re: xs:any namespace resolution
> To: j-users@xerces.apache.org
> Date: Friday, November 20, 2009, 3:14 AM
> 
> Ajay,
> 
> 
> 
> If you want schemas to be dynamically loaded by the
> validator you need to use the SchemaFactory.newSchema()
> method [1] (the one with no parameters). JAXP doesn't
> let you mix that with pre-loading of schemas. See [2][3] in
> the mailing list archives for more details.
> 
> 
> 
> Thanks.
> 
> 
> 
> [1] 
> http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/validation/SchemaFactory.html#newSchema()
> 
> [2] http://markmail.org/message/5xe4u5njgxkiosk7
> 
> [3] http://markmail.org/message/4nhwp7ggi6fytqfg
> 
> 
> 
> Michael Glavassevich
> 
> XML Parser Development
> 
> IBM Toronto Lab
> 
> E-mail: mrgla...@ca.ibm.com
> 
> E-mail: mrgla...@apache.org
> 
> 
> 
> ajay bhadauria <abhadau...@yahoo.com> wrote on
> 11/19/2009 12:25:17 PM:
> 
> 
> 
> > Michael,
> 
> > 
> 
> > Sorry. I was over excited. I was doing the same way as
> you suggested
> 
> > but my LSResourceResolver is not getting called which
> means that I 
> 
> > am missing something which I am not aware of it. 
> 
> > 
> 
> > The Test2.xml which I attached in the previous mail,
> the tag 
> 
> > "ns1:Document" contains namespace
> xmlns:ns1="urn:swift:xsd:$xtsn.
> 
> > 998.001.01" which is on the 2.xsd.
> 
> > 
> 
> > Please find the attached Code where I set
> LSresourceResolver to Validator.
> 
> > 
> 
> > Thanks
> 
> > Ajay 
> 
> > --- On Thu, 11/19/09, Michael Glavassevich
> <mrgla...@ca.ibm.com> wrote:
> 
> > 
> 
> > > From: Michael Glavassevich
> <mrgla...@ca.ibm.com>
> 
> > > Subject: Re: xs:any namespace resolution
> 
> > > To: j-users@xerces.apache.org
> 
> > > Date: Thursday, November 19, 2009, 8:32 PM
> 
> > > 
> 
> > > (Ajay, patience. In the future, please don't
> 
> > > post the same message over and over again to the
> list. We
> 
> > > heard you the first time.)
> 
> > > 
> 
> > > 
> 
> > > 
> 
> > > Try writing an LSResourceResolver (which you
> would
> 
> > > register with the validator) and have that return
> the 2nd
> 
> > > schema document on the request with its target
> 
> > > namespace.
> 
> > > 
> 
> > > 
> 
> > > 
> 
> > > Thanks.
> 
> > > 
> 
> > > 
> 
> > > 
> 
> > > Michael Glavassevich
> 
> > > 
> 
> > > XML Parser Development
> 
> > > 
> 
> > > IBM Toronto Lab
> 
> > > 
> 
> > > E-mail: mrgla...@ca.ibm.com
> 
> > > 
> 
> > > E-mail: mrgla...@apache.org
> 
> > > 
> 
> > > 
> 
> > > 
> 
> > > ajay bhadauria <abhadau...@yahoo.com> wrote
> on
> 
> > > 11/19/2009 09:15:03 AM:
> 
> > > 
> 
> > > 
> 
> > > 
> 
> > > > Hi,
> 
> > > 
> 
> > > > 
> 
> > > 
> 
> > > > I do knot know much about xs:any construct
> and I
> 
> > >  am new to this and
> 
> > > 
> 
> > > > I read it but I do not know how I can tell
> the
> 
> > > validator to use 
> 
> > > 
> 
> > > > namespace (only runtime) which is defined in
> the
> 
> > > different schema.
> 
> > > 
> 
> > > >  
> 
> > > 
> 
> > > > Using  
> 
> > > 
> 
> > > > <xs:any
> 
> > > 
> 
> > > > >  namespace="##any"
> 
> > > processContents="strict"/>
> construct, 
> 
> > > 
> 
> > > > 
> 
> > > 
> 
> > > > I am vlidating xml instance with Validator
> which has a
> 
> > > main schema 
> 
> > > 
> 
> > > > but validator does not know second schema.
>  
> 
> > > 
> 
> > > > 
> 
> > > 
> 
> > > > Now,  how I can tell the validator during
> 
> > > validation time about the 
> 
> > > 
> 
> > > > second schema to which some elements belong
> to the
> 
> > > namespace which 
> 
> > > 
> 
> > > > is defined in the second schema.   
> 
> > > 
> 
> > > > 
> 
> > > 
> 
> > > > Thanks
> 
> > > 
> 
> > > > ajay
> 
> > > 
> 
> > > > 
> 
> > > 
> 
> > > > --- On Thu, 11/19/09, ajay bhadauria
> 
> > > <abhadau...@yahoo.com> wrote:
> 
> > > 
> 
> > > > 
> 
> > > 
> 
> > > > > From: ajay bhadauria
> 
> > > <abhadau...@yahoo.com>
> 
> > > 
> 
> > > > > Subject: Re: xs:any namespace
> resolution
> 
> > > 
> 
> > > > > To: j-users@xerces.apache.org
> 
> > > 
> 
> > > > > Date: Thursday, November 19, 2009, 6:38
> AM
> 
> > > 
> 
> > > > > Hi,
> 
> > > 
> 
> > > > > 
> 
> > > 
> 
> > > > > I am using <xs:any
> 
> > > 
> 
> > > > > > namespace="##any"
> 
> > > processContents="strict"/> and I
> 
> > > 
> 
> > > > > am validating xml instance which is
> having
> 
> > > elements which
> 
> > > 
> 
> > > > > belong to the different namespace and
> 
> > > corresponding to this
> 
> > > 
> 
> > > > > namespace, schema is not pre-loaded. I
> mean yhat
> 
> > > external
> 
> > > 
> 
> > > > > schema is not pre-loaded.
> 
> > > 
> 
> > > > > 
> 
> > > 
> 
> > > > > How do I tell Java Validator about this
> external
> 
> > > schema so
> 
> > > 
> 
> > > > > that xml instance is validated
> successfully ?
> 
> > > 
> 
> > > > > 
> 
> > > 
> 
> > > > > 
> 
> > > 
> 
> > > > > Is there any way I can tell the
> validator at the
> 
> > > time of
> 
> > > 
> 
> > > > > validation only about external schema
> which is
> 
> > > not
> 
> > > 
> 
> > > > > pre-loaded with main schema?
> 
> > > 
> 
> > > > > 
> 
> > > 
> 
> > > > > Help me in understanding whether it can
> be done
> 
> > > ???
> 
> > > 
> 
> > > > > Thanks
> 
> > > 
> 
> > > > > Ajay 
> 
> > > 
> 
> > > > > 
> 
> > > 
> 
> > > > > --- On Thu, 11/19/09, ajay bhadauria
> 
> > > <abhadau...@yahoo.com>
> 
> > > 
> 
> > > > > wrote:
> 
> > > 
> 
> > > > > 
> 
> > > 
> 
> > > > > > From: ajay bhadauria
> 
> > > <abhadau...@yahoo.com>
> 
> > > 
> 
> > > > > > Subject: xs:any namespace
> resolution
> 
> > > 
> 
> > > > > > To: j-users@xerces.apache.org
> 
> > > 
> 
> > > > > > Date: Thursday, November 19, 2009,
> 12:48 AM
> 
> > > 
> 
> > > > > > Hi,
> 
> > > 
> 
> > > > > > 
> 
> > > 
> 
> > > > > > I have schema file 1.xsd which has
> xs:any
> 
> > > schema
> 
> > > 
> 
> > > > > construct
> 
> > > 
> 
> > > > > >  
> 
> > > 
> 
> > > > > > <xs:complexType
> 
> > > name="ExtensionEnvelope">
> 
> > > 
> 
> > > > > >     
> 
> > > 
> 
> > > > >    <xs:sequence>
> 
> > > 
> 
> > > > > >         
> 
> > > 
> 
> > > > >    <xs:any
> 
> > > 
> 
> > > > > > namespace="##any"
> 
> > > processContents="strict"/>
> 
> > > 
> 
> > > > > >     
> 
> > > 
> 
> > > > >    </xs:sequence>
> 
> > > 
> 
> > > > > >     </xs:complexType>
> 
> > > 
> 
> > > > > > 
> 
> > > 
> 
> > > > > > And I try to validate xml instance
> (
> 
> > > test2.xml )
> 
> > > 
> 
> > > > > against
> 
> > > 
> 
> > > > > > this schema, it gave the following
> error
> 
> > > 
> 
> > > > > >      cvc-complex-type.2.4.c:
> The
> 
> > > 
> 
> > > > > > matching wildcard is strict, but
> no
> 
> > > declaration can be
> 
> > > 
> 
> > > > > found
> 
> > > 
> 
> > > > > > for element
> 'ns1:Document'.
> 
> > > 
> 
> > > > > > 
> 
> > > 
> 
> > > > > > However, the namespace which the
> Validator
> 
> > > is looking
> 
> > > 
> 
> > > > > for
> 
> > > 
> 
> > > > > > is in other xsd file (2.xsd). 
> 
> > > 
> 
> > > > > > 
> 
> > > 
> 
> > > > > > How do I tell Validator the
> location of
> 
> > > 2.xsd file
> 
> > > 
> 
> > > > > during
> 
> > > 
> 
> > > > > > validation ? 
> 
> > > 
> 
> > > > > > 
> 
> > > 
> 
> > > > > > The test.xml has some elements
> which belong
> 
> > > to the
> 
> > > 
> 
> > > > > > namespace
> urn:swift:xsd:$xtsn.998.001.01
> 
> > > which is
> 
> > > 
> 
> > > > > defined in
> 
> > > 
> 
> > > > > > the 2.xsd file.
> 
> > > 
> 
> > > > > > 
> 
> > > 
> 
> > > > > > 
> 
> > > 
> 
> > > > > >       
> 
> > > 
> 
> > > > > >
> 
> > > 
> 
> > > > >
> 
> > >
> ---------------------------------------------------------------------
> 
> > > 
> 
> > > > > > To unsubscribe, e-mail:
> 
> > > j-users-unsubscr...@xerces.apache.org
> 
> > > 
> 
> > > > > > For additional commands, e-mail:
> 
> > > j-users-h...@xerces.apache.org
> 
> > > 
> 
> > > > > 
> 
> > > 
> 
> > > > > 
> 
> > > 
> 
> > > > >       
> 
> > > 
> 
> > > > > 
> 
> > > 
> 
> > > > >
> 
> > >
> ---------------------------------------------------------------------
> 
> > > 
> 
> > > > > To unsubscribe, e-mail:
> 
> > > j-users-unsubscr...@xerces.apache.org
> 
> > > 
> 
> > > > > For additional commands, e-mail:
> 
> > > j-users-h...@xerces.apache.org
> 
> > > 
> 
> > > >       
> 
> > > 
> 
> > > > 
> 
> > > 
> 
> > > >
> 
> > >
> ---------------------------------------------------------------------
> 
> > > 
> 
> > > > To unsubscribe, e-mail:
> 
> > > j-users-unsubscr...@xerces.apache.org
> 
> > > 
> 
> > > > For additional commands, e-mail:
> 
> > > j-users-h...@xerces.apache.org
> 
> > > 
> 
> > >
> 
> > 
> 
> > 
> 
> >       [attachment
> "SchemaReader.java" deleted by Michael 
> 
> > Glavassevich/Toronto/IBM] 
> 
> >
> ---------------------------------------------------------------------
> 
> > To unsubscribe, e-mail:
> j-users-unsubscr...@xerces.apache.org
> 
> > For additional commands, e-mail:
> j-users-h...@xerces.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-users-h...@xerces.apache.org

Reply via email to