dbTalk Databases Forums  

XSLT in BDBXML

comp.databases.berkeley-db comp.databases.berkeley-db


Discuss XSLT in BDBXML in the comp.databases.berkeley-db forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Gauravani
 
Posts: n/a

Default XSLT in BDBXML - 12-29-2005 , 03:05 PM






Is it possible to pull an XSLT document from BDBXML to have it
transform another XML document located in BDBXML? I am having the
hardest time trying to get this to work and I am wondering if BDBXML
does something to the file to prevent it from being used in a
Transformer.

Here is some sample code:

***** BEGIN CODE *****

xmlDocument =
VyasaPlugin.getXmlManager().openContainer(containe rName).getDocument(xmlDocumentName);

xslDocument =
VyasaPlugin.getXmlManager().openContainer(containe rName).getDocument(xslDocumentName);

TransformerFactory transformerFactory =
TransformerFactory.newInstance();

StreamSource documentStreamSource =
new StreamSource(new
InputStreamReader(xmlDocument.getContentAsInputStr eam()));

StreamSource stylesheetStreamSource =
new StreamSource(new
InputStreamReader(xslDocument.getContentAsInputStr eam()));

Transformer transformer =
transformerFactory.newTransformer(stylesheetStream Source);

StreamResult streamResult = new StreamResult();

transformer.transform(documentStreamSource, streamResult);

BrowserView.setText(streamResult.getOutputStream() .toString());

***** END CODE *****

While running, once the code gets to the point where it creates the
transformer the following error occurs:
(Location of error unknown)java.io.IOException: Underlying input stream
returned zero bytes

When I debug, all of the documents and their contents load properly. My
question is does BDBXML have a limitation in this regard, or am I doing
something wrong in the code. Thanks in advance for any help.


Reply With Quote
  #2  
Old   
George Feinberg
 
Posts: n/a

Default Re: XSLT in BDBXML - 01-02-2006 , 07:32 PM







Hello,

Where is the Transformer code coming from?
There are no specific limitiations in the InputStream you
get from BDB XML; however, there is a possible issue -- it
does not implement the available() method (default returns 0)
because it does not know how many bytes are truly available.
If the Transformer code uses available(), that could be a problem.

It's possible that it should return some other default.
You might try implementing this yourself in the source -- see
dbxml/src/java/com/sleepycat/dbxml/XmlInputStreamWrap.java.
It has no available() method.

For further correspondence, please email me directly, as I do not
follow this news group closely.

Regards,

George Feinberg
Sleepycat Software

Gauravani wrote:
Quote:
Is it possible to pull an XSLT document from BDBXML to have it
transform another XML document located in BDBXML? I am having the
hardest time trying to get this to work and I am wondering if BDBXML
does something to the file to prevent it from being used in a
Transformer.

Here is some sample code:

***** BEGIN CODE *****

xmlDocument =
VyasaPlugin.getXmlManager().openContainer(containe rName).getDocument(xmlDocumentName);

xslDocument =
VyasaPlugin.getXmlManager().openContainer(containe rName).getDocument(xslDocumentName);

TransformerFactory transformerFactory =
TransformerFactory.newInstance();

StreamSource documentStreamSource =
new StreamSource(new
InputStreamReader(xmlDocument.getContentAsInputStr eam()));

StreamSource stylesheetStreamSource =
new StreamSource(new
InputStreamReader(xslDocument.getContentAsInputStr eam()));

Transformer transformer =
transformerFactory.newTransformer(stylesheetStream Source);

StreamResult streamResult = new StreamResult();

transformer.transform(documentStreamSource, streamResult);

BrowserView.setText(streamResult.getOutputStream() .toString());

***** END CODE *****

While running, once the code gets to the point where it creates the
transformer the following error occurs:
(Location of error unknown)java.io.IOException: Underlying input stream
returned zero bytes

When I debug, all of the documents and their contents load properly. My
question is does BDBXML have a limitation in this regard, or am I doing
something wrong in the code. Thanks in advance for any help.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.