Encoding in XMLGEN or DBMS_XMLQUERY
Is it possible to set the encoding of the XML generated in
either XMLGEN or DBMS_XMLQUERY package?
We're using Oracle 8.1.5 so we're stuck with an older version of
XSU.
TIA
So, if I have the following code segment:
query := 'select *
from test_table
where col1 = :bind1
and col2 = :bind2';
queryCtx := DBMS_XMLQuery.newContext(query);
DBMS_XMLQuery.setBindValue(queryCtx, 'bind1', parm1);
DBMS_XMLQuery.setBindValue(queryCtx, 'bind2', parm2);
result := DBMS_XMLQuery.getXML(queryCtx);
DBMS_XMLQuery.closeContext(queryCtx);
Are you saying that I need to call 'xmlgen.clearBindValues' before binding any variables? If so, wouldn't it make more sense to have the method in the DBMS_XMLQuery package also? Why use methods from two different packages to manipulate the data?
Also, Mark, thanks for the link to the viewlet, but I think you probably meant to point to
http://otn.oracle.com/tech/xml/htdocs/XDBDemo1.html
or http://otn.oracle.com/tech/xml/htdocs/XDBDemo2.html
am I correct?
Similar Messages
-
I need to have an XML doc generated from the server with the encoding set to Big5.
I just was looking at the XMLGen utilties to replace our own PL/SQL procedures for generating XML from a query. However I can't see any option to specify the encoding.
Does anyone know how to do this.
Rob
null<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Rob Edgar:
I need to have an XML doc generated from the server with the encoding set to Big5.
I just was looking at the XMLGen utilties to replace our own PL/SQL procedures for generating XML from a query. However I can't see any option to specify the encoding.
Does anyone know how to do this.
Rob
<HR></BLOCKQUOTE>
XMLGEN.SETENCODINGTAG('ISO-8859-P1');
will do this for the output XML data. You must specify the charater set based on the NLS_LANG environment variable/registry setting to match this tag.
I used TOAD to look at the SYS.XMLGEN package definition to see extra info on this utility. You should be able to do the same using the ALL_SOURCE view from SQL*Plus.
null -
Hello,
I am using Oracle 10.1.0.5.0 and trying to generate XML with PL/SQL by using XMLGEN package getXML function.
The result I get is almost what I want, only one slight problem in XML header.
XML header in resul is: <?xml versio = "1.0"?>
How can I get the result header like this: <?xml versio = "1.0" encoding = "UTF-8"?>Use DBMS_XMLQuery.
We have got a method named 'setEncodingTag' in DBMS_XMLQuery package, using which u can set the encoding. -
DBMS_XMLQuery and DBMS_XMLSave package
I have Oracle 8.1.7
Where can I get DBMS_XMLQuery and DBMS_XMLSave package using samples
The Documentation I have doesn't contain any.I did what you asked, but still get the following error when running my statement to create xml from a sql statement.
SQL> @xml01
declare
ERROR at line 1:
ORA-29541: class SYS.oracle/xml/sql/query/OracleXMLStaticQuery could not be
resolved
ORA-06512: at "SYS.DBMS_XMLQUERY", line 46
ORA-06512: at line 7
Below is copy of the contents of catxsu.sql script.
call sys.dbms_java.loadjava ('-v -r -s -grant PUBLIC rdbms/jlib/xsu12.jar');
@@dbmsxsu.sql
@@xmlgen.sql
create public synonym dbms_xmlsave for dbms_xmlsave;
create public synonym dbms_xmlquery for dbms_xmlquery;
create public synonym xmlgen for xmlgen;
Below is output from catxsu.sql run this time.
SQL> @catxsu
Call completed.
Package created.
No errors.
Package body created.
No errors.
Grant succeeded.
Package created.
No errors.
Package body created.
No errors.
Grant succeeded.
Package created.
No errors.
Package body created.
No errors.
Grant succeeded.
create public synonym dbms_xmlsave for dbms_xmlsave
ERROR at line 1:
ORA-00955: name is already used by an existing object
create public synonym dbms_xmlquery for dbms_xmlquery
ERROR at line 1:
ORA-00955: name is already used by an existing object
create public synonym xmlgen for xmlgen
ERROR at line 1:
ORA-00955: name is already used by an existing object
SQL> exit
I appreciate your help. Any more ideas? This is working for me on another server and database, but not sure what the difference is with this one.
Thanks,
Tim Gerringer -
How to create Nested (Multi level ) tag in XML using DBMS_XMLQUERY function
Hi,
I need Following out put in CLOB Column.
XML format Like :
<?xml version="1.0" encoding="UTF-8"?>
<ReceiptHeader>
<Id>1234556</Id>
<Type>DD</Type>
<Receipts>
<ReceiptDEO>
<StoreId>11380001</StoreId>
<EmployeeId>NOLO980</EmployeeId>
<LineItems>
<ReceiptLineItem>
<CartonId>ABC12345</CartonId>
<ShippedQty>1.0000</ShippedQty>
<UnitCost>118.500000</UnitCost>
</ReceiptLineItem>
</LineItems>
<ReceiptDate>Wed Jun 20 11:50:01 CEST 2012</ReceiptDate>
<ReceiptNumber>3127855</ReceiptNumber>
</ReceiptDEO>
</Receipts>
</ReceiptHeader>
And i'm using dbms_xmlquery.newcontext ( );
Can you please help to get above output.
- Thanks,
PallaviHi ,
Thanks for reply .
Version is "Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production".
First I tried with DBMS_XMLGEN ,, it doesnt work properly.
Then tried with XMLAGG and XMLELEMENT but giving me output in 1 row. I need proper XML format.
Following is some data, For which I had created view of 2 tables.
ID STORE_ID EMPLOYEE_ID ACTUAL_ARRIVAL_DATE CARTON_ID SHIPMENT_ID QUANTITY_RECEIVED UNIT_COST RECEIPT_DOC_ID RECEIPT_Date
3772 12340001 PALS001 16-Feb-11 2A632 29 28.000 118.50000 1234 16-Feb-11
3775 12340001 PALS001 16-Feb-11 1A633 30 120.000 218.50000 7866 16-Feb-11
3776 12340001 PALS001 16-Feb-11 2A634 30 75.000 345.75000 7876 16-Feb-11
3773 12340001 PALS001 16-Feb-11 3A632 30 45.000 200.10000 7869 16-Feb-11
3774 12340001 PALS001 16-Feb-11 3A632 30 10.000 450.45000 7869 16-Feb-11
Please suggest better way..
-Thanks,
Pallavi -
Hi All,
I'm having problems with the XML generation. The problem is that when we try to generate XML using a query, such as:
select xmlgen.getXML('select content_id, locale_id, content from bc_content_local where delete_p = ''0''',1) from dual;
It works fine so long as of the information retrieved by the query is ASCII. But if there are UTF8 characters in there, the
generation of the XML fails.
I wasn't actually getting an error message. It would work and return XML but as soon as the first UTF-8 character was encountered,
the XML just stopped.
Two questions:
1) Does the XML generation support UTF-8? 2)
If it does (I seem to remember hearing that it did) what has to be done so that this
works correctly?
We are using a UTF8 characterset we set during database creation. I have also tried setting up NLS_LANG in the client registrty to american_america.utf8 - but in both client and server I get teh same message.
Database: Oracle 8.1.7 Standard Edition on Sun-Solaris 2.8
Any help greatly appreciated,
Nilendu Misra
[email protected]Ok, I found we have DBMS_XMLQUERY installed on the schema other than SYS too. But when I issue the same statement using this package I get a different error:
SQL> select dbms_xmlquery.getXML('select content_id, locale_id, content
2 from bc_content_local where delete_p = ''0''',1) from dual;
select dbms_xmlquery.getXML('select content_id, locale_id, content
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception:
java.lang.NullPointerException
ORA-06512: at "SYSTEM.DBMS_XMLQUERY", line 212
ORA-06512: at "SYSTEM.DBMS_XMLQUERY", line 220
ORA-06512: at "SYSTEM.DBMS_XMLQUERY", line 210
ORA-06512: at "SYSTEM.DBMS_XMLQUERY", line 228
ORA-06512: at line 1
I tried searching the XML forum and Metalink but I found most of the reports on this nature of problem are still unanswered.
Thanks in appreciation,
Nilendu
null -
I am using XSU version 1.2.
to generating an XML document from data
which contains German (d,|,v).
The XML parser (2) cannot handle this.
The error i get is:
ERROR at line 1:
ORA-20100: Error occurred while parsing: Invalid UTF8 encoding.
ORA-06512: at "XML.XMLPARSER", line 22
ORA-06512: at "XML.XMLPARSER", line 93
Others seem to have had this problem also,
but i couldn't see the solution...
Thank you
Sonal
nullThe Document must contain
encoding = "ISO-8859-1" in the ?xml tag.
How can i make the XMLGEN.getxml create a document contaning the encoding attribute ?
Thank you
Sonal
null -
Storing Chinese data as clob using dbms_xmlquery
Hi,
I am writing a procedure that creates a query and same is stored as CLOB in a database table. Below is a sample test program for same. I am using UTF-8 to accomodate Chinese data. The CLOB however doesn't contain valid chinese data. Please guide me on what needs to be done....
declare
l_ctx dbms_xmlquery.ctxtype;
l_xml_schema NCLOB;
begin
l_ctx := dbms_xmlquery.newcontext('SELECT * FROM (SELECT "SEC","coretypeid","coreid","Record Type","您ID" FROM (SELECT "您MultiCurrency Object".coreid "SEC","您MultiCurrency Object".coretypeid "coretypeid", "您MultiCurrency Object".coreid "coreid", "您MultiCurrency Object".CoreTypeAssocAliasDescr "Record Type", "您MultiCurrency Object".F_3441961635 "您ID"
FROM ( SELECT SUBSTR(RFN_FlexSQL_Cache.GetCTAliasDescr(CORETYPEID,3441940070,3443315783),0,50) CoreTypeAliasDescr,
SUBSTR(RFN_FlexSQL_Cache.GetCTAssocAliasDescr(CORETYPEID,3441940070,3443315783),0,50) CoreTypeAssocAliasDescr,
SUBSTR(RFN_FlexSQL_Cache.GetCTDescr(CORETYPEID,3441940070,3443315783),0,50) COREDESCRIPTION,
COREID, CORETYPEID ,F_3441961635 FROM CT_3420185025
WHERE coretypeid IN (3420185025)) "您MultiCurrency Object" )) WHERE 1 = 2');
dbms_xmlquery.setraiseexception(l_ctx, TRUE);
dbms_xmlquery.setsqltoxmlnameescaping(l_ctx, TRUE);
-- dbms_xmlquery.setdateformat(l_ctx, l_xml_sformat);
dbms_xmlquery.setencodingtag(l_ctx, 'ISO-8859-1');
l_xml_schema := dbms_xmlquery.getxml(l_ctx,2);
insert into testingXMLgen values (l_xml_schema);
-- :xml_data := dbms_xmlquery.getxml(l_ctx);
dbms_xmlquery.closecontext(l_ctx);
end;I have tried UTF-8 encoding set as well. It didn't work toodbms_xmlquery.setencodingtag(l_ctx, 'UTF-8');
Corresponding database column is NCLOB
select * from nls_database_parameters;PARAMETER VALUE
NLS_LANGUAGE AMERICAN
NLS_NCHAR_CHARACTERSET AL16UTF16
NLS_TERRITORY AMERICA
NLS_CURRENCY $
NLS_ISO_CURRENCY AMERICA
NLS_NUMERIC_CHARACTERS .,
NLS_CHARACTERSET WE8ISO8859P1
NLS_CALENDAR GREGORIAN
NLS_DATE_FORMAT DD-MON-RR
NLS_DATE_LANGUAGE AMERICAN
NLS_SORT BINARY
PARAMETER VALUE
NLS_TIME_FORMAT HH.MI.SSXFF AM
NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR
NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR
NLS_DUAL_CURRENCY $
NLS_COMP BINARY
NLS_LENGTH_SEMANTICS BYTE
NLS_NCHAR_CONV_EXCP FALSE
NLS_RDBMS_VERSION 10.2.0.5.0
20 rows selected. -
Xmlgen.SetbindValue example
Can someone give me a code example of using xmlgen.setbindvalue and the proper format of the xmlgen.getxml() method.
ThanksI'm not exactly sure what your problem is. You are able to bind the same value to another variable with a different name. If you won't know how many variables will appear in your select statement then you have a problem with how the XSU works. The XSU requires you know the structure of the SQL statement you pass it.
You could execute v_query using Native Dynamic SQL in 8i with a using clause containing your bind values. This should allow you to dynamically build your query with n amount of bind variables.
Also, you really should be using DBMS_XMLQUERY instead of XMLGEN. XMLGEN is there for backward compatibility, but DBMS_XMLQUERY is the latest and greatest XSU.
See the Oracle XML Portal website for more info at www.webspedite.com/oracle.
Regards,
Jason M Cohen -
Xmlgen.getxml Nested Cursors with LONG RAW and BLOB Data Types
I am trying to use a nested cursor with xmlgen.getxml that has a long raw or blob column. In either case, it will not return to me any data in the xml document pertaining to that LONG RAW or BLOB column. If I do not use a nested cursor, it works fine.
Example:
SELECT xmlgen.getxml('SELECT x, CURSOR(SELECT y FROM y_tab WHERE y_tab.x_id = x_tab.x_id) y FROM x_tab') FROM dual;
This will not produce the information I am after.
However, simply running:
SELECT xmlgen.getxml('SELECT y FROM y_tab WHERE y_tab.x_id = <somevalue>') FROM dual;
Works???
Any ideas out there? Does anyone know if DBMS_XMLQUERY has this limitation?
Thanks,
BradIt doesn't appear that I am able to attach the PDF files. Can you supply your email (or I can supply mine) so I can send you the three files:
1.) A good PDF (manually extracted from our old application)
2.) Dump of the same PDF file (includes header/footer info)
3.) A partially fixed PDF file (but some of the pictures / pages are cut off - specifically pages 3,5,9,10,12,14)
The way that we have tried to fix the file (in example 3 above) is the following:
a.) Find the First Occurrence of "%PDF-"
b.) Find the Last Occurrence of "%%EOF"
c.) if the first "%PDF-" is found AND the last "%%EOF" is found, then
i.) Remove all data before the first %PDF-
ii.) Remove all data after the last %%EOF
Let me know if you need any other information.
Thanks,
Mike -
I am using the xmlgen package to return an xml result set to java. I am trying to eliminate the id attribute that prints within each row tag. The documentation states that I can use xmlgen.setRowIDAttrName() and pass in an empty string or null to accomplish this. However, when I try this like xmlgen.setRowIDAttrName(NULL) or xmlgen.setRowIDAttrName(''), it does not work. The resulting xml still has the default num="1" ect. I have been successful in changing the name of the attribute but not eliminating it. Does any know if I am doing something wrong or another way to do this? Thanks.
I'm having the same problem. However, if you use the DBMS_XMLQuery method you will be okay:
FUNCTION dateXML RETURN CLOB IS
query VARCHAR2(1000);
result CLOB;
queryCtx DBMS_XMLquery.ctxType;
BEGIN
query := 'select sysdate from dual';
queryCtx := DBMS_XMLQuery.newContext(query);
DBMS_XMLQuery.setRowsetTag(queryCtx,'html');
DBMS_XMLQuery.setRowTag(queryCtx,'body');
DBMS_XMLQuery.setRowIdAttrName(queryCtx,null);
result := DBMS_XMLQuery.getXML(queryCtx);
DBMS_XMLQuery.closeContext(queryCtx);
return result;
END;
Apparently the OracleXMLStaticQuery.setRowIdAttrName method (used by DMBS_XMLQuery) works properly, but the OracleXMLStore.setRowIdAttrName method (used by xmlgen) does not.
Is there another solution or fix for this?
null -
Adobe media encoder error in photoshop
Hi everyone!This morning i have tried to render a video timelapse in photoshop but it showed to me an error which says:''Could not complete the render video command because of a problem with Adobe Media Encoder''.Could anyone tell me how can i fix this error?
Nobody can tell you anything without proper system info or other technical details like exact versions, render settings, details about the source files and so on.
Mylenium -
Hello there ;-)
In After Effect CC u can render picture sequences using a filname like: "Project_[#####].jpg". The [#####] is replaced by the framenumber when rendering. When i render a picture sequenc in Media Encoder CC i Don´t have that oportunity. It allways starts with a Number like 000001. My Question - is it possible to change that in the encoder? So that i have the Frame number in the filename like in After Effect CC? If yes - how? I haven´t find anything!
THANX for your help!I have this issue too. It makes After effects impossible to use with media encoder. What we want is the actual frame number from After effects
Example
I have a 5000 frame AE export.
I can export the lot from AME
Render0000.png - Render5000.png
Client makes a change to Frames 4500-5000
Try and render Work area to AME
Result = Render0001.png - Render0499.png
The only way to keep file numbers is to use AE's render Queue which seem to be way slower than AME? -
Conversion of XML file from ANSI to UTF-8 encoding in SAP 4.6C
Hi All,
Im working on SAP 4.6C version.I have generated a XML file from my custom report.It is downloading in ANSI format.But i need to download this into UTF-8 format.So can anyone please let me know how to do this?
Is this possible in 4.6C version?
Thanks in Advance,
Aruna A NHello
It is possible in 4.6.
Try this code:
REPORT Z_TEST_XML_DOWN .
data:
lp_ixml type ref to if_ixml,
lp_xdoc type ref to if_ixml_document,
lp_sfac type ref to if_ixml_stream_factory,
lp_ostr type ref to if_ixml_ostream,
lp_rend type ref to if_ixml_renderer,
lp_enco type ref to if_ixml_encoding.
data:
lp_root type ref to if_ixml_element,
lp_coll type ref to if_ixml_element,
lp_elem type ref to if_ixml_element.
class cl_ixml definition load.
data:
udat like lfa1,
s type string.
select single * from lfa1 into udat where lifnr = '0000000001'. " <- set here real number
*** create xml
lp_ixml = cl_ixml=>create( ).
lp_xdoc = lp_ixml->create_document( ).
lp_root = lp_xdoc->create_simple_element( name = 'Node'
parent = lp_xdoc ).
s = udat-land1.
call method lp_root->set_attribute( name = 'country_name'
value = s ).
s = udat-name1.
call method lp_root->set_attribute( name = 'vendor_name'
value = s ).
s = udat-ort01.
call method lp_root->set_attribute( name = 'city_name'
value = s ).
*** render xml
types: begin of xml_tab_line,
line(256) type x,
end of xml_tab_line.
types: xtab type table of xml_tab_line.
data: t_xml type xtab,
size type i,
rc type i.
lp_sfac = lp_ixml->create_stream_factory( ).
lp_ostr = lp_sfac->create_ostream_itable( table = t_xml ).
lp_enco = lp_ixml->create_encoding( character_set = 'utf-8'
byte_order = if_ixml_encoding=>co_none ).
call method lp_ostr->set_encoding( encoding = lp_enco ).
lp_rend = lp_ixml->create_renderer( ostream = lp_ostr
document = lp_xdoc ).
rc = lp_rend->render( ).
*** export to file
size = lp_ostr->get_num_written_raw( ).
call function 'WS_DOWNLOAD'
exporting
bin_filesize = size
filename = 'c:\sapxml_test.xml'
filetype = 'BIN'
tables
data_tab = t_xml
exceptions
others = 1.
It is just simple example. -
Media Encoder CC mpeg2 Question
Basically what the title says. Where exactly is the option to format a video into an mpeg2 file? I've been Googling this to death. I know I've seen some people say they had it, then it disappeared. But I literally just downloaded Media Encoder and its nowhere to be found. Even under the DVD and Blue-ray section, the only options are for Blue-ray. I need to burn a wedding video onto a DVD. Is there something special you have to do to get this done? Are there limits on the free trial version that don't allow mpeg2 downloads? Help!
Are you using AME CC 2014? MPEG2 is included in AME under more strict license than other formats and is only activated only if you have Premiere Pro CC 2014, AfterEffects CC 2014 or Prelude CC 2014. If you are using them under a free trial, MPEG2 becomes unavailable after a trial period expires. After a trial has been expired, AME CC 2014 can be used extra 30 more days, but without MPEG2.
If you already used up a trial period, you can either 1) install one of three apps I mentioned earlier that you haven't installed before and activate it as a trial or 2) purchase a subscription for Creative Cloud. #1 option allows you to use MPEG2 30 more days. With #2 option, you can use MPEG2 as long as you keep your subscription active. I hope this helps.
Maybe you are looking for
-
Ipad w/apple tv in the classroom
I have my ipad connected to Apple TV which is connected to a projector via VGA converter. I need to also connect to some type of speakers to be able to use in my classroom. Anyone know what my best/cheapest options are?
-
IPod touch 5th generation constant Apple logo
I was talking to multiple people in a group message. I then decided to use the interenet to look something up. Firstly I tried Chrome, but it closed automatically without showing anything but a white screen. I then resorted to safari to see if it wo
-
Alerts for Decentralized AE (not related to alertcatdef or RWB configs)
HI Experts How do u configure alerts for Decentralized (not the central engine i.e not related to ALRCATDEF or RWB configs) engine? is there any other ways for conferring alerts other than ALERTCATDEF? Thanks in Adv, Munna.
-
Hi all, I need a help regarding popup for displaying my data grid which has too many columns.Right now the whole data is not being diplayed because of too many columns. I want to use an expand all icon, which when clicked opens a popup containing the
-
RE: SSL implementation not available (Https)
I tried to use https from within a jsp with WLS 5.1 using Suns JSSE but at least all i could produce was an SSL implementation not available exception. After converting the jsp to an application i get an: java.net.SocketException: Socket closed