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
<hertzsprrrung@xxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxx
> For additional commands, e-mail: xerces-j-user-help@xxxxxxxxxxxxxx
>
>
|