How to Convert the following XML? using XSLT Mapper?
Hey all,
I have a simple looking but complex problem
I have a XML file like this
<userdata>
<city> new york</city>
<address>San Fransico </address>
</userdata>
My result XML should look like this
<UserDetails>
<Details>
<id>1234</id>
<place>new york</place>
</Details>
<Details>
<id>42345</id>
<place>San Fransico </place>
</Details>
</UserDetails>
I tried things but they never worked.
Any help regarding this will be of great helpppppppppppppppppppppppppp!!
Thanks in advance
-Murthy.
You can use XSLT. Between, where do you want to get the ID values of the place tag in result xml.
--Shiv
Similar Messages
-
How to generate the following XML-Output?
Hi all,
I would like to generate the following XML-Output without defining any types or tables:
<?xml version = '1.0'?>
<DEPARTMENTS_EMPLOYEES>
<DEPARTMENT NAME="ACCOUNTING">
<DEPTNO>10</DEPTNO>
<LOC>NEW YORK</LOC>
<EMPLOYEES_OF_DEPARTMENT>
<EMPNO>...</EMPNO>
<ENAME>...</ENAME>
</EMPLOYEES_OF_DEPARTMENT>
</DEPARTMENT>
<DEPARTMENT NAME="RESEARCH">
<DEPTNO>20</DEPTNO>
<LOC>DALLAS</LOC>
<EMPLOYEES_OF_DEPARTMENT>
</EMPLOYEES_OF_DEPARTMENT>
</DEPARTMENT>
</DEPARTMENTS_EMPLOYEES>
Unfortunately the following SQL-Statement does not working:
select xmlElement("DEPARTMENTS_EMPLOYEES",
xmlAttributes(d.deptno as "DEPTNO"),
xmlElement("DNAME", d.dname),
xmlElement("LOC", d.loc),
xmlElement("EMPLOYEES_OF_DEPARTMENT",
(select xmlAgg(xmlElement("EMPLOYEE", xmlAttributes(e.empno as "EMPNO"), xmlForest(e.ename as "ENAME", e.job as "JOB", e.hiredate as "HIREDATE", e.sal as "SAL", e.comm as "COMM", m.empno as "MGRNO", m.ename as "MGRNAME" ) )
from emp e, emp m
where e.deptno = d.deptno
and m.empno = e.mgr
) as XML
from dept d;
1. When I provide this statement with SQL*Plus
(unfortunately 9.0.1.3.0) then I get the
following output:
XML()
XMLTYPE()
XMLTYPE()
XMLTYPE()
XMLTYPE()
2. When I provide this statement with SQL Navigator
4.3.0.456 then I get the following error:
[1]: (Error): OCI-21560: argument 3 is null, invalid,
or out of range
3. When I execute the following PL/SQL-Code then I get
the XML-Error message:
DECLARE
x CLOB;
xmlstr VARCHAR2(32767);
line VARCHAR2(2000);
BEGIN
x := dbms_xmlquery.getxml('select xmlElement("DEPARTMENT",
xmlAttributes(d.deptno as "DEPTNO"),
xmlElement("DNAME", d.dname),
xmlElement("LOC", d.loc),
xmlElement("EMPLOYEELIST",
(select xmlAgg(xmlElement("EMPLOYEE",
xmlAttributes(e.empno as "EMPNO"),
xmlForest(e.ename as "ENAME",
e.job as "JOB",
e.hiredate as "HIREDATE",
e.sal as "SAL",
e.comm as "COMM",
m.empno as "MGRNO",
m.ename as "MGRNAME"
from emp e, emp m
where e.deptno = d.deptno
and m.empno = e.mgr
) as XML
from dept d');
xmlstr := dbms_lob.SUBSTR(x,32767);
LOOP
EXIT WHEN xmlstr IS NULL;
line := SUBSTR(xmlstr,1,INSTR(xmlstr,CHR(10))-1);
DBMS_OUTPUT.PUT_LINE(line);
xmlstr := SUBSTR(xmlstr,INSTR(xmlstr,CHR(10))+1);
END LOOP;
END;
<?xml version = '1.0'?>
<ERROR>oracle.xml.sql.OracleXMLSQLException: Unimplemented Feature</ERROR>
4. When I provide the following PL/SQL-Code then I get the same xml-error:
DECLARE
x CLOB;
xmlstr VARCHAR2(32767);
line VARCHAR2(2000);
BEGIN
x := dbms_xmlquery.getxml('select xmlElement("SYSDATE", xmlElement("Datum", to_char(sysdate,''DD.MM.YYYY'')),
xmlElement("Zeit", to_char(sysdate,''HH24:MI:SS''))) as XML
from dual');
xmlstr := dbms_lob.SUBSTR(x,32767);
LOOP
EXIT WHEN xmlstr IS NULL;
line := SUBSTR(xmlstr,1,INSTR(xmlstr,CHR(10))-1);
DBMS_OUTPUT.PUT_LINE(line);
xmlstr := SUBSTR(xmlstr,INSTR(xmlstr,CHR(10))+1);
END LOOP;
END;
<?xml version = '1.0'?>
<ERROR>oracle.xml.sql.OracleXMLSQLException: Unimplemented Feature</ERROR>
Can I generate the needed XML-Output from Database with SQL or PL/SQL?
Can anybody help me?
Regards
Leonid PavlovI have this done with:
DECLARE
qryCtx DBMS_XMLGEN.ctxHandle;
result CLOB;
xmlstr VARCHAR2(32767);
line VARCHAR2(2000);
BEGIN
qryCtx := dbms_xmlquery.newContext('select deptno, dname, loc, cursor(select e.empno, e.ename, e.job,
to_char(e.hiredate,''DD.MM.YYYY'') hiredate, e.sal, e.comm,
m.empno MGRNO, m.ename MGRNAME
from emp e, emp m
where e.deptno = dept.deptno
and m.empno(+) = e.mgr) emp
from dept');
dbms_xmlquery.useNullAttributeIndicator(qryCtx, FALSE);
dbms_xmlquery.setRowsetTag(qryCtx, 'DEPARTMENTS_EMPLOYEES');
dbms_xmlquery.setrowtag(qryCtx, 'DEPARTMENT');
DBMS_XMLQuery.setRowIdAttrName(qryCtx, 'ID');
DBMS_XMLQuery.setRowIdAttrValue(qryCtx, 'DEPTNO');
-- dbms_xmlquery.setrowidattrname(qryCtx, NULL);
result := dbms_xmlquery.getXML(qryCtx);
DBMS_XMLQuery.closeContext(qryCtx);
xmlstr := dbms_lob.SUBSTR(result,32767);
LOOP
EXIT WHEN xmlstr IS NULL;
line := SUBSTR(xmlstr,1,INSTR(xmlstr,CHR(10))-1);
DBMS_OUTPUT.PUT_LINE(line);
xmlstr := SUBSTR(xmlstr,INSTR(xmlstr,CHR(10))+1);
END LOOP;
END;
But how can I rename the <EMP>-Element to Employees? -
How to do the following XML/XSLT operation in a Java Oracle function?
I'd like to write a Java method with the following signature...
public static oracle.xdb.XMLType bwdtransform(java.lang.String suname, oracle.sql.CLOB documentText)
The documentText is simply a CLOB that contains the XML. It needs to have two XSLT stylesheets applied to it, then made into an XMLType and returned.
Another requirement is that the stylesheets have to have the Java XPath extensibility, which is available using the namespace "xmlns:java.lang.String="http://www.oracle.com/XSL/Transform/java/java.lang.String".
I've tried a couple of different ways using oracle.xdb.XMLType.transform() and the classes in the oracle package oracle.xml.parser.v2.*, which is what the listing I pasted in below is based on, but I haven't been able to get anything to work. I THINK the XMLType.transform failed because I was using the Java XPath extensions.
I'd appreciate it if there's a standard Oracle recommended way to do this operation, preferably as optimized as possible.
Here btw is the current code I'm using which isn't working. Any variables that you see that aren't initialized in the function are static to the class and initialized in a static {} block including the stylesheets which are instances of XSLStylesheet.
public static XMLType bwdtransform(java.lang.String suname, oracle.sql.CLOB documentText) throws Exception {
parser.parse(new ByteArrayInputStream(clobToString(documentText).getBytes()));
XMLDocument documentTextXMLDocument = parser.getDocument();
XMLDocumentFragment docFrag = processor.processXSL(twiddlerXSLStylesheet, processor.processXSL(adopterXSLStylesheet, documentTextXMLDocument));
Document intermediateDoc = docFrag.getOwnerDocument();
XMLType x = new XMLType(conn, intermediateDoc);
return x;
I haven't been able to find any way to make this work and any any help in that direction would be oh so greatly appreciated.
For completeness, here's the version of Oracle I'm running, according to sqlplus...
SQL*Plus: Release 11.1.0.7.0 - Production on Thu Apr 30 20:24:53 2009
Thanks!
RalphThe XMLDB way of doing this like this would be something like the following examples:
SELECT XMLtransform(x.xmlcol,
DBURIType('/XDB/STYLESHEET_TAB/ROW[ID=1]
/STYLESHEET/text()').getXML()).getStringVal()
AS result
FROM po_tab x; or
SELECT XMLtransform(x.xmlcol,
(SELECT stylesheet FROM stylesheet_tab WHERE id=1)).getStringVal()
AS result
FROM po_tab x; or use DBMS_XSLPROCESSOR... -
How to parse the following xml file
Hi
I have an xml file with the following data
Example.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<html><set label="09/07/29" value="1241.90"/>
</html>
How do i retrive the values of the attributes
Example i want the label value 09/07/29
and 1241.90 to be inserted into some temp table.
Appreciate if any one can provide me the solution.
Thanks,it's more an XQuery question than DB XML one.
Anyway, you can use the following queries to get attributes values:
doc(<your_doc>)/html/set/@label
doc(<your_doc>)/html/set/@valueYou can retrieve both values in a single query, but for this please refer to the XQuery specification.
Or read: [http://www.oracle.com/technology/documentation/berkeley-db/xml/gsg_xml/java/xquery.html#xqueryintro]
Best,
Vyacheslav -
How to convert the following?
Hi ,
Below is the java command line that I provide on dos prompt.
How to I convert the same for unix commandline
java -cp C:\joost-20090315\lib\joost.jar;C:/joost-20090315/lib/commons-discovery-0.4.jar;C:/joost-20090315/lib/avalon-framework-4.2.0.jar;C:/joost-20090315/lib/batik-all-1.7.jar;C:/joost-20090315/lib/bsf.jar;C:/joost-20090315/lib/commons-io-1.3.1.jar;C:/joost-20090315/lib/fop.jar;C:/joost-20090315/lib/joostGen.jar;C:/joost-20090315/lib/log4j-1.2.15.jar;C:/joost-20090315/lib/resolver.jar;C:/joost-20090315/lib/serializer.jar;C:/joost-20090315/lib/serializer-2.7.0.jar;C:/joost-20090315/lib/servlet-2.2.jar;C:/joost-20090315/lib/xalan-2.7.0.jar;C:/joost-20090315/lib/xercesImpl.jar;C:/joost-20090315/lib/xercesImpl-2.7.1.jar;C:/joost-20090315/lib/xercesSamples.jar;C:/joost-20090315/lib/xml-apisv.jar;C:/joost-20090315/lib/xml-apis-1.3.04.jar;C:/joost-20090315/lib/xml-apis-ext-1.3.04.jar;C:/joost-20090315/lib/xmlgraphics-commons-1.3.1.jar;C:/joost-20090315/lib/commons-logging.jar;C:/joost-20090315/lib/xsltc.jar net.sf.joost.Main sdeg24.xml etl_main_stx.stx
Regards,
sSDNDeveloper wrote:
Below is the java command line that I provide on dos prompt.
java -cp C:\joost-20090315\lib\joost.jar;C:/joost-20090315/lib/commons-discovery-0.4.jar;C:/joost-20090315/lib/avalon-framework-4.2.0.jar;C:/joost-20090315/lib/batik-all-1.7.jar;C:/joost-20090315/lib/bsf.jar;C:/joost-20090315/lib/commons-io-1.3.1.jar;C:/joost-20090315/lib/fop.jar;C:/joost-20090315/lib/joostGen.jar;C:/joost-20090315/lib/log4j-1.2.15.jar;C:/joost-20090315/lib/resolver.jar;C:/joost-20090315/lib/serializer.jar;C:/joost-20090315/lib/serializer-2.7.0.jar;C:/joost-20090315/lib/servlet-2.2.jar;C:/joost-20090315/lib/xalan-2.7.0.jar;C:/joost-20090315/lib/xercesImpl.jar;C:/joost-20090315/lib/xercesImpl-2.7.1.jar;C:/joost-20090315/lib/xercesSamples.jar;C:/joost-20090315/lib/xml-apisv.jar;C:/joost-20090315/lib/xml-apis-1.3.04.jar;C:/joost-20090315/lib/xml-apis-ext-1.3.04.jar;C:/joost-20090315/lib/xmlgraphics-commons-1.3.1.jar;C:/joost-20090315/lib/commons-logging.jar;C:/joost-20090315/lib/xsltc.jar net.sf.joost.Main sdeg24.xml etl_main_stx.stx
I would probably use
java -Djava.ext.dirs=/joost-20090315/lib net.sf.joost.Main sdeg24.xml etl_main_stx.stxwhich should work on both Windows and linux. -
How to convert to ' ' in xml using xsl.
Hi all,
I have a string downloaded which has the following string
String= text1 <I> text2 </I⁢
I have italics tag in my xml file. But my browser does not identifies italics. So i decided to comment out italics tag in my xml using xsl
So what i need is
String = text1 <!--I-->text2<!--I-->
basically to comment out italics tag alone.
How can i replace <I> to <!--I-->?
Is there any way in xsl to do the above in a string?
or
Any other ways where i can just remove <I> in my out xml file using xsl?
Thanks in advance.
Menaga.Hi,
The ultimate solution would be that you also install also a cocoon server (http://cocoon.apache.org/), but that might be overkill.
Have a look at /people/sap.user72/blog/2004/11/10/bsphowto-generate-pdf-output-from-a-bsp for detailed info on creating PDF from BSP.
If you want to use XSL(-FO), you might have a look at things like http://alt-soft.com/products_xml2pdf.jsp to be called as external command.
Eddy -
How to convert the following query to sql server 2005
hi
i have the following query in ms access and i want to convert it into sql server 2005 express edition
SELECT iif(Max(BNo) is null,1,Max(BNo)+1) AS BNo from ( SELECT iif(Max(Product.BNo) is null,0,Max(Product.BNo)) AS BNo FROM Product union all SELECT iif(Max(grndetail.BNo) is null,0,Max(grndetail.BNo)) AS BNo FROM grndetail UNION ALL SELECT iif(Max(srdetail.BNo) is null,0,Max(srdetail.BNo)) AS BNo FROM srdetail ) as t
how to do thisThe construct involving case when MAX sounds suspicious. Can you explain what the query is supposed to be doing, the structure of your table, then we can re-write it?
E.g. if you provide your table, some data and desired result, you'll get better answer than direct translation of this suspicious query.
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles -
How to convert the following code into an applet
Please reply for me as soon as you can.
import java.io.*;
import java.awt.Frame;
import java.awt.FlowLayout;
import java.awt.Color;
import java.awt.Insets;
import java.awt.Dimension;
import java.awt.event.WindowListener;
import java.awt.event.WindowEvent;
import java.util.Enumeration;
import javax.comm.CommPort;
import javax.comm.CommPortIdentifier;
import javax.comm.SerialPort;
import javax.comm.NoSuchPortException;
import javax.comm.PortInUseException;
public class BlackBox extends Frame implements WindowListener
static int portNum = 0,
panelNum = 0,
rcvDelay = 0;
static SerialPortDisplay[] portDisp;
static BlackBox win;
static boolean threaded = true,
silentReceive = false,
modemMode = false,
friendly = false;
public BlackBox()
super("Serial Port Black Box Tester");
addNotify();
addWindowListener(this);
public void windowIconified(WindowEvent event)
public void windowDeiconified(WindowEvent event)
public void windowOpened(WindowEvent event)
public void windowClosed(WindowEvent event)
public void windowActivated(WindowEvent event)
public void windowDeactivated(WindowEvent event)
public void windowClosing(WindowEvent event)
cleanup();
dispose();
System.exit(0);
public static void main(String[] args)
Enumeration ports;
CommPortIdentifier portId;
boolean allPorts = true,
lineMonitor = false;
int idx = 0;
win = new BlackBox();
win.setLayout(new FlowLayout());
win.setBackground(Color.gray);
portDisp = new SerialPortDisplay[4];
while (args.length > idx)
if (args[idx].equals("-h"))
printUsage();
else if (args[idx].equals("-f"))
friendly = true;
System.out.println("Friendly mode");
else if (args[idx].equals("-n"))
threaded = false;
System.out.println("No threads");
else if (args[idx].equals("-l"))
lineMonitor = true;
System.out.println("Line Monitor mode");
else if (args[idx].equals("-m"))
modemMode = true;
System.out.println("Modem mode");
else if (args[idx].equals("-s"))
silentReceive = true;
System.out.println("Silent Reciever");
else if (args[idx].equals("-d"))
idx++;
rcvDelay = new Integer(args[idx]).intValue();
System.out.println("Receive delay = "
+ rcvDelay + " msecs");
else if (args[idx].equals("-p"))
idx++;
while (args.length > idx)
* Get the specific port
try
portId =
CommPortIdentifier.getPortIdentifier(args[idx]);
System.out.println("Opening port "
+ portId.getName());
win.addPort(portId);
catch (NoSuchPortException e)
System.out.println("Port "
+ args[idx]
+ " not found!");
idx++;
allPorts = false;
break;
else
System.out.println("Unknown option "
+ args[idx]);
printUsage();
idx++;
if (allPorts)
* Get an enumeration of all of the comm ports
* on the machine
ports = CommPortIdentifier.getPortIdentifiers();
if (ports == null)
System.out.println("No comm ports found!");
return;
while (ports.hasMoreElements())
* Get the specific port
portId = (CommPortIdentifier)
ports.nextElement();
win.addPort(portId);
if (portNum > 0)
if (lineMonitor)
if (portNum >= 2)
portDisp[0].setLineMonitor(portDisp[1],
true);
else
System.out.println("Need 2 ports for line monitor!");
System.exit(0);
else
System.out.println("No serial ports found!");
System.exit(0);
private void addPort(CommPortIdentifier portId)
* Is this a serial port?
if (portId.getPortType()
== CommPortIdentifier.PORT_SERIAL)
// Is the port in use?
if (portId.isCurrentlyOwned())
System.out.println("Detected "
+ portId.getName()
+ " in use by "
+ portId.getCurrentOwner());
* Open the port and add it to our GUI
try
portDisp[portNum] = new
SerialPortDisplay(portId,
threaded,
friendly,
silentReceive,
modemMode,
rcvDelay,
win);
this.portNum++;
catch (PortInUseException e)
System.out.println(portId.getName()
+ " in use by "
+ e.currentOwner);
public void addPanel(SerialPortDisplay panel)
Dimension dim;
Insets ins;
win.add(panel);
win.validate();
dim = panel.getSize();
ins = win.getInsets();
dim.height = ((this.panelNum + 1) * (dim.height + ins.top
+ ins.bottom)) + 10;
dim.width = dim.width + ins.left + ins.right + 20;
win.setSize(dim);
win.show();
panelNum++;
static void printUsage()
System.out.println("Usage: BlackBox [-h] | [-f] [-l] [-m] [-n] [-s] [-d receive_delay] [-p ports]");
System.out.println("Where:");
System.out.println("\t-h this usage message");
System.out.println("\t-f friendly - relinquish port if requested");
System.out.println("\t-l run as a line monitor");
System.out.println("\t-m newline is \\n\\r (modem mode)");
System.out.println("\t-n do not use receiver threads");
System.out.println("\t-s don't display received data");
System.out.println("\t-d sleep for receive_delay msecs after each read");
System.out.println("\t-p list of ports to open (separated by spaces)");
System.exit(0);
private void cleanup()
SerialPort p;
while (portNum > 0)
portNum--;
panelNum--;
* Close the port
p = portDisp[portNum].getPort();
if (p != null)
System.out.println("Closing port "
+ portNum
+ " ("
+ p.getName()
+ ")");
portDisp[portNum].closeBBPort();
}hi welcome to java forum,
please do one thing for me so that i can help you, can you put your code in a code tag [code ][code ] (without spaces) so that your code can be readable easily -
How to generate the following XML
Hi all,
I have 2 tables, demo_orders and demo_order_items (child)
how can I generate something like this :
<?xml version="1.0"?>
<ROWSET>
<ROW>
<ORDER_ID>1</ORDER_ID>
<CUSTOMER_ID>1</CUSTOMER_ID>
<ORDER_TOTAL>1200</ORDER_TOTAL>
<ORDER_TIMESTAMP>2009-01-16T16:20:09.000</ORDER_TIMESTAMP>
<USER_ID>2</USER_ID>
<ITEMS>
<ITEMROW>
<ORDER_ITEM_ID>1</ORDER_ITEM_ID>
<ORDER_ID>1</ORDER_ID>
<PRODUCT_ID>1</PRODUCT_ID>
<UNIT_PRICE>1200</UNIT_PRICE>
<QUANTITY>1</QUANTITY>
</ITEMROW>
</ITEMS>
</ROW>
<ROW>
<ORDER_ID>2</ORDER_ID>
<CUSTOMER_ID>2</CUSTOMER_ID>
<ORDER_TOTAL>599</ORDER_TOTAL>
<ORDER_TIMESTAMP>2009-01-11T16:20:09.000</ORDER_TIMESTAMP>
<USER_ID>2</USER_ID>
<ITEMS>
<ITEMROW>
<ORDER_ITEM_ID>2</ORDER_ITEM_ID>
<ORDER_ID>2</ORDER_ID>
<PRODUCT_ID>2</PRODUCT_ID>
<UNIT_PRICE>199</UNIT_PRICE>
<QUANTITY>1</QUANTITY>
</ITEMROW>
<ITEMROW>
<ORDER_ITEM_ID>3</ORDER_ITEM_ID>
<ORDER_ID>2</ORDER_ID>
<PRODUCT_ID>8</PRODUCT_ID>
<UNIT_PRICE>50</UNIT_PRICE>
<QUANTITY>2</QUANTITY>
</ITEMROW>
</ITEMS>
</ROW>
</ROWSET>Hi, I'm assuming that table columns have the same names as the xml elements in your example.
Try this:
SQL >select xmlelement("ROWSET",
2 xmlagg(xmlelement("ROW",xmlforest(order_id,
3 customer_id,
4 order_total,
5 to_char(order_timestamp,'yyyy-mm-dd"T"hh24:mi:ss.FF3') as "ORDER_TIMESTAMP",
6 user_id),
7 xmlelement("ITEMS",(select
8 xmlagg(xmlelement("ITEMROW",xmlforest(order_item_id,
9 order_id,
10 product_id,
11 unit_price,
12 quantity)
13 )
14 ) from demo_order_items i where i.order_id=o.order_id)
15 )
16 )
17 )
18 ).extract('/*') as yourXML
19 from demo_orders o;
YOURXML
<ROWSET>
<ROW>
<ORDER_ID>1</ORDER_ID>
<CUSTOMER_ID>1</CUSTOMER_ID>
<ORDER_TOTAL>1200</ORDER_TOTAL>
<ORDER_TIMESTAMP>2009-12-28T10:19:01.464</ORDER_TIMESTAMP>
<USER_ID>2</USER_ID>
<ITEMS>
<ITEMROW>
<ORDER_ITEM_ID>1</ORDER_ITEM_ID>
<ORDER_ID>1</ORDER_ID>
<PRODUCT_ID>1</PRODUCT_ID>
<UNIT_PRICE>1200</UNIT_PRICE>
<QUANTITY>1</QUANTITY>
</ITEMROW>
</ITEMS>
</ROW>
<ROW>
<ORDER_ID>2</ORDER_ID>
<CUSTOMER_ID>2</CUSTOMER_ID>
<ORDER_TOTAL>599</ORDER_TOTAL>
<ORDER_TIMESTAMP>2009-12-28T10:19:01.464</ORDER_TIMESTAMP>
<USER_ID>2</USER_ID>
<ITEMS>
<ITEMROW>
<ORDER_ITEM_ID>2</ORDER_ITEM_ID>
<ORDER_ID>2</ORDER_ID>
<PRODUCT_ID>2</PRODUCT_ID>
<UNIT_PRICE>199</UNIT_PRICE>
<QUANTITY>1</QUANTITY>
</ITEMROW>
<ITEMROW>
<ORDER_ITEM_ID>3</ORDER_ITEM_ID>
<ORDER_ID>2</ORDER_ID>
<PRODUCT_ID>8</PRODUCT_ID>
<UNIT_PRICE>50</UNIT_PRICE>
<QUANTITY>2</QUANTITY>
</ITEMROW>
</ITEMS>
</ROW>
</ROWSET>The extract('/*') method it's only useful to get a pretty formatted output. Remove it in your production applications for better performances and space saving.
Max
[My Italian Oracle blog|http://oracleitalia.wordpress.com/2009/12/27/inviare-email-dal-db-utilizzando-utl_smtp/] -
How to access the following xml data in Flex
<users>
<user dept id="HR">
<user>
<fname>mm</fname>
<email>[email protected]</email>
</user>
<user>
<fname>sss</fname>
<email>[email protected]</email>
</user>
</dept>
<user dept id="Finance">
<user>
<fname>ffff</fname>
<email>[email protected]</email>
</user>
<user>
<fname>www</fname>
<email>[email protected]</email>
</user>
</dept>
</users>
using HTTP service through access the data
this my user.xml file i want to display all the item in flex datagrid using tab navigator function................ each tab navigator contain one data grid for corresponding Dept like HR, sales , Finance
corresponding information will display in data grid
first tab navigatore is
HR -> data grid field like fname , Email
finance -> fname, E Mailgreat for quick reply
my XML file is data.xml
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
private var myUser:XML =
<users>
<dept id="hr">
<user>
<firstName>murali</firstName>
<emailAddress>[email protected]</emailAddress>
</user>
<user>
<firstName>bharathi</firstName>
<emailAddress>[email protected]</emailAddress>
</user>
<user>
<firstName>vasa</firstName>
<emailAddress>[email protected]</emailAddress>
</user>
</dept>
<dept id = "finance">
<user>
<firstName>mohan</firstName>
<emailAddress>[email protected]</emailAddress>
</user>
<user>
<firstName>vinoth</firstName>
<emailAddress>[email protected]</emailAddress>
</user>
</dept>
<dept ="sales">
<user>
<firstName>manoj</firstName>
<emailAddress>[email protected]</emailAddress>
</user>
<user>
<firstName>deepan</firstName>
<emailAddress>[email protected]</emailAddress>
</user>
</dept>
</users>
codings i used
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" creationComplete="htp.send()">
<mx:HTTPService id="htp" url="data.xml"
result="resulthandler(event)"
fault="faulthandler(event)"/>
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
[Bindable] private var userlist:ArrayCollection;
private function resulthandler(event:ResultEvent):void
userlist=(htp.lastResult.user.dept.user);
private function faulthandler(event:FaultEvent):void
]]>
</mx:Script>
<mx:TabNavigator>
<mx:Repeater id="rep" dataProvider="{data.dept}"> <!--data.xml is my fle name-->
<mx:Canvas label="{rep.currentItem.@id}">
<mx:DataGrid dataProvider="{rep.currentItem.user}">
<mx:columns>
<mx:DataGridColumn headerText="Name" dataField="fname"/>
<mx:DataGridColumn headerText="E Mail" dataField="email"/>
</mx:columns>
</mx:DataGrid>
</mx:Canvas>
</mx:Repeater>
</mx:TabNavigator>
</mx:Application>
its not show anything -
How to convert the following FORALL Update to direct SQL UPDATE statement
I have a FORALL loop to update a table. It is taking too long. I want to rewrite the code to a direct UPDATE sql. Also, any other tips or hints which can help run this proc faster?
CURSOR cur_bst_tm IS
SELECT listagg(tm, ' ') WITHIN GROUP(ORDER BY con_addr_id) best_time,
con_addr_id
FROM (select Trim(Upper(con_addr_id)) con_addr_id,
||decode(Initcap(start_day),
'Monday', 'm',
'Tuesday', 'tu',
'Wednesday', 'w',
'Thursday', 'th',
'Friday', 'f',
Initcap(start_day))
||'='
||trunc(( ( TO_DATE(start_tm,'HH12:MI:SS PM') - trunc(TO_DATE(start_tm,'HH12:MI:SS PM')) ) * 24 * 60 ))
||','
||trunc(( ( TO_DATE(end_tm,'HH12:MI:SS PM') - trunc(TO_DATE(end_tm,'HH12:MI:SS PM')) ) * 24 * 60 )) tm
FROM (SELECT DISTINCT * FROM ODS_IDL_EDGE_OFFC_BST_TM)
WHERE con_addr_id is not null)
GROUP BY con_addr_id
ORDER BY con_addr_id;
TYPE ARRAY IS TABLE OF cur_bst_tm%ROWTYPE;
l_data ARRAY;
BEGIN
OPEN cur_bst_tm;
LOOP
FETCH cur_bst_tm BULK COLLECT INTO l_data LIMIT 1000;
FORALL i IN 1..l_data.COUNT
UPDATE ODS_CONTACTS_ADDR tgt
SET best_times = l_data(i).best_time,
ODW_UPD_BY = 'IDL - MASS MARKET',
ODW_UPD_DT = SYSDATE,
ODW_UPD_BATCH_ID = '0'
WHERE Upper(edge_id) = l_data(i).con_addr_id
AND EXISTS (SELECT 1 FROM ods_idl_edge_cont_xref src
WHERE tgt.contacts_odw_id = src.contacts_odw_id
AND src.pc_flg='Y')
EXIT WHEN cur_bst_tm%NOTFOUND;
END LOOP;
CLOSE cur_bst_tm;Record count:-
select count(*) from
ODS_IDL_EDGE_OFFC_BST_TM;
140,000
SELECT count(*)
FROM ods_idl_edge_cont_xref src
WHERE src.pc_flg='Y';
118,000
SELECT count(*)
FROM ODS_CONTACTS_ADDR;
671,925
Database version 11g.
Execution Plan for the update:
Operation Object Name Rows Bytes Cost Object Node In/Out PStart PStop
UPDATE STATEMENT Optimizer Mode=ALL_ROWS 6 K 8120
UPDATE ODW_OWN2.ODS_CONTACTS_ADDR
HASH JOIN SEMI 6 K 256 K 8120
TABLE ACCESS FULL ODW_OWN2.ODS_CONTACTS_ADDR 6 K 203 K 7181
TABLE ACCESS FULL ODW_OWN2.ODS_IDL_EDGE_CONT_XREF 118 K 922 K 938
Edited by: user10566312 on May 14, 2012 1:07 AMThe code tag should be in lower case like this {noformat}{noformat}. Otherwise your code format will be lost.
Here is a update statementupdate ods_contacts_addr tgt
set (
best_times, odw_upd_by, odw_upd_dt, odw_upd_batch_id
) =
select best_time, odw_upd_by, odw_upd_dt, odw_upd_batch_id
from (
select listagg(tm, ' ') within group(order by con_addr_id) best_time,
'IDL - MASS MARKET' odw_upd_by,
sysdate odw_upd_dt,
'0' odw_upd_batch_id,
con_addr_id
from (
select Trim(Upper(con_addr_id)) con_addr_id,
||decode(Initcap(start_day), 'Monday', 'm', 'Tuesday', 'tu', 'Wednesday', 'w', 'Thursday', 'th', 'Friday', 'f', Initcap(start_day))
||'='
||trunc(((TO_DATE(start_tm,'HH12:MI:SS PM')-trunc(TO_DATE(start_tm,'HH12:MI:SS PM')))*24*60 ))
||','
||trunc(((TO_DATE(end_tm,'HH12:MI:SS PM')-trunc(TO_DATE(end_tm,'HH12:MI:SS PM')))*24*60)) tm
FROM (
select distinct * from ods_idl_edge_offc_bst_tm
WHERE con_addr_id is not null
group
by con_addr_id
where upper(tgt.edge_id) = con_addr_id
where exists
SELECT 1
FROM ods_idl_edge_cont_xref src
WHERE tgt.contacts_odw_id = src.contacts_odw_id
AND src.pc_flg='Y'
and exists
select null
from (
SELECT listagg(tm, ' ') WITHIN GROUP(ORDER BY con_addr_id) best_time,
'IDL - MASS MARKET' odw_upd_by,
SYSDATE odw_upd_dt,
'0' odw_upd_batch_id,
con_addr_id
FROM (
select Trim(Upper(con_addr_id)) con_addr_id,
||decode(Initcap(start_day), 'Monday', 'm', 'Tuesday', 'tu', 'Wednesday', 'w', 'Thursday', 'th', 'Friday', 'f', Initcap(start_day))
||'='
||trunc(((TO_DATE(start_tm,'HH12:MI:SS PM')-trunc(TO_DATE(start_tm,'HH12:MI:SS PM')))*24*60 ))
||','
||trunc(((TO_DATE(end_tm,'HH12:MI:SS PM')-trunc(TO_DATE(end_tm,'HH12:MI:SS PM')))*24*60)) tm
FROM (
SELECT DISTINCT * FROM ODS_IDL_EDGE_OFFC_BST_TM
WHERE con_addr_id is not null
GROUP
BY con_addr_id
where upper(tgt.edge_id) = con_addr_id
This is an untested code. If there is any syntax error then please fix it and try. -
Does anyone know how to convert the output from the standard report to xml?
Does anyone know how to convert the output from the standard SAP report to xml?
since it a standard report which you cannot modify you can only do the following.
submit report exporting list to memory
then
list from memory and then
use the returned itab along with CALL TRNSFORMATION key word to convert to xml.
but this only going to place the whole list content (including data and formating lines,etc) into a xml element and not the actual data alone in the list . -
How to deploy the web.xml file when trying to use the JSP SDK from SAP?
I want to use the adduser.jsp which downloaded form SAP SDK samples to add user in BO, but I cannot run it sucessfully. I believe it's caused the web.xml file was not deployed appropriately.
could you please teach how to deploy the web.xml file for the JSP samples ?
Could you show me some sample of web.xml for the SDK jsp files? Thank you very much!Ensure that you have followed below directory structure while deploying your web application.
web_application_name
WEB-INF
lib
classes
web.xml must be placed in WEB-INF. Ensure that you have included all the jar files and other necessary files in your application.
For more information refer to the below link:
http://devlibrary.businessobjects.com/BusinessObjectsXIR2SP2/en/devsuite.htm
Regards,
Anuj -
How to config the web.xml file, when I use Richfaces + RI 1.2?
Hi there:
I want to use Richfaces + RI 1.2 to build a project. I don`t know how to config the web.xml file.
By the way, my web server is Tomcat 6.0, my JDK's version is 6u6. I don`t want to use the facelets.
thanks.
lxmjust add this before *</web-app>*
<context-param>
<param-name>org.richfaces.SKIN</param-name>
<param-value>blueSky</param-value>
</context-param>
<filter>
<display-name>RichFaces Filter</display-name>
<filter-name>richfaces</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
<filter-mapping>
<filter-name>richfaces</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping> -
Query on sorting XML using XSLT and getting the same XML as output !
Hi,
Looking for one information regarding sorting XML using XSLT , with the sorted XML as output. For eg. my XML is :
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="sort1.xsl"?>
<levelone>
<child ID="1" sort="5">
<name>Paul</name>
</child>
<child ID="2" sort="1">
<name>Adam</name>
</child>
<child ID="3" sort="2">
<name>Will</name>
</child>
</levelone>
and XSL :
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/levelone">
<xsl:copy>
<xsl:apply-templates>
<xsl:sort select="@sort"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
<xsl:template match="child">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>
This does the sort based on Name. But I want to get the same xml as output with the name sorted. Eg.
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="sort1.xsl"?>
<levelone>
<child ID="2" sort="1">
<name>Adam</name>
</child>
<child ID="1" sort="5">
<name>Paul</name>
</child>
<child ID="3" sort="2">
<name>Will</name>
</child>
</levelone>
Any pointers will be highly appreciated.
- ThanksDon't you want <xsl:sort select="name"/> rather than <xsl:sort select="@sort"/>?
Maybe you are looking for
-
CS4 Master Collection/Windows 7 Broken Setup.exe
Yesterday I made the jump from Windows Vista to Windows 7 Beta--everything carried over nicely except for my CS4 Master Collection. Upon booting Premiere Pro up, I was informed that my "trial" had expired--a fact which I knew was not true as I own re
-
I'm working on a complex application that dynamically creates large Flex forms based on XML values from a server. There is a bug, where under certain conditions, tab groups are formed within a form -- tabbing loops through fields 4 to 8, when a radio
-
Multiple goods suppliers ( different branches ) code in single PO.
Hello, We want to issue single purchase order in favour of head office of certain vendor which is having multiple branches across country producing same material. At the time of issuing po which branch will supply material is not known, how to accoun
-
JCA Adapter Postprocessing with OSB
Hi, I am using JCA file adapter with OSB to generate flatfile output from xml (nxsd). I would like to know if it is possible to use JCA adapter post processing with OSB. (JCA pipeline and valves). Please let me know if you have tried this. Thank you
-
URGENT!!! How to call Webservice which uses JKS from BusinessService
Hi One of our webservice require a client certificate (.JKS) to stablish the connection How/where to add the the following details to call business service? org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin org.ap