"Lors, Ben" wrote:
> 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!
Try the instanceof operator.
if ( doc instanceof DocumentImpl )
return process((DocumentImpl)doc);
If you won't know the classes ahead of time, you can always create an
interface, implement a handler for specific class types and then map the
class name to the handler.
--
Tom Bradford --- The dbXML Project --- http://www.dbxml.org/
We store your XML data a hell of a lot better than /dev/null
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]