XSLT using XSU
I am trying to use the current Oracle XDK, in particular the XSU java
libraries to retrieve XML from a sql query. In order to generate the final
XML file I need to apply an XSLT. When using the OracleXMLQuery object to
set the XSLT I get the following run time exception:
java.lang.NoClassDefFoundError: oracle/sql/OPAQUE thrown from
oracle.xml.sql.query.OracleXMLQuery.setXSLT(OracleXMLQuery.java:779).
The libraries I included in my classpath are as follows:
xmlparserv2.jar
xchema.jar
xsu12.jar
oraclesxql.jar
classgen.jar
classes12.zip
nls_charset12.zip
jdk1.3
I'm not really sure what I am missing here. Any help would be greatly
appreciated.
BTW: everything works fine if I don't call the setXSLT method of the
OracleXMLQuery object
oracle/sql/OPAQUE class is in classes12.jar.
Please send your sample for me to test.
Thanks.
Similar Messages
-
How to apply XSLT to XML file while importing XML data using XSU plsql API
I need to load XML file with nested repeating elements into Oracle tables and I am using XSU PLSQL API utility package dbms_xmlSave.insertXML. Can use XMLGen package also!!
I found out through documentation that I need to have XML file with ROWSET/ROW tags around the elements. As I have no control of XML file coming from external source, so I wish to apply XSLT to XML. I found setXSLT/setStylesheet procedures but it's not working as expected.
Can you help me with some sample code for the purpose.
ThanksI'm new at XML and XSL as well, but maybe the following code I built can help:
CREATE OR REPLACE PACKAGE Xml_Pkg AS
/* this record and table type are used for the transformTags procedure */
TYPE TagTransform_t IS RECORD (
old_tag VARCHAR2(255),
new_tag VARCHAR2(255) );
TYPE TagTransformList_t IS TABLE OF TagTransform_t INDEX BY BINARY_INTEGER;
/* use DBMS_OUTPUT to print out a CLOB */
PROCEDURE printClobOut(p_clob IN OUT NOCOPY CLOB);
/* using a list of old/new tags, transform all old into new in XML2 */
PROCEDURE transformTags(
p_List TagTransformList_t,
p_XML1 IN OUT NOCOPY CLOB,
p_XML2 IN OUT NOCOPY CLOB);
END Xml_Pkg;
CREATE OR REPLACE PACKAGE BODY Xml_Pkg AS
/* print a CLOB using newlines */
PROCEDURE printClobOut(p_clob IN OUT NOCOPY CLOB) IS
buffer_overflow EXCEPTION;
PRAGMA EXCEPTION_INIT(buffer_overflow,-20000);
l_offset NUMBER;
l_len NUMBER;
l_o_buf VARCHAR2(255);
l_amount NUMBER; --}
l_f_amt NUMBER := 0; --}To hold the amount of data
l_f_amt2 NUMBER; --}to be read or that has been
l_amt2 NUMBER := -1; --}read
l_offset2 NUMBER;
l_amt3 NUMBER;
l_chk NUMBER := 255;
BEGIN
l_len := DBMS_LOB.GETLENGTH(p_clob);
l_offset := 1;
WHILE l_len > 0 LOOP
l_amount := DBMS_LOB.INSTR(p_clob,CHR(10),l_offset,1);
--Amount returned is the count from the start of the file,
--not from the offset.
IF l_amount = 0 THEN
--No more linefeeds so need to read remaining data.
l_amount := l_len;
l_amt2 := l_amount;
ELSE
l_f_amt2 := l_amount; --Store position of next LF
l_amount := l_amount - l_f_amt; --Calc position from last LF
l_f_amt := l_f_amt2; --Store position for next time
l_amt2 := l_amount - 1; --Read up to but not the LF
END IF;
/* divide the read into 255 character chunks for dbms_output */
IF l_amt2 != 0 THEN
l_amt3 := l_amt2;
l_offset2 := l_offset;
WHILE l_amt3 > l_chk LOOP
DBMS_LOB.READ(p_clob,l_chk,l_offset2,l_o_buf);
DBMS_OUTPUT.PUT_LINE(l_o_buf);
l_amt3 := l_amt3 - l_chk;
l_offset2 := l_offset2 + l_chk;
END LOOP;
IF l_amt3 != 0 THEN
DBMS_LOB.READ(p_clob,l_amt3,l_offset2,l_o_buf);
DBMS_OUTPUT.PUT_LINE(l_o_buf);
END IF;
END IF;
l_len := l_len - l_amount;
l_offset := l_offset+l_amount;
END LOOP;
EXCEPTION
WHEN buffer_overflow THEN
RETURN;
END printClobOut;
/* shortcut "writeline" procedure for CLOB buffer writes */
PROCEDURE wr(p_clob IN OUT NOCOPY CLOB, s VARCHAR2) IS
BEGIN
DBMS_LOB.WRITEAPPEND(p_clob,LENGTH(s)+1,s||CHR(10));
END;
/* the standard XSLT should include the identity template or the output XML will be malformed */
PROCEDURE newXsltHeader(p_xsl IN OUT NOCOPY CLOB, p_identity_template BOOLEAN DEFAULT TRUE) IS
BEGIN
DBMS_LOB.TRIM(p_xsl,0);
/* standard XSL header */
wr(p_xsl,'<?xml version="1.0"?>');
/* note that the namespace for the xsl is restricted to the w3 1999/XSL */
wr(p_xsl,'<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">');
IF p_identity_template THEN
/* create identity template (transfers all "other" nodes) */
wr(p_xsl,' <xsl:template match="node()">');
wr(p_xsl,' <xsl:copy>');
wr(p_xsl,' <xsl:apply-templates/>');
wr(p_xsl,' </xsl:copy>');
wr(p_xsl,' </xsl:template>');
END IF;
END newXsltHeader;
PROCEDURE newXsltFooter(p_xsl IN OUT NOCOPY CLOB) IS
BEGIN
/* standard xsl footer */
wr(p_xsl,'</xsl:stylesheet>');
END newXsltFooter;
/* using the stylesheet in p_xsl, transform p_XML1 into p_XML2 */
PROCEDURE transformXML(p_xsl IN OUT NOCOPY CLOB, p_XML1 IN OUT NOCOPY CLOB, p_XML2 IN OUT NOCOPY CLOB) IS
l_parser XMLPARSER.Parser;
l_doc XMLDOM.DOMDocument;
l_xsl_proc XSLPROCESSOR.Processor;
l_xsl_ss XSLPROCESSOR.Stylesheet;
BEGIN
/* parse XSL CLOB */
l_parser := XMLPARSER.newParser;
BEGIN
XMLPARSER.showWarnings(l_parser,TRUE);
XMLPARSER.parseClob(l_parser,p_xsl);
l_doc := XMLPARSER.getDocument(l_parser);
XMLPARSER.freeParser(l_parser);
EXCEPTION
WHEN OTHERS THEN
XMLPARSER.freeParser(l_parser);
RAISE;
END;
/* get Stylesheet from DOMDOC */
l_xsl_ss := XSLPROCESSOR.newStylesheet(l_doc,NULL);
BEGIN
/* parse XML1 CLOB */
l_parser := XMLPARSER.newParser;
BEGIN
XMLPARSER.showWarnings(l_parser,TRUE);
XMLPARSER.parseClob(l_parser,p_xml1);
l_doc := XMLPARSER.getDocument(l_parser);
XMLPARSER.freeParser(l_parser);
EXCEPTION
WHEN OTHERS THEN
XMLPARSER.freeParser(l_parser);
RAISE;
END;
/* process doc to XML2 */
l_xsl_proc := XSLPROCESSOR.newProcessor;
BEGIN
XSLPROCESSOR.processXSL(l_xsl_proc, l_xsl_ss, l_doc, p_xml2);
XSLPROCESSOR.freeProcessor(l_xsl_proc);
EXCEPTION
WHEN OTHERS THEN
XSLPROCESSOR.freeProcessor(l_xsl_proc);
RAISE;
END;
XSLPROCESSOR.freeStylesheet(l_xsl_ss);
EXCEPTION
WHEN OTHERS THEN
XSLPROCESSOR.freeStylesheet(l_xsl_ss);
RAISE;
END;
END transformXML;
/* transform XML1 into XML2 using list p_List of old/new tags */
PROCEDURE transformTags(p_List TagTransformList_t, p_XML1 IN OUT NOCOPY CLOB, p_XML2 IN OUT NOCOPY CLOB) IS
l_xsl CLOB;
BEGIN
/* create XSL CLOB */
DBMS_LOB.CREATETEMPORARY(l_xsl,TRUE);
/* create standard header with identity template */
newXsltHeader(l_xsl,TRUE);
/* create one template for each node translation */
FOR i IN 1..p_List.COUNT LOOP
wr(l_xsl,' <xsl:template match="'||p_List(i).old_tag||'">');
wr(l_xsl,' <'||p_List(i).new_tag||'><xsl:apply-templates/></'||p_List(i).new_tag||'>');
wr(l_xsl,' </xsl:template>');
END LOOP;
/* create standard footer */
newXsltFooter(l_xsl);
-- dbms_output.put_line('l_xsl:');
-- dbms_output.put_line('--------------------');
-- printClobOut(l_xsl);
-- dbms_output.put_line('--------------------');
transformXML(l_xsl, p_XML1, p_XML2);
DBMS_LOB.FREETEMPORARY(l_xsl);
/* -- unit testing
set serveroutput on size 100000
Declare
queryContext DBMS_XMLQUERY.ctxType;
xList XML_PKG.TagTransformList_t;
xmlCLOB CLOB;
xmlCLOB2 CLOB;
Begin
DBMS_LOB.CREATETEMPORARY(xmlCLOB,true);
DBMS_LOB.CREATETEMPORARY(xmlCLOB2,true);
xList(1).old_tag := 'A';
xList(1).new_tag := 'MyTag1';
xList(2).old_tag := 'B';
xList(2).new_tag := 'MyTag2';
queryContext := DBMS_XMLQUERY.newContext('Select * from t');
xmlCLOB := DBMS_XMLQUERY.getXML(queryContext);
DBMS_XMLQuery.closeContext(queryContext);
dbms_output.put_line('xmlCLOB:');
dbms_output.put_line('--------------------');
XML_PKG.printClobOut(xmlCLOB);
dbms_output.put_line('--------------------');
xml_pkg.transformTags(xList,xmlCLOB,xmlCLOB2);
dbms_output.put_line('xml2CLOB:');
dbms_output.put_line('--------------------');
XML_PKG.printClobOut(xmlCLOB2);
dbms_output.put_line('--------------------');
DBMS_LOB.FREETEMPORARY(xmlCLOB);
DBMS_LOB.FREETEMPORARY(xmlCLOB2);
End;
END transformTags;
END Xml_Pkg; -
Problem inserting value in CLOB column from an XML file using XSU
Hi,
When I try to insert CLOB value into Oracle9i database from an XML document using XSU, I get an exception as below.
09:37:32,392 ERROR [STDERR] oracle.xml.sql.OracleXMLSQLException: 'java.sql.SQLException: ORA-03237: Initial Extent of specified size cannot be allocated
ORA-06512: at "SYS.DBMS_LOB", line 395
ORA-06512: at line 1
' encountered during processing ROW element 0. All prior XML row changes were rolled back. in the XML document.
All Element tags in XML doc. is mapped to columns in the database. One of the table columns is CLOB. That is the one that gives the above exception. Here is the xml...
ID - is autogenerated value.
<?xml version="1.0" ?>
<ROWSET>
<ROW num="1">
<ID></ID>
<SEQ>
GCATAGTTGTTATGAAGAAATGGAAGAAAAATGCACTCAAAGTTGGGCTGTCAGGCTGTCTGGGGCTGAATTCTGGTGTGACAGTGTGATGAAGCCATCTTTGAGCCTAAATTTGATAATGAGCCAGTCATGATCTGGTTGTGATTACTATAACAAGATTAAATCTGAATAAGAGAGCCACAACTTCTTTAAAGACAGATTGTCAAGTCATTACATGGAAGAGGGAGATTGCTCCTTTGTAAATCAGGCTGTCAGGCCAACTGAATGAAGGACGTCATTGTACAGTAACCTGATGAAGATCAGATCAACCGCTCACCTCGCCG
</SEQ>
</ROW>
</ROWSET>
Can anyone identify what's the problem.. and suggest a solution for this..?
Thanks in advance..
VijiWould you please specify the XDK verison and database version?
-
Storing XML using XSU, object VIEW and INSTEAD OF trigger
Here is the point:
I've got 2 tables which are linked:
CREATE TABLE dept (
deptno NUMBER PRIMARY KEY,
deptname VARCHAR2(20)
CREATE TABLE emp (
empno NUMBER PRIMARY KEY,
empname VARCHAR2(20),
deptno NUMBER REFERENCES dept(deptno)
I've got the following message, which I want to insert in the tables using XSU (I already have a PL/SQL stored procedure which work perfectly for insertion into 1 table, using DBMS_XMLSave.insertXML or xmlgen.insertXML):
<DEPT>
<DEPTNO>10</DEPTNO>
<DEPTNAME>IT</DEPTNAME>
<EMP>
<EMPNO>1</EMPNO>
<EMPNAME>John</EMPNAME>
</EMP>
<EMP>
<EMPNO>1</EMPNO>
<EMPNAME>Phil</EMPNAME>
</EMP>
</DEPT>
So I've created the following object:
CREATE TYPE emp_t AS OBJECT
empno NUMBER,
empname VARCHAR2(20)
CREATE TYPE emplist_t AS TABLE OF emp_t;
CREATE TYPE dept_t AS OBJECT
deptno NUMBER,
deptname VARCHAR2(20),
emplist emplist_t
Now I understand that I should create an object VIEW and an INSTEAD OF trigger (That's what I read many times),
but I don't know how to structure the view and the trigger.
Could you help? (Example of a similar context, piece of code)
Thanks a lot
MarionHi John,
I have exactly the same issue as you experienced back in January. I have a complex data modelling requirement which requires the need to pivot rows into columns using ROW_NUMBER() and PARTITION clauses. To hide the complexity from the middle tier, I have created a database view and appropriate INSTEAD OF triggers and mapped my EO to the view. I have overriden the lock() method on the EO implementation class (to avoid ORA-02014) and would like to try the same solution you used with the pl/sql call to lock the record.
My question is, how did you manage the release of the lock if the transaction was not rolled back or committed by your application i.e. if the user closed the browser for instance.
In my naivity, I would like to think that the BC4J framework would release any locks for the database session when it found the servlet session to be terminated however my concern is that the lock would persist and cause complications.
Any assistance greatly appreciated (if you would be willing to supply your lock() method and pl/sql procedure logic I would be even more grateful!).
Many thanks,
Dave
London -
Choosing particular columns using XSU PL/SQL API
Hi ya,
I have another query regarding XSU PL/SQL API please
If I dont want to choose all columns but choose particular columns
in my select clause,how shud I do this.??
I havent used XSU before,so please forgive my ignorance.
declare
queryCtx DBMS_XMLQuery.ctxType;
result CLOB;
begin
-- set the query context.
queryCtx := DBMS_XMLQuery.newContext('select CHOOSE CERTAIN COLS ONLY from <TABLE>');
result := DBMS_XMLQuery.getXML(queryCtx); -- get the result
DBMS_XMLQuery.closeContext(queryCtx); -- close the query handle;
end;
Can anyone tell me how to select particulat columnsor some one suggested(Mr Kishore) to use a view?
I dont want to use 'Select * from <Table>'
Help really appreciated.
RgdsThis is a duplicate of this posting Creating a View to check for 2 conditions.. This is a particularly heinous case because some of our finest minds have already responded in that thread.
Lose ten culture points.
Regards, APC -
Converting Oracle XML Query Result in Java String by using XSU
Hi,
I have a problem by converting Oracle XML Query Result in Java
String by using XSU. I use XSU for Java.
For example:
String datum=new OracleXMLQuery(conn,"Select max(ps.datum) from
preise ps where match='"+args[0]+"'");
String datum1=datum;
I become the following error:
Prototyp.java:47: Incompatible type for declaration. Can't
convert oracle.xml.sql.query.OracleXMLQuery to java.lang.String.
Can somebody tell me a method() for converting to solve my
problem??????
ThanksHmmm.. Pretty basic just look at the example:
OracleXMLQuery qry = new OracleXMLQuery(conn,"Select max(ps.datum) from preise ps where match='"+args[0]+"'");
String xmlString = qry.getXMLString();
Hi,
I have a problem by converting Oracle XML Query Result in Java
String by using XSU. I use XSU for Java.
For example:
String datum=new OracleXMLQuery(conn,"Select max(ps.datum) from
preise ps where match='"+args[0]+"'");
String datum1=datum;
I become the following error:
Prototyp.java:47: Incompatible type for declaration. Can't
convert oracle.xml.sql.query.OracleXMLQuery to java.lang.String.
Can somebody tell me a method() for converting to solve my
problem??????
Thanks -
Creating Object views using XSU PL/SQL.Please SEE.
Hi,
I am presently using XSU PL/SQL utility with Oracle 9i and using the
DBMS_XMLQuery.newContext(<My Select clause goes here>,and the
DBMS_XMLQuery.getXML()which generates an XML document.
My query is:
I have 2 tables (One master and the other detail table.).
Table : DI_Master
di_num
00001
Table: DI_Details
di_num di_act
00001 ABCD
00001 ANCF
00001 IOPP
Now the XML I'd like is :
<di_num>00001</di_num>
<di_act>
<val>ABCD</val>
<val>ANCF</val>
<val>IOPP</val>
</di_act>
Do I need to create object tables for this,insert data into object tables
and then read this table? It will become an extremely tedious process
I guess an OBJECT view can do what I want.Can anyone please tell me how
to write an object view for the 2 tables please and the get the output as
desired.?Supposing you have further
nesting of the tables.Then how will you go about doing that.You can have multiple levels of CURSOR expressions (see an example below, not a real-life example, but illustrates the point).
SQL> set long 4000
SQL> select dbms_xmlquery.getXML('select deptno,' ||
2 'cursor(select empno, cursor(select losal, hisal from salgrade) salgrades '||
3 'from emp e where e.deptno = d.deptno and rownum < 3) EMPLOYEES ' ||
4 'from dept d where d.deptno = 10')
5 FROM DUAL;
DBMS_XMLQUERY.GETXML('SELECTDEPTNO,'||'CURSOR(SELECTEMPNO,CURSOR(SELECTLOSAL,HIS
<?xml version = '1.0'?>
<ROWSET>
<ROW num="1">
<DEPTNO>10</DEPTNO>
<EMPLOYEES>
<EMPLOYEES_ROW num="1">
<EMPNO>7782</EMPNO>
<SALGRADES>
<SALGRADES_ROW num="1">
<LOSAL>700</LOSAL>
<HISAL>1200</HISAL>
</SALGRADES_ROW>
<SALGRADES_ROW num="2">
<LOSAL>1201</LOSAL>
<HISAL>1400</HISAL>
</SALGRADES_ROW>
<SALGRADES_ROW num="3">
<LOSAL>1401</LOSAL>
<HISAL>2000</HISAL>
</SALGRADES_ROW>
<SALGRADES_ROW num="4">
<LOSAL>2001</LOSAL>
<HISAL>3000</HISAL>
</SALGRADES_ROW>
<SALGRADES_ROW num="5">
<LOSAL>3001</LOSAL>
<HISAL>9999</HISAL>
</SALGRADES_ROW>
</SALGRADES>
</EMPLOYEES_ROW>
<EMPLOYEES_ROW num="2">
<EMPNO>7839</EMPNO>
<SALGRADES>
<SALGRADES_ROW num="1">
<LOSAL>700</LOSAL>
<HISAL>1200</HISAL>
</SALGRADES_ROW>
<SALGRADES_ROW num="2">
<LOSAL>1201</LOSAL>
<HISAL>1400</HISAL>
</SALGRADES_ROW>
<SALGRADES_ROW num="3">
<LOSAL>1401</LOSAL>
<HISAL>2000</HISAL>
</SALGRADES_ROW>
<SALGRADES_ROW num="4">
<LOSAL>2001</LOSAL>
<HISAL>3000</HISAL>
</SALGRADES_ROW>
<SALGRADES_ROW num="5">
<LOSAL>3001</LOSAL>
<HISAL>9999</HISAL>
</SALGRADES_ROW>
</SALGRADES>
</EMPLOYEES_ROW>
</EMPLOYEES>
</ROW>
</ROWSET>
1 row selected.
SQL>
Also,isnt it a better option to create a VIEW of the
Select clause and pass a view to the select clause? At the end of the day, you could use whatever you feel comfortable with, provided that it produces your expected output and looks clean. We are just giving you the ideas, how you implement it actually in your situation, depends upon a lot of factors, that only you know about. -
Hi to all,
I have a question using XSU to become XML.
I have the following query
query =""+
"SELECT "+
"anordnung.match as \"@MATCH\","+
"substr(datei,0,instr(datei,'/',-1)-1) as \"@PATH\", "+
"anordnung.rang as \"@RANG\" ,"+
"substr( "+
" substr( "+
" datei, "+
" 0, "+
" length(datei)-4 "+
" ), "+
" instr(substr( "+
" datei, "+
" 0, "+
" length(datei)-4 "+
" ),'/',-1)+1 "+
") ELEMENT "+
"FROM xsl_modul , anordnung "+
"WHERE "+
"xsl_modul.xsl_id = anordnung.xsl_id "+
"ORDER BY anordnung.match, anordnung.rang";
and the following settings:
qry.setRowsetTag("Anordnung"); // set the tags encapsulating the whole doc
qry.setRowTag("Modul");
I become the following result:
<ANORDNUNG>
<MODUL MATCH="amfcomm" PATH="/pifs/module/_standard" RANG="1">
<ELEMENT>region2</ELEMENT>
</MODUL>
<MODUL MATCH="amfcomm" PATH="/pifs/module/_standard" RANG="2">
<ELEMENT>header1</ELEMENT>
</MODUL>
<MODUL MATCH="amfcomm" PATH="/pifs/module/_standard" RANG="3">
<ELEMENT>text_a_b_c</ELEMENT>
</MODUL>
But I like to become the following result so that the XML-ELEMENT-->ELEMENT is the content of MODUL:
<MODUL MATCH="amfcomm" PATH="/pifs/module/_standard" RANG="1">
region2
</MODUL>
<MODUL MATCH="amfcomm" PATH="/pifs/module/_standard" RANG="2">
header1
</MODUL>
<MODUL MATCH="amfcomm" PATH="/pifs/module/_standard" RANG="3">
text_a_b_c
</MODUL>
HOW CAN I BECOME THIS?????
Thanks a lot.
Greetings from Frankfurt/Germany
SchoeibYou can also do this but it may fail on complex documents:
PS C:\scripts> $xml.computers.computerData
ip-Dir name
127.0.0.1 eth01
127.0.0.2 eth02
127.0.0.3 eth03
127.0.0.4 eth01
PS C:\scripts> $xml.computers.computerData.Name
eth01
eth02
eth03
eth01
PS C:\scripts> $xml.computers.computerData[2]
ip-Dir name
127.0.0.3 eth03
PS C:\scripts> $xml.computers.computerData[2].'ip-Dir'
127.0.0.3
You may also have to add namespace support.
¯\_(ツ)_/¯ -
Generating XML with attributes using XSU
Oracle document claims if the sql is:
select empno as @empno from employee
Using XSU to generate XML will produce and XML document with EMPNO as an attribute instead of element name. But this does not seem to work. There is an exception:
<ERROR>oracle.xml.sql.OracleXMLSQLException: Character '&' is not allowed in an XML tag name.</ERROR
Is there anything wrong or is there a work aroundOracle document claims if the sql is:
select empno as @empno from employee
Using XSU to generate XML will produce and XML document with EMPNO as an attribute instead of element name. But this does not seem to work. There is an exception:
<ERROR>oracle.xml.sql.OracleXMLSQLException: Character '&' is not allowed in an XML tag name.</ERROR
Is there anything wrong or is there a work around -
Using XSU to process multiple record sets
Have a design question about XML, Java and Oracle's XSU. This is a common task when importing external data that should be of general interest.
I have an incoming XML document with multiple records with a known DTD. Before the records can be inserted into the database, part of
the record must be used to do a lookup for a foreign key. The resulting foreign key is then combined with the other part of the
record to create a valid input record for the database.
My question is what's the most efficient way to do this? I assume the general approach must go something like:
begin
while (records in xml doc)
1. parse the incoming XML to extract the next record
2. if the lookup data change, do a lookup for this record using XSL
3. combine the resulting foreign key with the data to create
an insert query
4. add the insert query as a document fragment to a second XML document.
use XSU to insert the second XML doc with multiple records.
end
I've figured out how to do most of this, except for step 1 above: is there an easy way to extract the next record from an XML doc if I know the row nodes and the DTD? Or do I just have to traverse all the XML nodes until I hit my next row tag?
Appreciate any suggestions; this is a handy discussion list!
--Rick Casey
Rick Casey, Graduate research assistant CADSWES, http://cadswes.colorado.edu
University of Colorado at Boulder [email protected] 303.492.0892
nullYes, typical behavior is that when you have multiple outputs it will create a one row IllumDoc to wrap them all together with OuputParameter=* (and the xml will be ignored unless it is the only output property or you've requested it by name).
How about just using "/Lighthammer/Illuminator?QueryTemplate=xxxx/yyyy&Content-Type=text/xml" or "/Lighthammer/Runner?Transaction=xxxx/yyyy&OutputParameter=OutputXML" which will both return your multi-rowset output?
I may be mistaken, but I believe the XacuteResponse was simplified to not include the Rowsets outer node because certain systems had problems digesting the layers, in fact you don't get the <Columns/> section either in the single Rowset.
Rick - any feedback to this SOAP simplification from Xacute? -
Multi heirarchy DOM tree using XSU ???
I'm not able to retrieve a A-->b-->C-->D-->E heirarchy representation of XML data(String or DOM)
My Data base is in terms of simple tables so when I try to use simple OracleXMLQquey I'm not able to secure my objective...
I wud appreciate if anybody can send me an example code to derive multi level DOM tree using XSU API'sUse the CURSOR() operator, or object views to accomplish your goal.
See the release notes for the XSQL Servlet for some hints in this area.
My soon-to-be released book, "Building Oracle XML Applications" from O'Reilly has many additional examples of using these techniques.
-- Steve Muench
-- Building Oracle XML Applications -
Creating Views using XSU PL/SQL API.Urgent please.
Folks,
I need some help in creating a View.
I am using XSU PL/SQL to generate an XML Document.
I have a table (SDI) with 2 cols CMPY_NUM and CPTY_BORG_NUM.
If the values in these 2 cols are equal then the xml
value to be returned is 'OURS' else return 'THEIRS'.
How do I Create this View please?
The XSU PL/SQL I am using to generate the XML is:
declare
queryCtx DBMS_XMLquery.ctxType;
xmlResult CLOB;
begin
queryCtx := DBMS_XMLQuery.newContext('select CMPY_NUM,CPTY_BORG_NUM from SDI');
xmlResult := DBMS_XMLQuery.getXML(queryCtx);
DBMS_XMLQuery.closeContext(queryCtx); -- you must close the query handle..
end;
Output
<?xml version='1.0'?>
<ROWSET>
<ROW num="1">
<CMPY_NUM>1</CMPY_NUM>
<CPTY_BORG_NUM>2/CPTY_BORG_NUM>
</ROW>
<!-- additional rows ... -->
</ROWSET>
Please can any one tell me how to create a view that will be used in place
of the select statement,and returns back OURS or THEIRS
Create View XML ASThis is a duplicate of this posting Creating a View to check for 2 conditions.. This is a particularly heinous case because some of our finest minds have already responded in that thread.
Lose ten culture points.
Regards, APC -
XSLT using Java function from graphical mapping (RFClookup)
Hi,
I was wondering if it is possible to use the standard Java functions of the graphical mapping (RFCLookup, Datetrans, ...) or from my own UDF inside an xslt mapping. Does anyone have every tried this or is an example available ?
Regards BerndHi Bernd,
here you can find an example how to use RFC lookup from an XSLT Mapping:
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/05a3d62e-0a01-0010-14bc-adc8efd4ee14?quicklink=index&overridelayout=true
Is this what you're looking for?
Regards,
Gábor -
Hello
1) I have trouble when using the Oracle XML SQL Ulitity (XSU) with Enterprise Java Beans (EJB).
This is due to that
oracle.xml.sql.OracleXMLSQLException extends RuntimeException
i.e. is interpreted by the EJB container as a system exception.
(java.sql.SQLException extends Exception)
2) Is there anywhere I can submit a change suggestion to the XSU developer team?
Regards
OleHello
1) I have trouble when using the Oracle XML SQL Ulitity (XSU) with Enterprise Java Beans (EJB).
This is due to that
oracle.xml.sql.OracleXMLSQLException extends RuntimeException
i.e. is interpreted by the EJB container as a system exception.
(java.sql.SQLException extends Exception)
2) Is there anywhere I can submit a change suggestion to the XSU developer team?
Regards
Ole -
JSP XML file parsing XSLT using Xalan
Hi all
I have created an XML file "view_campaign.xml" using JSP as shown in a code below and i wanna know how i should proceed to parse the XML file and so i can display this XML as the XSLT file i created.
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>
<%
// Identify a carriage return character for each output line
int iLf = 10;
char cLf = (char)iLf;
// Create a new empty binary file, which will content XML output
File outputFile = new File("C:\\WebContent\\view_campaigns.xml");
//outputFile.createNewFile();
FileWriter outfile = new FileWriter(outputFile);
// the header for XML file
outfile.write("<?xml version='1.0' encoding='ISO-8859-1'?>"+cLf);
try {
// Define connection string and make a connection to database
//DriverManager.registerDriver (new org.apache.derby.jdbc.ClientDriver());
Connection conn = DriverManager.getConnection("jdbc:derby://localhost:1527/sample","app","app");
Statement stat = conn.createStatement();
// Create a recordset
ResultSet rset = stat.executeQuery("Select * From campagn");
// Expecting at least one record
if( !rset.next() ) {
throw new IllegalArgumentException("No data found for the campaigns table");
outfile.write("<campaigns>"+cLf);
outfile.write("<campaign>"+cLf);
outfile.write("<campaign_id>" + rset.getString("campagn_id") +"</campaign_id>"+cLf);
outfile.write("<campaign_name>" + rset.getString("campagn_name") +"</campaign_name>"+cLf);
outfile.write("<campaign_type>" + rset.getString("campagn_type") +"</campaign_type>"+cLf);
outfile.write("<client>" + rset.getString("client_name") +"</client>"+cLf);
outfile.write("<positions>" + rset.getString("positions_nbr") +"</positions>"+cLf);
outfile.write("<begin>" + rset.getString("campagn_beginning_date") +"</begin>"+cLf);
outfile.write("<close>" + rset.getString("campagn_ending_date") +"</close>"+cLf);
outfile.write("</campaign>"+cLf);
// Parse our recordset
// Parse our recordset
while(rset.next()) {
outfile.write("<campaign>"+cLf);
outfile.write("<campaign_id>" + rset.getString("campagn_id") +"</campaign_id>"+cLf);
outfile.write("<campaign_name>" + rset.getString("campagn_name") +"</campaign_name>"+cLf);
outfile.write("<campaign_type>" + rset.getString("campagn_type") +"</campaign_type>"+cLf);
outfile.write("<client>" + rset.getString("client_name") +"</client>"+cLf);
outfile.write("<positions>" + rset.getString("positions_nbr") +"</positions>"+cLf);
outfile.write("<begin>" + rset.getString("campagn_beginning_date") +"</begin>"+cLf);
outfile.write("<close>" + rset.getString("campagn_ending_date") +"</close>"+cLf);
outfile.write("</campaign>"+cLf);
outfile.write("</campaigns>"+cLf);
// Everything must be closed
rset.close();
stat.close();
conn.close();
outfile.close();
catch( Exception er ) {
%>////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
this is my .XSL file
<?xml version="1.0" encoding="iso-8859-1" ?>
- <!-- DWXMLSource="view_campaigns.xml"
-->
<!DOCTYPE xsl:stylesheet (View Source for full doctype...)>
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="iso-8859-1" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />
- <xsl:template match="/">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Gestion des campagnes</title>
</head>
- <body>
Gestion des campagnes
- <table border="1">
- <tr bgcolor="#9acd32">
<th align="left">Code</th>
<th align="left">Nom</th>
<th align="left">Type</th>
<th align="left">Client</th>
<th align="left">Nombre de positions</th>
<th align="left">Date d'ouverture</th>
<th align="left">Date de cl�ture</th>
</tr>
- <xsl:for-each select="campaigns/campaign">
- <tr>
- <td>
<xsl:value-of select="campaign_id" />
</td>
- <td>
<xsl:value-of select="campaign_name" />
</td>
- <td>
<xsl:value-of select="campaign_type" />
</td>
- <td>
<xsl:value-of select="client" />
</td>
- <td>
<xsl:value-of select="positions" />
</td>
- <td>
<xsl:value-of select="begin" />
</td>
- <td>
<xsl:value-of select="close" />
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>I would be greatful that u answer my question what i should do have any exemple case study.Hi,
Try this code
JspWriter out = pageContext.getOut(); // Get JSP output writter
javax.xml.transform.TransformerFactory tFactory = javax.xml.transform.TransformerFactory.newInstance(); //Instantiate a TransformerFactory.
String realPath = "c:/applyXsl.xsl";
java.io.File file = new java.io.File(realPath); // crearte a file object for given XSL.
// Use the TransformerFactory to process the stylesheet Source and generate a Transformer.
javax.xml.transform.Transformer transformer = tFactory.newTransformer(new javax.xml.transform.stream.StreamSource(file));
java.io.StringReader inputStream = new java.io.StringReader("c:/xmlFile.xml"); // create an input stream for given XML doc
java.io.ByteArrayOutputStream obj = new java.io.ByteArrayOutputStream(); // Create an output stream for XSL applied XML doc.
// 3. Use the Transformer to transform an XML Source and send the output to a Result object.
transformer.transform(new javax.xml.transform.stream.StreamSource(inputStream), new javax.xml.transform.stream.StreamResult(obj));
String outputString = obj.toString(); // get the XSL applied applied XML document for print
out.println(outputString); // print the XSL applied XML in to JSP.
however you need xercesImpl.jar and xml-apis.jar files to run this program.
Regards,
Ananth.P
Maybe you are looking for
-
Unable to send emails from any Apple devices
Since BT made the changes to Yahoo mail i have had problems with sending emails from my ipad and iphone (IOS8). The only way that i can successfully send an email is to log onto my laptop and send from a windows platform. I have checked all of the se
-
Should i contact apple about this? does the box need to be signed for? do i need to be here when it arrives? how big is the box? and does anybody know how long it will take for the ipod to be returned?
-
Hi Experts I'm reading SSIS book to learn SSIS. My background is also programming but never work with VB and C. In SSIS book there is a topic of Script Task and in this topic the author uses Script Task and use VB but it is so confusing but if somebo
-
My stylus has stopped working in CS6?
I've been using Photoshop for several months now within Windows 7, and it worked perfectly. I upgraded to Windows 8, and all of a sudden, the stylus to my tablet PC stopped working in Photoshop. If I go to draw a line with the brush, it affects just
-
Hello, I'm a first time poster. I have raised this question to first level tech support and I was recommended to perform a hard reset of the router, which did not help. when I log into the admin page of my Actiontec router my router is being display