Hello,

I'm using SAX to implement a data layer which permits object serialization 
across Java and C++. Without going into the library which does the grunt work, 
I'd like to describe a problem I'm facing.

A (Java) class that is code generated from an XML specification can contain a 
constructor that tries to initialise a class attribute which is a class, which 
itself takes an XML specification, ie

String default_ship = 
"<Ships.BattleCruiser><name>XXX</name><type>YYY</type>......</Ships.BattleCruiser>";
Ship my_default_ship = ObjectReader.readObject(default_ship);

As you can see ObjectReader returns the instantiated Ship object.
ObjectReader calls my DefaultHandler to parse the XML and create the object in 
question.


The problem  I am having is that while parsing an XML document (or string) and 
creating objects (via reflection), if I try to create an object which in turns 
performs the above operation in it's constructor, the operation is does not 
procede linearly. In other words: (In default handler)

while (something) {
clazz = Class.forName(qName); // always called
classObject = clazz.newI        nstance(); // 
}

if clazz.newInstance needs to parse an XML string via XERCES-J, the program 
execution doesn't procede linearly, with the DefaultHandler somehow continuing 
without waiting for the newInstance() call to return.

I would have thought, that even if a new call to XERCES was made, that the 
above code would have blocked until it's return. However, it does not.


Could someone please explain to me how XERCES handles recursive calls (ie 
multithreaded, process stacks ... ???) and hopefully, how I could make the 
above code block until the new XERCES parsing returns?


Many thanks to all your help. It is much appreciated.


 
Rod Farmer
 
========================================
Rod Farmer
Software Engineer
KESEM International
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>,



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

Reply via email to