Object View - get XML output in Java [message #124643] |
Mon, 20 June 2005 13:26 |
vinhb
Messages: 1 Registered: June 2005
|
Junior Member |
|
|
I have an object view as
customer_view on
customer_typ which is made up of customer_no (number), customer_name (varchar2) , phone_list(varray 10), address_typ (street, city, state, zip all varchar2)
When I use dbms_xmlgen to get "select * from customer_view" I get I get:
<?xml version="1.0"?>
<ROWSET>
<ROW>
<CUSTOMER_NO>1</CUSTOMER_NO>
<CUSTOMER
_NAME>Jean Nance</CUSTOMER_NAME>
<ADDRESS>
<STREET>2 Avocet Drive</STREET>
<CITY>Redwood Shores</CITY>
<STATE>CA</STATE>
<ZIP>95054</ZIP>
</ADDR
ESS>
<PHONE_LIST>
<VARCHAR2>415-555-1212</VARCHAR2>
<VARCHAR2>650-123-34
56</VARCHAR2>
<VARCHAR2>609-555-1212</VARCHAR2>
<VARCHAR2>201-555-1212</VA
RCHAR2>
</PHONE_LIST>
</ROW>
</ROWSET>
But when I do this in Java using OracleXMLQuery, I get garbage in the derived types as :
<ROWSET>
<ROW num="1">
<CUSTOMER_NO>1</CUSTOMER_NO>
<CUSTOMER_NAME>Jean Nance</CUSTOMER_NAME>
<ADDRESS>
<STREET>0x322041766F636574204472697665</STREET>
<CITY>0x526564776F6F642053686F726573</CITY>
<STATE>0x4341</STATE>
<ZIP>0x3935303534</ZIP>
</ADDRESS>
<PHONE_LIST>
<PHONE_LIST_ITEM>0x3431352D3535352D31323132</PHONE_LIST_ITEM>
<PHONE_LIST_ITEM>0x3635302D3132332D33343536</PHONE_LIST_ITEM>
<PHONE_LIST_ITEM>0x3630392D3535352D31323132</PHONE_LIST_ITEM>
<PHONE_LIST_ITEM>0x3230312D3535352D31323132</PHONE_LIST_ITEM>
</PHONE_LIST>
</ROW>
</ROWSET>
the relevant code in Java is:
strQry = "select * from customer_view" + strWhereClause;
OracleXMLQuery qry = new OracleXMLQuery(conn, strQry );
str = qry.getXMLString();
System.out.println(" The XML output is:\n"+ str);
What can I do to avoid the garbage data in address and phone list ?
|
|
|