Re: [bdbxml] XMLInputStreams and regular InputStreams and w3c DOM objects.
"Mark R. Diggory" <mdiggory-Mahy8Y1M33PaZwrp7/[email protected]> Wed, 28 Sep 2005 10:38:20 -0400
| Newsgroups | gmane.comp.db.dbxml.general |
|---|---|
| Message-ID | <[email protected]> |
My example failed to show this case clearly, heres a better one:
> JAXP Transformer --> JAXP Result --> OutputStream --> XMLDocument --> DB
Transformer trans = TransformerFactory.newFactory().newTransformer();
XMLDocument doc = ...;
trans.transform(
new StreamSource(my_input_stream),
new StreamResult(doc.getContentWriter())
);
Point being that the result of the transform could get pushed to the
writer or OutputStream gotten from the XMLDocument. The writer would be
used to push the content into the XMLDocument.
-Mark
Mark R. Diggory wrote:
> John,
>
> This is great for "pulling" contents of the db.
>
> DB --> XMLDocument --> InputStream --> JAXP Source
>
> Will it work for writing? Seems BDBXML uses a "pull" strategy for
> writing to the DB as well this is somewhat different than JAXP where
> transform results are "pushed" to an output stream.
>
> JAXP Transformer --> JAXP Result --> OutputStream --> XMLDocument --> DB
>
> In JAXP, "StreamResult" can take a Writer or an OutputStream as a target
> for writing XSLT output to. Is there an analog to this in the DB? For
> instance XMLOutputStream which one could push transform results into the
> DB with?
>
>
> Finally an example of this usage would be in the XQuery API,
>
> XMLResult is the product of an XQuery executed against the DB. I can see
> the need for multiple result formats for XMLResults as well, for this I
> do see that I can get back an XMLDocument as opposed to an XMLValue DOM:
>
> XMLResult.next(XmlDocument document)
>
> For instance, I may want to stream XMLResults directly to an
> OutputStream without retaining the XMLValues in memory (System.out or
> ServletResponse.getWriter())
>
> ...
> XMLResult result = ...;
> XMLDocument doc = null;
> result.next(doc);
>
> Question: When completing an XMLQuery against the DB, are the results in
> memory (as XMLValues) at execution or are they completed as I iterate
> over the XMLResult? The question is more specifically, If I can do
> something like "result.next(doc);" is the XMLDocument just backed by the
> in-memory XMLValue DOM or is it backed directly by the Database?
>
> Either way I can use a JAXP identity transform to push the document to
> an OutputStream
>
> Transformer trans = TransformerFactory.newFactory().newTransformer();
>
> trans.transform(
> new StreamSource(doc.getContentAsXmlInputStream()),
> new StreamResult(System.out)
> );
>
> -Mark Diggory
>
> John Snelson wrote:
>
>> Moe wrote:
>>
>>> OK, and how am I supposed to use:
>>>
>>> public XmlInputStream createURLInputStream(String baseId,
>>> String systemId,
>>> String publicId)
>>>
>>> What are baseId, systemId and publicId standing for? Are there any usage
>>> examples online?
>>
>>
>>
>> mgr.createURLInputStream("", "file:...", "");
>>
>> The good news is that I spent a day working on the Java version of
>> XmlInputStream, and I have now made it so that it can be properly
>> derived from. I have also implemented a constructor function for an
>> XmlInputStream that takes a java.io.InputStream - so you will be able
>> to use your favourite java stream instead. This will be available in
>> the 2.2 release of DB XML - which should be out pretty soon.
>>
>> John
>>
>
>
> ------------------------------------------
> To remove yourself from this list, send an
> email to [email protected]
>
------------------------------------------
To remove yourself from this list, send an
email to [email protected]