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 Sagara Gunathunga <sa...@gmail.com> on 2009/09/13 12:22:18 UTC
Set EntityResolver to the SchemaFactory
Hi all ,
As we set org.xml.sax.EntityResolver to the DocumentBuilder using
DocumentBuilder#setEntityResolver(entityResolver) method, is there any
way to provide a EntityResolver to the SchemaFactory so that it will
utilize EntityResolver when we call the
schemaFactory#newSchema(schemaSources) method ?
To clarify my scenario, every time my program reading Schema over the
Net (e.g http://www.w3.org/2007/03/wsdl/wsdl20.xsd ) this cause in to
performance problem and also some exceptions in offline mode, to get
rid of this I want to use EntityResolver with SchemaFactory .
Thanks,
--
Sagara Gunathunga
Blog - http://ssagara.blogspot.com
Web - http://people.apache.org/~sagara/
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
Re: Set EntityResolver to the SchemaFactory
Posted by Stanimir Stamenkov <s7...@netscape.net>.
Sun, 13 Sep 2009 17:21:02 +0530, /Sagara Gunathunga/:
> On Sun, Sep 13, 2009 at 4:45 PM, Stanimir Stamenkov <s7...@netscape.net> wrote:
>
>> http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/validation/SchemaFactory.html#setResourceResolver(org.w3c.dom.ls.LSResourceResolver)
>
> I don't think resourceResolver is help out for me.
>
> 1.) It take LSResourceResolver as a argument but i want to use
> org.xml.sax.EntityResolver. Even though LSResourceResolver based on
> org.xml.sax.EntityResolver, it doesn't implements EntityResolver.
>
> 2.) May be i can create a adapter class for point-1 but again
> LSResourceResolver returns LSInput while EntityResolver returns
> InputSource , AFAIK in here only possible way is fill LSInput object
> manually from InputSource properties.
Yes, the classes come from different libraries but their purpose is
the same and creating an adapter or just implementing
LSResourceResolver should be pretty straightforward.
> 3.) This approach is based on DOM L3 Spec still some of the parsers
> doesn't support for this it would be nice if i can use Sax
> EntityResolver here .
I don't get your point here. SchemaFactory is part of JAXP 1.3 as
the DOM Level 3 LS APIs are. If you're using SchemaFactory the JAXP
implementation must implement it so it supports LSResourceResolver
as it is a property of the SchemaFactory.
--
Stanimir
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
Re: Set EntityResolver to the SchemaFactory
Posted by Sagara Gunathunga <sa...@gmail.com>.
I don't think resourceResolver is help out for me.
1.) It take LSResourceResolver as a argument but i want to use
org.xml.sax.EntityResolver. Even though LSResourceResolver based on
org.xml.sax.EntityResolver, it doesn't implements EntityResolver.
2.) May be i can create a adapter class for point-1 but again
LSResourceResolver returns LSInput while EntityResolver returns
InputSource , AFAIK in here only possible way is fill LSInput object
manually from InputSource properties.
3.) This approach is based on DOM L3 Spec still some of the parsers
doesn't support for this it would be nice if i can use Sax
EntityResolver here .
Thanks,
On Sun, Sep 13, 2009 at 4:45 PM, Stanimir Stamenkov <s7...@netscape.net> wrote:
> Sun, 13 Sep 2009 15:52:18 +0530, /Sagara Gunathunga/:
>
>> As we set org.xml.sax.EntityResolver to the DocumentBuilder using
>> DocumentBuilder#setEntityResolver(entityResolver) method, is there any way
>> to provide a EntityResolver to the SchemaFactory so that it will utilize
>> EntityResolver when we call the schemaFactory#newSchema(schemaSources)
>> method ?
>>
>> To clarify my scenario, every time my program reading Schema over the Net
>> (e.g http://www.w3.org/2007/03/wsdl/wsdl20.xsd ) this cause in to
>> performance problem and also some exceptions in offline mode, to get rid of
>> this I want to use EntityResolver with SchemaFactory .
>
> I guess you just need to set 'resourceResolver' of the SchemaFactory:
>
> http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/validation/SchemaFactory.html#setResourceResolver(org.w3c.dom.ls.LSResourceResolver)
>
> --
> Stanimir
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
>
>
--
Sagara Gunathunga
Blog - http://ssagara.blogspot.com
Web - http://people.apache.org/~sagara/
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
Re: Set EntityResolver to the SchemaFactory
Posted by Stanimir Stamenkov <s7...@netscape.net>.
Sun, 13 Sep 2009 15:52:18 +0530, /Sagara Gunathunga/:
> As we set org.xml.sax.EntityResolver to the DocumentBuilder using
> DocumentBuilder#setEntityResolver(entityResolver) method, is there any
> way to provide a EntityResolver to the SchemaFactory so that it will
> utilize EntityResolver when we call the
> schemaFactory#newSchema(schemaSources) method ?
>
> To clarify my scenario, every time my program reading Schema over the
> Net (e.g http://www.w3.org/2007/03/wsdl/wsdl20.xsd ) this cause in to
> performance problem and also some exceptions in offline mode, to get
> rid of this I want to use EntityResolver with SchemaFactory .
I guess you just need to set 'resourceResolver' of the SchemaFactory:
http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/validation/SchemaFactory.html#setResourceResolver(org.w3c.dom.ls.LSResourceResolver)
--
Stanimir
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org