Re: [bdbxml] XMLInputStreams and regular InputStreams and w3c DOM objects.

"Mark R. Diggory" <mdiggory-Mahy8Y1M33PaZwrp7/[email protected]> Sun, 25 Sep 2005 13:54:26 -0400
Newsgroups gmane.comp.db.dbxml.general
Message-ID <[email protected]>
I'd also really like to be able to connect the container easily to JAXP 
Transform StreamResult classes. Actually, these are not InputStreams 
(used in Java to read content (less than write it) but Writers and 
OutputStreams. See:

http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/transform/stream/StreamResult.html

Its this kind of Streaming and Chaining which would really make the 
bdbxml api more useful both for reading contents and writing contents.

-Mark

Mark R. Diggory wrote:
> I see this as difficult because the class isn't really an InputStream
> but more or less a handle on a C InputStream. I can read from the stream
> in java (C++ --> Java) when accessing the contents of the container but
> I'm not sure if I can have the XMLContainer read the inputstream from
> Java (Java --> C++) without actually having to subclass the C++ version
> of XMLInputStream?
> 
>> XmlInputStream is a pure virtual interface. In C++, you can subclass
>> XmlInputStream, and pass an instance of your class to any of the
>> methods that take it as a parameter, such as
>> XmlContainer.putDocument(com.sleepycat.dbxml.XmlDocument,
>> com.sleepycat.dbxml.XmlUpdateContext). This is especially useful for
>> streaming XML from an application directly into Berkeley DB XML
>> without first converting it to a string.
> 
> 
> Does this mean I can Implement XMLInputStream in Java and use it there, 
> or I have to Implement it in C++ and instantiate it using a JNI/SWIG the 
> way that they are created using XMLManager?
> 
>>   public XmlInputStream createURLInputStream(String baseId, String 
>> systemId) throws XmlException {
>>     long cPtr = 
>> dbxml_javaJNI.XmlManager_createURLInputStream__SWIG_1(swigCPtr, 
>> baseId, systemId);
>>     return (cPtr == 0) ? null : new XmlInputStream(cPtr, false);
>>   }
> 
> 
> -Mark Diggory
> 
> 
> Ingo Lütkebohle wrote:
> 
>> I've never tested it in Java but in C++, you can easily subclass 
>> XmlInputStream and implement custom I/O.  Implementing the Interface
>> on top of a regular Java InputStream should be possible, too.
>>
>> On 9/25/05, *Mark R. Diggory* <mdiggory-Mahy8Y1M33PaZwrp7/[email protected] 
>> <mailto:mdiggory-Mahy8Y1M33PaZwrp7/[email protected]>> wrote:
>>
>> I'm looking to see if there is a way that I can take a pre-existing 
>> java.io.InputStream in Java and place its contents in bdbxml. I 
>> understand that I can create "XMLInputStreams" to the Database, but 
>> these are not true InputStreams. Its clear that there is no
>> capability to Stream my content directly through the Java API (that
>> the Java API is just providing handles on the native streams, but no
>> access to them) unless I've missed something.
>>
>> Is there any way I can read my java.io.InputStream into the db
>> without putting all the contents in a String or tmp file?
>>
>> -Mark
>>
>>
>> ------------------------------------------ To remove yourself from
>> this list, send an email to [email protected] 
>> <mailto:[email protected]>
>>
>>
> 


------------------------------------------
To remove yourself from this list, send an
email to [email protected]