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 Ranjan Baisak <ra...@gmail.com> on 2005/02/23 08:23:18 UTC
How to use org.apache.xerces.dom.DeferredDocumentImpl
Hi,
Can anybody give me any code example of usage of
org.apache.xerces.dom.DeferredDocumentImpl. I trying to cast
org.w3c.dom.Document to org.apache.xerces.dom.DeferredDocumentImpl but
it gives classcastexception though I am using Xerces parser.
Any help would be appreciated.
regards,
Ranjan
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: How to use org.apache.xerces.dom.DeferredDocumentImpl
Posted by James Shaw <he...@btopenworld.com>.
Ranjan Baisak wrote:
>Thanks James for your insight into the implementation.
>Let me tell you the scenario.
>
[snip code]
>
>Is there any otherway to achieve the same with JDK1.4.2?
>
>
>
Well, this is all DOM Level 3 stuff, so you'll need to build your own
Xerces jars with dom3 support enabled.
Download the latest release source and run the jars-dom3 target. Then
make sure you include the resultant jars in your classpath.
Hope that helps,
James Shaw
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: How to use org.apache.xerces.dom.DeferredDocumentImpl
Posted by Ranjan Baisak <ra...@gmail.com>.
Thanks James for your insight into the implementation.
Let me tell you the scenario. My source code
System.setProperty(DOMImplementationRegistry.PROPERTY,
"org.apache.xerces.dom.DocumentImpl");
DOMImplementationRegistry registry =
DOMImplementationRegistry.newInstance();
DOMImplementationLS impl =
(DOMImplementationLS)registry.getDOMImplementation("LS");
LSParser builder = impl.createLSParser(
DOMImplementationLS.MODE_SYNCHRONOUS, null);
org.apache.xerces.dom.DeferredDocumentImpl document =
(org.apache.xerces.dom.DeferredDocumentImpl)builder.parseURI("personal.xml");
The above line of code gives me ClassCastException.
org.apache.xerces.dom.DeferredDocumentImpl extends
org.apache.xerces.dom.DocumentImpl so I tried to cast it to
org.apache.xerces.dom.DocumentImpl. The above code uses JDK1.5.
Is there any otherway to achieve the same with JDK1.4.2?
regards,
Ranjan
On Wed, 23 Feb 2005 13:39:02 +0000, James Shaw
<he...@btopenworld.com> wrote:
> Ranjan Baisak wrote:
>
> >Hi,
> > Can anybody give me any code example of usage of
> >org.apache.xerces.dom.DeferredDocumentImpl. I trying to cast
> >org.w3c.dom.Document to org.apache.xerces.dom.DeferredDocumentImpl but
> >it gives classcastexception though I am using Xerces parser.
> >Any help would be appreciated.
> >
> >
> >
> >
> The implementation class you get depends on what factory use are using
> to get a document, and the parameters you give to that factory. IIRC,
> Using JAXP's DocumentBuilder gives you a CoreDocumentImpl; using DOM
> Level 3 DOMImplementationRegistry to request a Load&Save
> DOMImplementation will give you a DeferredDocumentImpl (I think).
>
> If you give some more context to your problem, I might be able to help
> you better :-)
>
> James Shaw
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: How to use org.apache.xerces.dom.DeferredDocumentImpl
Posted by James Shaw <he...@btopenworld.com>.
Ranjan Baisak wrote:
>Hi,
> Can anybody give me any code example of usage of
>org.apache.xerces.dom.DeferredDocumentImpl. I trying to cast
>org.w3c.dom.Document to org.apache.xerces.dom.DeferredDocumentImpl but
>it gives classcastexception though I am using Xerces parser.
>Any help would be appreciated.
>
>
>
>
The implementation class you get depends on what factory use are using
to get a document, and the parameters you give to that factory. IIRC,
Using JAXP's DocumentBuilder gives you a CoreDocumentImpl; using DOM
Level 3 DOMImplementationRegistry to request a Load&Save
DOMImplementation will give you a DeferredDocumentImpl (I think).
If you give some more context to your problem, I might be able to help
you better :-)
James Shaw
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org