Sql/xml - no namespace
Hi
I get a "LPX-00234: namespace prefix "def" is not declared" when i run the SQL/XML code below. It works fine when i run it without the Extract() function. I am using 9.2.0.6.0.
any help is much appreciated. i am running this directly against the database and I have no namespace set up.
select xmlelement(name "ItemDef",
XMLAttributes (a.oid as "OID",a.name as "df.Name"),NULL).extract('/*').getclobval()
FROM xmlview a
Please ignore i am a fool... declared namespace def: in code, so need to declare a def namespace in code. Used workaround
SELECT xmlelement("links", xmlattributes('link1' AS "xmlns:def",'link2' AS "xmlns:xlink"),
rest of code
works now
cheers
Similar Messages
-
How do I create an undeclared namespace node with sql/xml?
I have to interact with a .NET web service that is expecting to have an xml node with an undeclared namespace, i.e. <address xmlns=""> I figured that I could create this by using XMLATTRIBUTES ( '' AS "xmlns") but a null attribute will not be added to the attribute listing. This works fine for other xmlns entries that contain values. Without this undeclared namespace node, the web service reports an Internal SOAP failure message, so I have to include it. Do I have to resort to manually injecting this null attribute via DOM after I produce the xml? I'm using SQL/XML query generate the xml as a view which gives me the entire packet for this document/literal web service OTHER THAN this missing undeclared namespace element.
Any tips/suggestions would be helpful! Thanks a bunch, and have a Happy Holiday Season.
EricYou can use UTL_RAW package.
First, convert string to raw with UTL_RAW.CAST_TO_RAW, then using UTL_RAW.CONVERT to convert raw to utf-8 and finally UTL_RAW.CAST_TO_VARCHAR to get utf-8 string.
Regards -
Unable to locate Spring NamespaceHandler for XML schema namespace
I am not sure if this is the best practice approach but this is the problem I am ruining into. Below, I explain what I am doing:
1) What I am doing:
=============
Based on the oracle incubator example (http://coherence.oracle.com/display/INCUBATOR/Processing+Pattern+Examples); I am running a server and submitting tasks through a proxy application that submits them to ProcessingPatternConfigurator; let's call my task processReport.
a) my processReport is using spring and ibatis together, I created a utility static class to obtain a spring context and retrieves beans using the following lines ( see exhibit "A1 and A2" below).
b) when my task calls the context and that spring loads, it is failing with the error show in exhibit "B".
I suspect I am missing a lib? I googled the error and searched you site but could find a meaningful discussion on it. I guess my question is if this is not the best approach, how do I integrated with spring initializing beans and setting up ibatis framwork, providing beans and database access through Ibatis for each task ruining on the grid (processReport).
thanks
A1) processReport (submitted in the grid) uses this line
AbstractXmlApplicationContext ctx = (AbstractXmlApplicationContext) AmrContextUtil.getInstance();
System.out.println("Classpath loaded. Executing Report...");
ReportProcessor repProcessor = (ReportProcessor) ctx.getBean("reportProcessor");
A2) Here is the AmrContextUtil:
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public final class AmrContextUtil {
private static AbstractApplicationContext ctx = null;
public AmrContextUtil() {
super();
public final static synchronized AbstractApplicationContext getInstance(){
if (ctx == null){
ctx = new ClassPathXmlApplicationContext("classpath:config/applicationContext.xml");
setCtx(ctx);
return ctx;
public final static synchronized AbstractApplicationContext getCtx() {
return ctx;
public final static synchronized void setCtx(AbstractApplicationContext ctx) {
AmrContextUtil.ctx = ctx;
B) Here is the error reported by the server:
2010-02-10 15:42:28.312/57.986 Oracle Coherence GE 3.5.2/463 <Warning> (thread=GridExecutor:Thread-2
, member=1): TaskRunner - Failed to process 0x00000126B99E5524AC1F007AAB1587BBCFEC5E6637E1DED6CCB984
03D6AADF4D due to:org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:config/reports-application.xml] Offending resource: class path resource [config/applicationContext.xml]; nested exception is org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unexpected failure during bean definition parsing
Offending resource: class path resource [config/reports-application.xml] Bean 'reportSqlMapConfig'; nested exception is org.springframework.beans.factory.parsing.BeanDefinitionParsingException: *Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/util]*
*Offending resource: class path resource [config/reports-application.xml] Bean 'reportSqlMapConfig'*
-> Property 'resourceMap'
c)Here is my application-context.xml offending line:
<bean id="reportSqlMapConfig"
class="com.xx.report.generator.ReportSqlMapConfig">
<property name="resourceMap">
<map>
<entry>
<key>
<util:constant static-field="com.xx.report.domain.ReportType.FPA"/>
</key>
<value>classpath:config/diehardReportSqlMapConfig.xml</value>
</entry>
<entry>
<key>
<util:constant static-field="com.xx.report.domain.ReportType.FCN"/>
</key>
<value>classpath:config/falconReportSqlMapConfig.xml</value>
</entry>
<entry>
<key>
<util:constant static-field="com.xx.report.domain.ReportType.ODS"/>
</key>
<value>classpath:config/odsReportSqlMapConfig.xml</value>
</entry>
</map>
</property>
</bean>My guess is that something is broken in the configuration of the cacheServer and its not finding
all of the dependencies that your process pattern application needs. Probably the best way
to debug this stuff is to define a static main in your runnable task which will make the call
to the run() method and invoke it as the main class using the identical settings (classpath,
run directory) that you are using to launch the Coherence cache server.
Regards,
Bob -
Error while running PL/SQL XML Parser Samples
every time try to run the PL/SQL XML Parser Sample program i get this error no file or directory, though the file and dir exists, i have the permissions setup as in readme.txt do i need to do any chnages to init.ora,
pls advice
Thanks,
SQL> exec test
begin test; end;
ERROR at line 1:
ORA-20100: Error occurred while parsing: No such file or directory
ORA-06512: at "SCOTT.XMLPARSER", line 22
ORA-06512: at "SCOTT.XMLPARSER", line 69
ORA-06512: at "SCOTT.TEST", line 13
ORA-06512: at line 1Which examples in particular? Thanks.
-
?xml version = '1.0' encoding = 'ASCII'? pl/sql xml parser
When ever I parse a document which has the
<?xml version = '1.0' encoding = 'ASCII'?> tag as the first line hangs the pl/sql xml parser . If I remove the "encoding = 'ASCII'" from the file everything works fine ! What is the problem ?
version 8.1.6 / plsql parser v2 / hpux 11x
Here is the input file
<?xml version = '1.0' encoding = 'ASCII'?>
!--- This is a comment -->
<person>
<employee>
<lastname>GHANTASALA</lastname>
<firstname>SREE</firstname>
<age>32</age>
</employee>
<employee>
<lastname>TAMATAM</lastname>
<firstname>SATISH</firstname>
<age>30</age>
</employee>
</person>
Here is my program
declare
p xmlparser.parser;
doc xmldom.DOMDocument;
dir varchar2(100) := '/apps/oracle/drugstore';
errfile varchar2(30) := 'err.txt' ;
inpfile varchar2(30) := 'person.xml';
nl xmldom.DOMNodeList;
len number;
n xmldom.DOMNode;
new_node xmldom.DOMNode;
node_name varchar2(100);
node_value varchar2(100);
begin
-- new parser
p := xmlparser.newParser;
-- Set some characteristics
xmlparser.setValidationMode(p, FALSE);
xmlparser.setErrorLog(p, dir| |'/'| | errfile );
xmlparser.setBaseDir(p, dir);
-- parse input file
xmlparser.parse(p, dir| |'/'| |inpfile);
-- get document
doc := xmlparser.getDocument(p);
-- get all elements
nl := xmldom.getElementsByTagName(doc, '*');
len := xmldom.getLength(nl);
dbms_output.put_line('Length='| |len);
-- loop through elements
for i in 0..len-1 loop
n := xmldom.item(nl, i);
node_name := xmldom.getNodeName(n);
-- get the text node associated with the element node
n := xmldom.getFirstChild(n);
if xmldom.getNodeType(n) = xmldom.TEXT_NODE then
node_value := xmldom.getNodeValue(n);
if node_name='lastname' then
dbms_output.put_line('The value you are looking for is -->:'| |node_value);
if node_value = 'GHANTASALA' then
xmldom.setNodeValue(n,'TEST2');
end if;
end if;
end if;
end loop;
new_node := xmldom.makeNode(doc);
xmldom.writeToFile(new_node, dir | |'/'| |'mod.xml');
end ;
nullThe encoding header is actually generated by
by the following piece of code in my pl/sql program .
new_node := xmldom.makeNode(doc);
xmldom.writeToFile(new_node, dir | |'/'| |'mod.xml');
Since this is a document created by the pl/sql parser, I assume there is some meaning to it !
Also why is it hanging ? PL/sql parser should tell me that it is not a valid string ! -
i've downloaded the Pl/SQL XML parser demo - xslsample / domsample - followed the guide , etc but I'm getting ....
BEGIN xslsample ('/export/home/oracle/plmx/sample','family.xml','iden.xsl','family.out','errors.txt'); END;
ERROR at line 1:
ORA-29516: Aurora assertion failure: Assertion failure at eox.c:187
Uncaught exception Root of all Java exceptions:
ORA-06512: at "PLMX.XMLPARSERCOVER", line 0
ORA-06512: at "PLMX.XMLPARSER", line 57
ORA-06512: at "PLMX.XSLSAMPLE", line 28
ORA-06512: at line 1
anybody seen this ??There is no such limit on our Parser for PL/SQL. Could you
perhaps be using the PLXML Utilities? If you are you might try
our PL/SQL Parser instead.
Oracle XML Team
http://technet.oracle.com
Oracle Technology Network
Premal Mehta (guest) wrote:
: Hi
: I am using PL/SQL XML Parser to add XML data in database. I
: am having trouble when using file sixe greater than 500KB?
: What is the alternative? Can I do something to process
larger
: files?
: Please Help, this is quite urgent.
: Hoping for help,
: Premal.
null -
JMS Adapter getting xml without namespace
Hello,
We're using BPEL 10.1.3.4 and we need to integrate a legacy system with a new one. The legacy system writes in a JMS queue a simple xml message without namespaces (following although a specific schema). When in BPEL I try to get this xml I cannot access its elements and I'm getting errors like the following:
variable/ expression is empty
Which seems normal as bpel tries to access the element using namespaces.
I found this thread which seems to be the same issue Re: writing XML without namespace? but I cannot actually understand the approach.
Any help will be really usefull!
Thank you!Hi,
Did the solution mentioned in the other thread worked for you? I am having the exact problem.
Thanks. -
How to tune the performance of Oracle SQL/XML query?
Hi all,
I am running Oracle 9i and like to run the following Oracle SQL/XML query. It takes about 3+ hour and still not finish. If I get rid all the XML stuffs it only take minutes to run. Does anybody know how to what's the reason of this slow and how to tune it?
SELECT XMLElement("CUSTOMER",
XMLForest(C_CUSTKEY "C_CUSTKEY", C_NAME "C_NAME", C_ADDRESS "C_ADDRESS", C_PHONE "C_PHONE", C_MKTSEGMENT "C_MKTSEGMENT", C_COMMENT "C_COMMENT"),
(SELECT XMLAgg(XMLElement("ORDERS",
XMLForest(O_ORDERKEY "O_ORDERKEY", O_CUSTKEY "O_CUSTKEY", O_ORDERSTATUS "O_ORDERSTATUS", O_ORDERPRIORITY "O_ORDERPRIORITY", O_CLERK "O_CLERK", O_COMMENT "O_COMMENT"),
(SELECT XMLAgg(XMLElement("LINEITEM",
XMLForest(L_ORDERKEY "L_ORDERKEY", L_RETURNFLAG "L_RETURNFLAG", L_LINESTATUS "L_LINESTATUS", L_SHIPINSTRUCT "L_SHIPINSTRUCT", L_SHIPMODE "L_SHIPMODE", L_COMMENT "L_COMMENT")
FROM LINEITEM
WHERE LINEITEM.L_ORDERKEY = ORDERS.O_ORDERKEY)
FROM ORDERS
WHERE ORDERS.O_CUSTKEY = CUSTOMER.C_CUSTKEY)
FROM CUSTOMER ;
Thanks very much in advance for your time,
Jinghao Liuajallen wrote:
Why not something more like
SELECT *
FROM fact1 l,
FULL OUTER JOIN fact1 d
ON l.company = d.company
AND l.transactiontypeid = 1
AND d.transactiontypeid = 2;
Because this is not an equivalent of the original query.
drop table t1 cascade constraints purge;
drop table t2 cascade constraints purge;
create table t1 as select rownum t1_id from dual connect by level <= 5;
create table t2 as select rownum+2 t2_id from dual connect by level <= 5;
select * from (select * from t1 where t1_id > 2) t1 full outer join t2 on (t1_id = t2_id);
select * from t1 full outer join t2 on (t1_id = t2_id and t1_id > 2);
T1_ID T2_ID
3 3
4 4
5 5
6
7
T1_ID T2_ID
1
2
3 3
4 4
5 5
6
7 -
How to perf tune Oracle SQL/XML query?
Hi all,
I am using Oracle 9i and like to run the following Oracle SQL/XML query. It takes about 3+ hour and still not finish. If I get rid all the XML stuffs it only take minutes to run. Does anybody know how to what's the reason of this slow and how to tune it?
SELECT XMLElement("CUSTOMER",
XMLForest(C_CUSTKEY "C_CUSTKEY", C_NAME "C_NAME", C_ADDRESS "C_ADDRESS", C_PHONE "C_PHONE", C_MKTSEGMENT "C_MKTSEGMENT", C_COMMENT "C_COMMENT"),
(SELECT XMLAgg(XMLElement("ORDERS",
XMLForest(O_ORDERKEY "O_ORDERKEY", O_CUSTKEY "O_CUSTKEY", O_ORDERSTATUS "O_ORDERSTATUS", O_ORDERPRIORITY "O_ORDERPRIORITY", O_CLERK "O_CLERK", O_COMMENT "O_COMMENT"),
(SELECT XMLAgg(XMLElement("LINEITEM",
XMLForest(L_ORDERKEY "L_ORDERKEY", L_RETURNFLAG "L_RETURNFLAG", L_LINESTATUS "L_LINESTATUS", L_SHIPINSTRUCT "L_SHIPINSTRUCT", L_SHIPMODE "L_SHIPMODE", L_COMMENT "L_COMMENT")
FROM LINEITEM
WHERE LINEITEM.L_ORDERKEY = ORDERS.O_ORDERKEY)
FROM ORDERS
WHERE ORDERS.O_CUSTKEY = CUSTOMER.C_CUSTKEY)
FROM CUSTOMER ;
Thanks very much in advance for your time,
Jinghao LiuPlease post this message at:
Forums Home » Oracle Technology Network (OTN) » Products » Database » XML DB -
Re-Write the Node-DOM code with SQL-XML funtions
Hi Friends,
Could you please help in re-writing the below code using SQl-XML functions
DECLARE
l_domdoc dbms_xmldom.DOMDocument;
l_xmltype XMLTYPE;
l_root_node dbms_xmldom.DOMNode;
l_departments_node dbms_xmldom.DOMNode;
l_dept_element dbms_xmldom.DOMElement;
l_dept_node dbms_xmldom.DOMNode;
l_name_node dbms_xmldom.DOMNode;
l_name_textnode dbms_xmldom.DOMNode;
l_location_node dbms_xmldom.DOMNode;
l_location_textnode dbms_xmldom.DOMNode;
l_employees_node dbms_xmldom.DOMNode;
l_emp_element dbms_xmldom.DOMElement;
l_emp_node dbms_xmldom.DOMNode;
l_emp_first_name_node dbms_xmldom.DOMNode;
l_emp_first_name_textnode dbms_xmldom.DOMNode;
l_emp_last_name_node dbms_xmldom.DOMNode;
l_emp_last_name_textnode dbms_xmldom.DOMNode;
BEGIN
-- Create an empty XML document
l_domdoc := dbms_xmldom.newDomDocument;
-- Create a root node
l_root_node := dbms_xmldom.makeNode(l_domdoc);
-- Create a new node Departments and add it to the root node
l_departments_node := dbms_xmldom.appendChild( l_root_node
, dbms_xmldom.makeNode(dbms_xmldom.createElement(l_domdoc, 'Deptartments' ))
FOR r_dept IN (SELECT dept.department_id
, dept.department_name
, loc.city
FROM departments dept
JOIN locations loc
ON loc.location_id = dept.location_id
WHERE dept.department_id IN (10,20)
LOOP
-- For each record, create a new Dept element with the Department ID as attribute.
-- and add this new Dept element to the Departments node
l_dept_element := dbms_xmldom.createElement(l_domdoc, 'Dept' );
dbms_xmldom.setAttribute(l_dept_element, 'Deptno', r_dept.Department_Id );
l_dept_node := dbms_xmldom.appendChild( l_departments_node
, dbms_xmldom.makeNode(l_dept_element)
-- Each Dept node will get a Name node which contains the department name as text
l_name_node := dbms_xmldom.appendChild( l_dept_node
, dbms_xmldom.makeNode(dbms_xmldom.createElement(l_domdoc, 'Name' ))
l_name_textnode := dbms_xmldom.appendChild( l_name_node
, dbms_xmldom.makeNode(dbms_xmldom.createTextNode(l_domdoc, r_dept.department_name ))
-- Each Dept node will aslo get a Location node which contains the location(city) as text
l_location_node := dbms_xmldom.appendChild( l_dept_node
, dbms_xmldom.makeNode(dbms_xmldom.createElement(l_domdoc, 'Location' ))
l_location_textnode := dbms_xmldom.appendChild( l_location_node
, dbms_xmldom.makeNode(dbms_xmldom.createTextNode(l_domdoc, r_dept.city ))
-- For each department, add an Employees node
l_employees_node := dbms_xmldom.appendChild( l_dept_node
, dbms_xmldom.makeNode(dbms_xmldom.createElement(l_domdoc, 'Employees' ))
FOR r_emp IN (SELECT employee_id
, first_name
, last_name
FROM employees
WHERE department_id = r_dept.department_id
LOOP
-- For each record, create a new Emp element with the Employee ID as attribute.
-- and add this new Emp element to the Employees node
l_emp_element := dbms_xmldom.createElement(l_domdoc, 'Emp' );
dbms_xmldom.setAttribute(l_emp_element, 'empid', r_emp.employee_id );
l_emp_node := dbms_xmldom.appendChild( l_employees_node
, dbms_xmldom.makeNode(l_emp_element)
-- Each emp node will get a First name and Last name node which contains the first name and last name as text
l_emp_first_name_node := dbms_xmldom.appendChild( l_emp_node
, dbms_xmldom.makeNode(dbms_xmldom.createElement(l_domdoc, 'FirstName' ))
l_emp_first_name_textnode := dbms_xmldom.appendChild( l_emp_first_name_node
, dbms_xmldom.makeNode(dbms_xmldom.createTextNode(l_domdoc, r_emp.first_name ))
l_emp_last_name_node := dbms_xmldom.appendChild( l_emp_node
, dbms_xmldom.makeNode(dbms_xmldom.createElement(l_domdoc, 'LastName' ))
l_emp_last_name_textnode := dbms_xmldom.appendChild( l_emp_last_name_node
, dbms_xmldom.makeNode(dbms_xmldom.createTextNode(l_domdoc, r_emp.last_name ))
END LOOP;
END LOOP;
l_xmltype := dbms_xmldom.getXmlType(l_domdoc);
dbms_xmldom.freeDocument(l_domdoc);
dbms_output.put_line(l_xmltype.getClobVal);
END;
thanks and regards,
Arun Thomas TIt's as easy as this :
SQL> select xmlserialize(document
2 xmlelement("Departments"
3 , xmlagg(
4 xmlelement("Dept"
5 , xmlattributes(d.department_id as "Deptno")
6 , xmlforest(
7 d.department_name as "Name"
8 , l.city as "Location"
9 )
10 , xmlelement("Employees"
11 , (
12 select xmlagg(
13 xmlelement("Emp"
14 , xmlattributes(e.employee_id as "empid")
15 , xmlforest(
16 e.first_name as "FirstName"
17 , e.last_name as "LastName"
18 )
19 )
20 )
21 from hr.employees e
22 where e.department_id = d.department_id
23 )
24 )
25 )
26 )
27 )
28 indent
29 )
30 from hr.departments d
31 join hr.locations l on l.location_id = d.location_id
32 where d.department_id in (10,20) ;
XMLSERIALIZE(DOCUMENTXMLELEMEN
<Departments>
<Dept Deptno="10">
<Name>Administration</Name>
<Location>Seattle</Location>
<Employees>
<Emp empid="200">
<FirstName>Jennifer</FirstName>
<LastName>Whalen</LastName>
</Emp>
</Employees>
</Dept>
<Dept Deptno="20">
<Name>Marketing</Name>
<Location>Toronto</Location>
<Employees>
<Emp empid="201">
<FirstName>Michael</FirstName>
<LastName>Hartstein</LastName>
</Emp>
<Emp empid="202">
<FirstName>Pat</FirstName>
<LastName>Fay</LastName>
</Emp>
</Employees>
</Dept>
</Departments> -
Can I use SQL/XML feature on EVERY Oracle DB?
I appreciate the SQL/XML as described here:
http://www.oracle.com/technology/oramag/oracle/03-may/o33xml.html
But I wonder if I can use these commands on EVERY Oracle DB.
Do I have to prepare/setup an existing DB in any way for receiving such SQL/XML commands ? Or do I have to enable this feature/install an Add-On?
Can I use this feature even with the Express Editions ?
PeterSQL/XML appears in 9.2.x and later. Not all of the operators in the current (11g) product are available in earlier releases. Please check the SQL reference guide for a particular version. However that article is quite old so it probably only refers to the ones in 9.2.x
-
Strange Behavior with SQL/XML
Our University have had for quite some time now a rather difficult situation with a very significant course handbook web site that creates HTML based on database XSL transformation of XML content generated with SQL/XML. The database is 10.2.0.2.0. The HTML is passed via a distributed database link to an Oracle Portal dynamic portlet for display. Some of the derived XML originates from XML Schema registered instance documents and some from relational storage.
Let me explain. Occasionally after a period of operating (could be one week, sometimes even less) we will experience a problem whereby our derived XML content (just prior to PL/SQL database XSL transformation) will develop a parsing problem. Once this happens to one XSL transform of a course then subsequently it happens for every course viewed/transformed there-after.
Recently I experienced the problem and then added the XMLNS argument to the extract function. That seemed to fix things and I thought I had it licked.
Today we started to get the same problem again. The error reported was:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00242: invalid use of ampersand ('&') character (use &)
Error at line 1
Now this might have been reasonable for one course. But every course reported the same problem there-after without fail. I managed to fix the issue but in a way that really doesn't seem to make sense. What I did was to alter the SQL/XML statement by adding in an extra XMLEMENT and then to recompile the function that returns an XMLTYPE based on the execution of the SQL statement. After compiling the function everything returned to normal.
This doesn't seem to make sense.
I am pretty desperate for help on this. I really don't know how to progress the solution. I don't get much joy from Oracle Support as our application covers too many high tech areas. This is really shaking confidence in our organization's use of Oracle technology.Hi Mark.
We've isolated the problem a bit more now and there is a support SR (6089662.994). At this stage we are unable to reproduce - I am testing out an export though. The problem only occurs when a certain condition has been reached. Once that happens then extraneous characters are produced in the XMLTYPE feed returned by a function. We are not at all sure about how to make this condition occur. This doesn't just happen with one SQL/XML cursor - I've seen it happen with 3 different cursors. All are located in the same function that returns an XMLTYPE.
We are convinced the problem lies with one or more SQL/XML cursors located in the same function. Once one of these cursors malfunctions it will produce XML that is not well formed OR on occasion has content omitted but is well formed (there often seem to be extraneous characters). When the XML content is not well formed then the parsing stage (dbms_xmlparser.parseclob(myparser, xml_clob)) of XSL transformation crashes. This error then propagates to the dynamic portlet in Oracle Portal thus removing the content on the page. This happens for every execution of the cursor while the condition manifests, the only difference between calls being bind variables.
The interesting thing is that the error if left to itself will eventually stop. The cursor seems to right itself eventually. On the last occurrence, the problem commenced at 4.30am and went for 3.5 hrs and then seemed to right itself. -
Sql/xml - powerful tool for complex reports
I just want to share euphoria...
HTMLDB itself provides powerful ways how to control the design of the page - various types of regions, page types, templates...
Nevertheless sometimes you need even more precise control over the content and format of the displayed page. The combination of SQL/XML and HTMLDB solves it in very elegant way.
- create page with common SQL report region.
- prepare the SELECT gathering the data to be displayed
- prepare another SELECT using SQL/XML functions adding HTML formating tags upon the first select.
Example:
select
XMLTYPE.getStringVal(
XMLElement("table",
XMLAttributes('5' as cellpadding),
XMLConcat(
XMLElement("tr",
XMLElement("td",
XMLAttributes('left' as align, 'top' as valign),
XMLElement("a",
XMLAttributes(provider_url as href),
XMLElement("img",XMLAttributes(provider_icon as src, provider_name as alt, provider_name as title))
XMLElement("td",
XMLAttributes('left' as align, 'top' as valign, '150' as width),
XMLElement("a",
XMLAttributes(event_url as href),
XMLElement("div",XMLAttributes('font-weight:bold; font-style:normal; font-size:10px; ' as style), event_name_part2)
XMLElement("div",XMLAttributes('font-weight:normal; font-style:normal; font-size:10px; ' as style), event_name_part1)
XMLElement("td",
XMLAttributes('right' as align, 'top' as valign),
XMLElement("div",
XMLElement("a",
XMLAttributes( edit_url as href),
XMLElement("img",
XMLAttributes( '#IMAGE_PREFIX#ed-item.gif' as src, '14' as width, '14' as height, 'Editovat článek/pořad' as alt, 'Editovat článek/pořad' as title)
XMLElement("div",
XMLElement("a",
XMLAttributes( delete_url as href),
XMLElement("img",
XMLAttributes( '#IMAGE_PREFIX#wastebasket.gif' as src, '16' as width, '16' as height, 'Smazat článek/pořad' as alt, 'Smazat článek/pořad' as title)
) as event_description
from (select
case
when EVENT_PROVIDER_TYPE='Magazine' then set_1 || ' ' || set_2 || ' ' || set_3 || ' ' || set_4
when EVENT_PROVIDER_TYPE='Radio' then set_1 || ' ' || set_2 || ' ' || set_3 || ' ' || set_4
when EVENT_PROVIDER_TYPE='Author' then set_2
end as event_name_part1,
case
when EVENT_PROVIDER_TYPE='Magazine' then set_5 || ' ' || set_6
when EVENT_PROVIDER_TYPE='Radio' then set_5 || ' ' || set_6
when EVENT_PROVIDER_TYPE='Author' then set_1
end as event_name_part2,
events.url as event_url,
my_events.issue_date,
providers.icon_path as provider_icon,
providers.provider_name,
case
when substr(upper(providers.www_address),1,7)<>'HTTP://'
then 'http://' || providers.www_address
else providers.www_address
end as provider_url,
'f?p=' || v('APP_ID') || ':2:' || v('SESSION') || '::NO:16:P2_EVENT_ID,P2_EVENT_NAME:' || events.event_id || ',' || events.event_name as delete_url,
'f?p=' || v('APP_ID') || ':35:' || v('SESSION') || '::NO:35:P35_SELECTED_EVENT_ID,P35_SELECTED_EVENT_NAME:' || events.event_id || ',' || events.event_name as edit_url
from my_events
join events on my_events.event_id=events.event_id
join providers on EVENTS.PROVIDER_ID= PROVIDERS.PROVIDER_ID
where my_events.user_id=:IAL_USER_ID
order by my_events.issue_date desc)
P.S. It's cool to use XMLAGG function in combination with GROUP BY clause - it enables you to easily display list of strings as a single filed on the formular....You will be able to use our XSL Processor to format into HTML or
CSV once it is released next month. Adobe is sponsoring a
context for a PDF engine for XML.
Oracle XML Team
http://technet.oracle.com
Oracle Technology Network
Karl Reitschuster (guest) wrote:
: We are developing an IntranetApplication with Oracle Webserver
: and Oracle DB.
: Reports should be generated in HTML or PDF or CSV.
: IS there any tool which can generate these formats on XML-Base.
: How do you generate your documentation which is both in PDF
and
: HTML?
: For any Tips : thank you
null -
Creating optional elements using SQL / XML functions
Hi,
I am struggling with some SQL / XML functionality in order to create some optional elements in a XMLType.
I have one table with data to be generated into an XML document. The table looks like this (only the attributes related to the problem are shown):
msg_id (pk)
geslacht_hoofdverzekerde
geboortedatum_hoofdverzekerde
geslacht_medeverzekerde
geboortedatum_medeverzekerde
I have to create an XML document that looks like this:
<ber:rekenparameters>
<ber:verzekerde>
<ber:codeRelatierol>HVZ</ber:codeRelatierol>
<ber:geslacht>M</ber:geslacht>
<ber:datumGeboorte>01-01-1960</ber:datumGeboorte>
</ber:verzekerde>
<ber:verzekerde>
<ber:codeRelatierol>MVZ</ber:codeRelatierol>
<ber:geslacht>V</ber:geslacht>
<ber:datumGeboorte>01-01-1961</ber:datumGeboorte>
</ber:verzekerde>
</ber:rekenparameters>
Where <ber:codeRelatierol> is hard coded: i.c. of hoofverzekerde 'HVZ' in case of medeverzekerde 'MVZ'.
Geslacht en datumGeboorte are taken form the table.
The element <ber:verzekerde> is obligatiry for hoofdverzekerde but optional for medeverzekerde: only in case geslacht_medeverzekerde and geboortedatum_medeverzekerde are not null this 2nd <ber:verzekerde> element has to be added.
I created the next SQL (I skipped some stuff in order to focus on the problem):
CREATE OR REPLACE
VIEW dps_v_berekening_berichten
AS
SELECT msg_id as msg_id
, XMLElement( "ber:berekening"
, XMLAttributes( 'http://www.w3.org/2001/XMLSchema-instance' AS "xmlns:xsi"
, 'http://www.mycompany.nl/berekenen' AS "xmlns:ber"
, 'http://www.mycompany.nl/berekenen http://www.mycompany.nl/berekenen/berekening.xsd' AS "xsi:schemaLocation"
, XMLElement( "ber:nummerRekenRegel"
, XMLAttributes( 'http://www.mycompany.nl/berekenen' AS "xmlns:ber" )
, 1
, XMLElement( "ber:rekenparameters"
, XMLAttributes( 'http://www.mycompany.nl/berekenen' AS "xmlns:ber" )
, XMLElement( "ber:codeEvolutie" ) -- Empty
, XMLElement( "ber:verzekerde"
, XMLForest ( 'HVZ' AS "ber:codeRelatierol"
, xoa.geslacht_hoofdverzekerde AS "ber:geslacht"
, xoa.geboortedatum_hoofdverzekerde AS "ber:datumGeboorte"
, XMLElement( "ber:verzekerde"
, XMLForest ( 'MVZ' AS "ber:codeRelatierol"
, xoa.geslacht_medeverzekerde AS "ber:geslacht"
, xoa.geboortedatum_medeverzekerde AS "ber:datumGeboorte"
-- Some more elements.
) AS bericht
FROM DST_UP1_XML_OUTDATA xoa
The problem is that the XMLForest always creates an <ber:verzekerde> element for medeverzekerde. I tried to create an inline view with just the "vezekerde"attributes and conditionally joining this inline view with the dst_up1_xml_outdata table. That didn't solve my problem. Because in case of a medeverzekerde available it returned two XML documenst: one that included the hoofdverzekerde and one that included the medeverzekerde. And obviously that's not what I want.
I imagine I have to juggle with some of these SQL / XML functions although I cannot put the finger on the exact differences between some of these (XMLElement, XMLForest, XMLAgg, XMLSequence). The examples shown in de XML DB Developer's Guide don't seem to adress my problem.
Help !Hi, are you talking about this part that you don't want to be there? I am not so clear about your requirements.
XMLElement( "ber:verzekerde"
, XMLForest ( 'MVZ' AS "ber:codeRelatierol"
, xoa.geslacht_medeverzekerde AS "ber:geslacht"
, xoa.geboortedatum_medeverzekerde AS "ber:datumGeboorte"
If you want to control certain subelements so they don't appear, do not use xmlforest. Use xmlelement instead so it is easier to control it using case when. Mark (of Oracle, he should be here soon since OOW is over) showed me this technique and it helps tremendously, because oftentimes XDB will return an empty tag even though your consumers don't like it!
try something like this,
(case when xoa.geboortedatum_medeverzekerde = 'MVZ' then
xmlelement("ber:verzekerde",
xmlelement("What you want", colname),
xmlelement("ber:codeRelatierol", 'MVZ'),
(case when colname is not null or = some other value then
xmlelement("Rest", colname))
end)
end),
You may have to twig some details there. But the key is to use the case when construct to get rid of unwanted elements or empty elements. So you should only have the elements if you have a value of 'MVZ'. Hope this helps.
Ben -
PL/SQL + XML with Excel report format?
Dear all,
I am a new beginner in XML Publisher. For the EBS11i, I can use PL/SQL with http scripts to generate excel report format.
The following code will include in store procedure:
>
begin
owa_util.mime_header(ccontent_type => 'application/vnd.ms-excel');
htp.htmlopen;
htp.headopen;
htp.print( '<STYLE>' );
htp.print( '<!--'||
'.xl24' ||
'{mso-style-parent:style0;' ||
'mso-number-format:"\@";}' ||
'.xl41' ||
'{mso-style-parent:style0;' ||
'mso-NUMBER-format:"\#\,\#\#0\.000";}' ||
'.xl42' ||
'{mso-style-parent:style0;' ||
'mso-NUMBER-format:"\#\,\#\#0\.00";}' ||
'.xl45' ||
'{mso-style-parent:style0;' ||
'mso-NUMBER-format:"\#\,\#\#0";}' ||
'-->' );
htp.print( '</STYLE>' );
htp.headclose;
htp.bodyopen;
htp.para;
htp.strong( '<U>' || 'Sample Report Name'|| '</U>');
htp.para;
htp.tablerowopen;
htp.tabledata('<DIV align="left">' || rec_main2.vendor_name || '</DIV>',cattributes => ' class="xl24" width="190"');
htp.tablerowclose
>
How can I do that in R12?
Please advice.We currently do not support SQL aliasing of directories. This
is causing your errors.
Oracle XML Team
http://technet.oracle.com
Oracle Technology Network
Frank Hubeny (guest) wrote:
: I think I got past this point by first creating a directory
: under sys and then granting read privileges to owner of the
: domsample procedure (in my case the this user is called "xml").
: create directory xml as 'e:\web\xml';
: grant read on directory xml to xml;
: Then the call becomes (I think)
: exec domsample ('XML','family.xml','test.err')
: However, I am getting the following error:
: ERROR at line 1:
: ORA-20100: Error occurred while parsing: XML/err.log
: ORA-06512: at "XML.XMLPARSER", line 43
: ORA-06512: at "XML.XMLPARSER", line 120
: ORA-06512: at "XML.DOMSAMPLE", line 80
: ORA-06512: at line 1
: The readme says "It is necessary for the user running
: this sample to have been granted the appropriate security
: priveleges to read and write from a file on the file
: system." I am not sure what the "write" grant would be.
: And so I also set utl_file_dir so that it pointed to
: the directory. But somehow I don't think that utl_file is
: needed in this context. In any case, it appears I cannot write
: to the err.log file or find it.
: Brad Douglass (guest) wrote:
: : I'm receiving the following error when I use the domsample
: : procedure supplied with the PL/SQL XML parser:
: : SQL> exec domsample('e:\web\xml','test.xml','test.err');
: : begin domsample('e:\web\xml','test.xml','test.err'); end;
: : ERROR at line 1:
: : ORA-20101: Error occurred while accessing a file or URL:
: unknown
: : protocol: file
: : ORA-06512: at "XML.XMLPARSER", line 46
: : ORA-06512: at "XML.XMLPARSER", line 164
: : ORA-06512: at "XML.DOMSAMPLE", line 77
: : ORA-06512: at line 1
: : UTL_FILE doesn't have any problems with the file.
: : Any ideas?
null
Maybe you are looking for
-
How to enable adobe flash player in hulu/crackle
flash player 11 installed, checked in control pannel adobe flash player, shock, air. open hulu choose movie, get message to install flash player before i can watch movie. please tell me what to do, thanks, milan dragin
-
Condition-pricing for External Service Management
Dear Support, Please provide the detail document for pricing for External Service Management,and the use of procedure MS0000 (Performance Procedure) & procedure MS0001 (Perf.Procedure f.Master Cond.)
-
Cannot connect to You Tube / Error playing movie
I am connected to Wi-Fi (verified by checking out Safari) but I keep getting an error message when I try to connect to You Tube. It says "Cannot connect to You Tube". When that message goes away and I try playing a clip it says " Error playing movie"
-
Patch 2669606 Mistake appeared when performing patch: Error updating the master archive In logfile: Writing Undo archive /d01/2669606/backup/VISION/rapidcrm/java ERROR: I/O or zip error while attempting to read entry oracle/apps/ams/list/AmsListactio
-
How to edit the device profile
I need to edit it but I cannot find it. Please help with how to edit it? Thanks!