Hello all.  I have a Document object that I need to cast down to its specific 
implementation type (DocumentImpl or perhaps a different implementation like 
TXDocument).  My code looks something like this:

//Get a Document object from a Document factory
Document doc = factory.getDocument();
return process(doc);

private Document process(DocumentImpl doc) {
 //Process the document using implementation specific code
}

private Document process(TXDocument doc) {
 //Process the document using implementation specific code
}


Obviously before I call the process method I need to convert my Document object 
to its specific implementation (which could change depending on what the 
factory gives me).  I'm rather stumped as to how to do this.  Conceptually, I'm 
thinking something along the lines of:

String className = doc.getClass().getName();
//Now cast the doc object to my className
return process( (className)doc);

However, obviously that is not legal.  But hopefully you get the idea of what 
I'm trying to do--it's a little difficult to explain.  This is probably a 
little off-topic because it's not necessarily a Xerces specific question, but I 
thought that with all the Java/Document experience out there someone might have 
an idea for me.  Thanks in advance!

Ben Lors

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to