S
Stryder
I'm trying to do something that should be simple. In Oracle 11g, I'm
trying to write a Java stored procedure that applies an XSLT
stylesheet to an XML document and returns it as type XMLType.
Here's a snippet that shows the question...
public static XMLType bwdtransform(oracle.sql.CLOB documentText)
throws Exception {
// ==============================
// This works - oracle.xml.parser.v2.DOMParser parses the incoming
CLOB into an
// oracle.xml.parser.v2.XMLDocument
// ==============================
parser.parse(documentText.getCharacterStream());
XMLDocument xmlDocument = (XMLDocument) parser.getDocument();
// ==============================
// This works - applies adopterXSLT, which is a
oracle.xml.parser.v2.XSLStylesheet,
// to the XMLDocument, returning an XMLDocumentFragment. It'd
solve the problem
// if this could return an XMLDocument, but it doesn't
// ==============================
XMLDocumentFragment xmlDocumentFragment = processor.processXSL
(adopterXSLT, xmlDocument);
// ==============================
// This DOES NOT work. XMLType requires an XMLDocument, not an
XMLDocumentFragment
// as its second parameter. I can find no way to translate an
XMLDocumentFragment into
// an XMLDocument, an XMLType, or even serialize it to a string.
// ==============================
return new XMLType(conn, xmlDocumentFragment);
}
Any help in returning the result of applying the stylesheet as an
XMLType would be very
very greatly appreciated.
Thanks.
Ralph
trying to write a Java stored procedure that applies an XSLT
stylesheet to an XML document and returns it as type XMLType.
Here's a snippet that shows the question...
public static XMLType bwdtransform(oracle.sql.CLOB documentText)
throws Exception {
// ==============================
// This works - oracle.xml.parser.v2.DOMParser parses the incoming
CLOB into an
// oracle.xml.parser.v2.XMLDocument
// ==============================
parser.parse(documentText.getCharacterStream());
XMLDocument xmlDocument = (XMLDocument) parser.getDocument();
// ==============================
// This works - applies adopterXSLT, which is a
oracle.xml.parser.v2.XSLStylesheet,
// to the XMLDocument, returning an XMLDocumentFragment. It'd
solve the problem
// if this could return an XMLDocument, but it doesn't
// ==============================
XMLDocumentFragment xmlDocumentFragment = processor.processXSL
(adopterXSLT, xmlDocument);
// ==============================
// This DOES NOT work. XMLType requires an XMLDocument, not an
XMLDocumentFragment
// as its second parameter. I can find no way to translate an
XMLDocumentFragment into
// an XMLDocument, an XMLType, or even serialize it to a string.
// ==============================
return new XMLType(conn, xmlDocumentFragment);
}
Any help in returning the result of applying the stylesheet as an
XMLType would be very
very greatly appreciated.
Thanks.
Ralph