Stream Object Model

Hi everybody,

I am trying to insert XML Docs using the Stream Object Model! I get always the same error:

Reading from character input stream caused problems
NestedException:http://apache.org/xml/features/nonvalidating/load-external-dtd

Although if I try to do the same usin DOM Object Model, It works great!

Thx
Fady

Fady Kaddoum

hi fady,

do you - for testing - print the character stream before inserting?

you must not do this, as then the stream is “consumed”, that is “read empty”.

if this is not the case: how do you create the data stream? how do you pass it to the insert method?

regards,
andreas f.

Yes you are right, actually I was printing the string to see if the structure of the XML file was Ok. I removed it, and still it is not working!
Find attached the commented piece of code that might give you an idea on how I am doing to insert the stream.

Thx

Fady Kaddoum
MyCode.txt (568 Bytes)

Hi Fady,

What kind of error are you getting?

Here is an example of how to use the stream interface to insert a document.

import com.softwareag.tamino.db.api.accessor.TStreamAccessor;
import com.softwareag.tamino.db.api.accessor.TAccessLocation;
import com.softwareag.tamino.db.api.common.TException;
import com.softwareag.tamino.db.api.connection.TConnection;
import com.softwareag.tamino.db.api.connection.TConnectionFactory;
import com.softwareag.tamino.db.api.objectModel.TXMLObject;
import java.io.IOException;
 
public class StreamInsert
{
    public StreamInsert() throws IOException
    {
	try { 
          //Get Connection to the database
          TConnection connection =   TConnectionFactory.getInstance().newConnection("<Tamino URL>");
 
          //Get the Accessor to the appropriate Collection
          TStreamAccessor accessor = connection.newStreamAccessor(TAccessLocation.newInstance("<Collection>"));
          TXMLObject obj = TXMLObject.newInstance("<test>some stuff</test>");
          accessor.insert(obj);
          connection.close();
	} 
      catch (TException taminoException) {
          taminoException.printStackTrace();
      }
    }

    public static void main(String argv[]) throws IOException{
      StreamInsert si = new StreamInsert();
    }
}



Regards,
Puny Sen

[This message was edited by Puny Sen on 01 Nov 2002 at 05:57.]

[This message was edited by Puny Sen on 01 Nov 2002 at 05:59.]

[This message was edited by Puny Sen on 01 Nov 2002 at 06:00.]

Hi,

Ok will check this first thing in the morning on Monday and will tell you know what will happen!

Thx a lot
Fady

Fady Kaddoum

Hello,

Well it worked but bizarre!

I uninstalled Tamino and removed all databses and then installed it again and created a fresh database with a new collection but the same schema. Then I used the SAME code, and there it worked!

Thx anyway!
Fad

Fady Kaddoum