Method DBMS_XMLQUERY.getXML() always inserts " ?xml version = '1.0'? " in output
Method "SYS.DBMS_XMLQUERY.getXML()" seems to always want to prefix "<?xml version = '1.0'?>" to the returned output.
I don't think this is always called for.
I want to extract data from the database as an XML fragment. Outside of the RDBMS, I would then combine multiple fragments together into a larger XML document. If each fragment is prefixed with "<?xml version = '1.0'?>", I have to add logic to strip out this offending line.
I tried method setXslt(). Even when my XSL stylesheet transforms the XML into HTML or TEXT, the output gets prefixed with "<?xml version = '1.0'?>", which I feel is wrong.
Question: Is there any way to instruct DBMS_XMLQUERY to omit "<?xml version = '1.0'?>" ?
Thanks!
Louis
Hi,
Use DBMS_XMLGEN.getXMLType to retrieve the XML data into an XMLType variable.
Then, with getClobVal method, you can convert it to CLOB :
SQL> DECLARE
2 v_xml XMLType;
3 v_lob CLOB;
4 BEGIN
5 v_xml := dbms_xmlgen.getXMLType('select * from scott.emp where rownum = 1');
6 v_lob := v_xml.getClobVal();
7
8 dbms_output.put_line(v_lob);
9 END;
10 /
<ROWSET>
<ROW>
<EMPNO>7369</EMPNO>
<ENAME>SMITH</ENAME>
<JOB>CLERK</JOB>
<MGR>7902</MGR>
<HIREDATE>17/12/80</HIREDATE>
<SAL>800</SAL>
<DEPTNO>20</DEPTNO>
</ROW>
</ROWSET>
PL/SQL procedure successfully completed
Similar Messages
-
Hi, I have a message which must contain XML inside XML, this internal one must start off with the <?xml version="1.0" encoding="utf-8"?> string.
Is there a nice trick for inserting this before an element? (not at the beginning of the mapping, a specific place further inside the XML).
All of the other elements are mapped as part of the message type.Did you check Message Mapping : Play around with target structure .
You can do this easily with UDF.
public String setPrevalue(String var1,Container container) {
StructureNode node = ((StructureNode) container.getParameter("STRUCTURE_NODE"));
node.setPreValue("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
return""; -
Insert Encoding tag into xml file. ?xml version="1.0"?
I am using oracle 10g.
I am using dbms_xmlgen.getxml function to generate xml data for oracle tables. I use utl_file to write data back into xml file.
Oracle is generating the file in the following manner...
<?xml version="1.0"?>
<ROWSET>
<ROW>
<RSLT_ID>1</RSLT_ID>
</ROW>
</ROWSET>
I want to change the following xml header to have encoding information in it as follows...
<?xml version="1.0" encoding = "AL32UTF8"?>
How do I achieve that?
Any suggestions?I want to change the following xml header to have encoding informationIn 10g I think you could use a xmlroot hack:
SQL> select xmlroot(xmlelement(e, dummy), version '1.0" encoding="AL32UTF8') xml from dual
XML
<?xml version="1.0" encoding="AL32UTF8"?>
<E>X</E>
1 row selected. -
Leading ? xml version="1.0"? tag when creating / invoking web services
Hello friends. I'm wondering if anyone has any insight as to why I cannot create
a fully formed XML document when developing a web service which includes the standard
<? xml version="1.0" ?> leading tag.
If I include the leading tag in my XML mapping for a jws method, I am unable to
compile the service into an ear, getting the following error: "An unexpected
exception occurred while attempting to process the classes and annotations for
this Web Service." If I do not include the leading tag, I can compile into an
EAR file and invoke the web service from a HTTP POST, but I cannot include the
leading <?xml...> tag in my request. Considering that I'll be asking other vendors
to submit to my web services and creation of xml documents using DOM or other
methods automatically generates the <?xml ...>, I'm hoping I'm not going to have
to tell them to parse out this piece of the files they want to send me. Can anyone
help?
Thanks so much!
CMCM,
I suppose you have set 'http-xml=true' for this to work. For http-xml
protocol, there is no way to specify the leading <?xml> tag, and hence
unfortunately the desired functionality cannot be achieved.
In case, this is very important for you, could you please log a support
case, and then we can file a bug and ask the Engineering to look into it.
Thanks,
Anurag
"Crackhead Millionaire" <[email protected]> wrote in message
news:[email protected]...
>
Hi Anurag -
Thanks for the response. My problem is that I would like to be able tosubmit
straight XML (i.e., not SOAP) to a webservice from an application outsideof Weblogic.
For example, the following code block fails on submission to BEA:
* Example Simple Integration.
import java.io.*;
import java.net.*;
public class testBEAPost {
* Null constructor.
public testBEAPost () {
super();
* This method handles creation of a PeopleSoft XML Envelope, wrapping of
* user input into the envelope, submission of the message to theintegration
broker
* and display of the response message to the screen.
* @created 3.12.2003
* @param argv java.lang.String[] Standard user entry input
public static void main(String[] argv) {
try{
URL url;
URLConnection urlConn;
DataOutputStream printout;
DataInputStream input;
// Create the internal XML document which will be to send to BEA.(hardcoded)
>
String internalXMLDoc = "<? xml version=\"1.0\"?><newlocationxmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><setid>WMS</setid><l
ocationid>1118UG0000</locationid><description>Electric
UndergroundLocation</description><exceptionemailaddress>[email protected]<
/exceptionemailaddress></newlocation>";
>
// Define the target URL.
url = newURL("http://167.75.117.20:7001/WebServices/PeopleSoftWebServices/NewLocation
Service.jws/createLocation");
>
// Open the Conection
urlConn = url.openConnection();
// Set necessary connection variables.
urlConn.setDoInput (true);
urlConn.setDoOutput (true);
urlConn.setUseCaches (false);
// Specify the content type.
urlConn.setRequestProperty("Content-Type", "text/xml");
// Send POST output.
printout = new DataOutputStream (urlConn.getOutputStream ());
printout.writeBytes (internalXMLDoc);
printout.flush ();
printout.close ();
// Get response data.
input = new DataInputStream (urlConn.getInputStream ());
String str;
while (null != ((str = input.readLine())))
System.out.println (str);
input.close ();
} catch (Exception e)
System.out.println(e);
If I run this program, I get a java.io.IOException with the serverreturning a
500 error code. However, if I strip out the leading <? xml version="1.0"?> tag
and submit to the web service, it works fine. My program set I createdthis example
for uses DOM to create the document, so I'm actually creating thedocument, getting
the String value of it, then parsing out the leading tag beforesubmission. My
problem is that soon I'll be dealing with third parties who may havetrouble generating
SOAP requests (don't ask), so I'd like to be able to tell them to generatesimple
XML documents to send to BEA if at all possible.
Can you assist? Thanks so much.
"Anurag Pareek" <[email protected]> wrote:
CM,
A SOAP message generated by a Workshop web service, when it acts as a
client
to another service, always contains the leading <?xml> tag. Here is a
sample
of a SOAP message generated by Workshop:
POST /TestImport/TestAny/TestAny.jws HTTP/1.0
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client
Protocol 1.0.3705.0; BEA WLW 7.0)
SOAPAction: "http://www.openuri.org/hello2"
Host: localhost
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: Keep-Alive
Content-Length: 398
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<hello2 xmlns="http://www.openuri.org/">
<o></o>
</hello2>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
It seems to me that what you are asking for is already there. Could you
please elaborate your issue further, probably with a sample of a XML
message
which you feel is not accepted by Workshop, but should be.
Thanks,
Anurag
"Crackhead Millionaire" <[email protected]> wrote in message
news:[email protected]...
Hello friends. I'm wondering if anyone has any insight as to why Icannot
create
a fully formed XML document when developing a web service which
includes
the standard
<? xml version="1.0" ?> leading tag.
If I include the leading tag in my XML mapping for a jws method, Iam
unable to
compile the service into an ear, getting the following error: "Anunexpected
exception occurred while attempting to process the classes and
annotations
for
this Web Service." If I do not include the leading tag, I can compileinto an
EAR file and invoke the web service from a HTTP POST, but I cannotinclude
the
leading <?xml...> tag in my request. Considering that I'll be askingother vendors
to submit to my web services and creation of xml documents using DOMor
other
methods automatically generates the <?xml ...>, I'm hoping I'm notgoing
to have
to tell them to parse out this piece of the files they want to sendme.
Can anyone
help?
Thanks so much!
CM -
Problem in inserting XML document
Give XML DTD :
<!ELEMENT a (b, c)>
<!ELEMENT b (#PCDATA)>
<!ELEMENT c (d, e)>
<!ELEMENT d (#PCDATA)>
<!ELEMENT e (#PCDATA)>
I made schema at Oracle8i as this:
create type c_t
as object (d varchar2(3),
e varchar2(3));
create table a (
b varchar2(3),
c c_t,
constraint b_pk primary key (b));
And the XML document to insert into DB is as this:
<?xml version="1.0"?>
<ROWSET>
<ROW>
<b>"100"</b>
<c><d>"aaa"</d><e>"abc"</e></c>
</ROW>
<ROW>
<b>"200"</b>
<c><d>"bbb"</d><e>"def"</e></c>
</ROW>
</ROWSET>
Using Oracle8i's XML-JAVA library interface,
I tried to insert the XML document into the DB table, but JAVA runtime exception occurred says "java.lang.NoSuchMethodError: oracle.jdbc.oci8.OCIDBAccess: method initObjectFields(Loracle/jdbc/dbaccess/DBColumn;[BI)V not found".
How can I solve this problem?
nulltry calling dbms_xmlgen.setrowsettag(qryctx,'siteMap') ;
before retrieving the result with DBMS_XMLGEN.getxmltype (qryctx); -
I am writing java through lotus notes. In it I go out and hit a web service and return the xml data. Once in the xml I use a transformer but I get the following error:
javax.xml.transform.TransformerException: stylesheet requires attribute: version
The code that I have does work when I use my xml as a file instead of in from the web service. I can not find anything that makes tis work. Before I had written this in lotusscript and used the ls2j connector and it worked fine (until the JVM would blow up) so we are dropping the connector and writing it all in java. Here is my code to work with the transformer....
import java.io.StringReader;
import java.io.StringWriter;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.apache.xalan.processor.*;
import javax.xml.parsers.*;
import javax.xml.transform.dom.*;
import org.w3c.dom.*;
* This class allows you to apply an XSL style sheet against an XML string from within the Lotus Notes environment, without having to place an XSL file on the file system or use a Java Agent.
* Xalan-Java 2.5.0 is required. It can be downloaded from http://xml.apache.org/xalan-j/ .
* The JavaUserClasses variable in the Lotus Notes notes.ini file must reflect the jar files from Xalan.
public class clsNotesXSLTNTS extends Object
private String strXml;
private String strXsl;
private String strXslUrl;
* Empty Constructor.
* @see java.lang.Object#Object()
public clsNotesXSLTNTS ()
super();
* This method will return the resultant transformation.
* A url is the default source for the xsl file which is set using setXslUrl(). If it is not found a String input is assumed which is set using setXsl().
* If a xsl url or a xsl String is not provided, null will be returned.
* @return String
public String process() {
try
StringReader srXSL;
StringReader srXML = new StringReader(strXml);
StringWriter sw = new StringWriter();
StreamSource ssXSL;
TransformerFactory factory = null;
Transformer transformer = null;
// determine the source xsl type
if (this.strXslUrl != null) {
ssXSL = new StreamSource(this.strXslUrl);
else if (this.strXsl != null) {
srXSL = new StringReader(strXsl);
ssXSL = new StreamSource(srXSL);
else {
return null;
// set the sax driver
// System.setProperty("org.xml.sax.driver", "org.apache.xerces.parsers.SAXParser");
try {
// create a new factory
transformer = factory.newTransformer(ssXSL);
catch(Exception e) {
System.out.println("Unable to create Transformer Factory: " + e.getMessage());
try {
// create a new transformer
transformer = factory.newTransformer(ssXSL);
catch(Exception e) {
System.out.println("Unable to create Transformer:" + e.getMessage());
// get the source xml
StreamSource xmlsource = new StreamSource(srXML);
// create a stream for the result of the transformation
StreamResult output = new StreamResult(sw);
// transform the input xml using the input xsl
transformer.transform(xmlsource, output);
// return the resultant transformation
return sw.toString();
// return strXml;
catch(Exception e)
e.printStackTrace();
// System.out.println(strXml);
return null;
* Gets the XML string that is to be transformed.
* @return String
public String getXml() {
return strXml;
* Sets the XML string that is to be transformed.
* @param pstrXml The XML string.
public void setXml(String pstrXml) {
this.strXml = pstrXml;
* Gets the XSL string that is used to transform the XML string.
* @return String
public String getXsl() {
return strXsl;
* Sets the XSL string that is used to transform the XML string.
* @param pstrXsl The XSL string.
public void setXsl(String pstrXsl) {
this.strXsl = pstrXsl;
* Gets the URL of the XSL file that is used to transform the XML string.
* @return String
public String getXslUrl() {
return strXslUrl;
* Sets the URL of hte XSL file that is used to transform the XML string.
* @param pstrXslUrl The URL of the XSL file.
public void setXslUrl(String strXslUrl) {
this.strXslUrl = strXslUrl;
}to set the XML I use the following code:
clsNotesXSLTNTS JXSLT;
JXSLT = new clsNotesXSLTNTS();
JXSLT.setXslUrl(strXSLPath);
JXSLT.setXml(XMLData);
XMLData = JXSLT.process();where the XMLData is returned from the web services, here is an example file that I printed out to the browser and saved. If I use this file it works, but if I do not put it out to the file system then it does not work.
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<getInfoByPartialNameSpmpy004Response xmlns="http://tempuri.org/"><getInfoByPartialNameSpmpy004Result>
<params xmlns="http://tempuri.org/"><baseTarget>MainFrame</baseTarget><onLoadFunction>PostLoad()</onLoadFunction><formName>InquirySelection</formName><filePath>C:/notes/data/aptestCOPY.nsf</filePath><isUser>1</isUser><isNewForm>0</isNewForm><searchVendors>1</searchVendors><vendorSearchString>SHER</vendorSearchString><printVendorSelection>1</printVendorSelection><tableBGColor>#FFFEAD</tableBGColor><THClass>normal</THClass><TDClass>normal</TDClass></params><anyType xsi:type="clsVendorInfo"><blnFound>true</blnFound><strNumber>4603232 </strNumber><strName>HOTEL Name </strName><strAddr1>18TH AT Smoothie ST </strAddr1><strAddr2> </strAddr2><strCity>Somewhere </strCity><strState>PA </strState></anyType></getInfoByPartialNameSpmpy004Result></getInfoByPartialNameSpmpy004Response></soap:Body></soap:Envelope>This file was generated by calling the web service with the program and then printing it out to the browser and cut and paste. Anyone with any thoughts ????
Thanks in advanceI left off the first part of my XSL...
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ap="http://tempuri.org/" version = "1.0">
<xsl:strip-space elements="*" />
<xsl:output method="html" encoding="utf-8"/> -
Hi,
I am using
1. dbms_xmlgen.newContext to get the information from table.
2. After that I am using dbms_lob.createtemporary
3. Then I am using dbms_xmlgen.getXml
4. Finally I am using dbms_xmlgen.closecontext
I am using the above four steps to repatedly taking records from different tables.
My requirement is : Each and every time I am getting the <?xml version = '1.0'?>.
How to suppress <?xml version = '1.0'?> ?
Regards
SriniHi,
Use DBMS_XMLGEN.getXMLType to retrieve the XML data into an XMLType variable.
Then, with getClobVal method, you can convert it to CLOB :
SQL> DECLARE
2 v_xml XMLType;
3 v_lob CLOB;
4 BEGIN
5 v_xml := dbms_xmlgen.getXMLType('select * from scott.emp where rownum = 1');
6 v_lob := v_xml.getClobVal();
7
8 dbms_output.put_line(v_lob);
9 END;
10 /
<ROWSET>
<ROW>
<EMPNO>7369</EMPNO>
<ENAME>SMITH</ENAME>
<JOB>CLERK</JOB>
<MGR>7902</MGR>
<HIREDATE>17/12/80</HIREDATE>
<SAL>800</SAL>
<DEPTNO>20</DEPTNO>
</ROW>
</ROWSET>
PL/SQL procedure successfully completed -
Insert XML data into oracle table
I want to insert xml data returned by the VB code into oracle table.
As a prequisite I have installed the XDK capabilities for Oracle by installing JServer & running
SQL scripts catxsu.sql,xmlparserv2.jar,load.sql to load the XMLSQL Utility (DBMS_XMLQuery) into the database.
I have also granted following privileges to the user.
Grant users access to XMLParser and XMLDom packages:
grant execute on xmldom to public;
grant execute on xmlparser to public;
create public synonym xmldom for sys.xmldom;
create public synonym xmlparser for sys.xmlparser;
But still i am not able to create procedure which will accept input parameter as an XML document coming from front end which in turn will insert that record into simple oracle table . I am using Oracle 8.1.7
Thanks in advanceWould you specify the database version?
Since DBMS_XMLSave requires DOM, you normally need to divide the huge XML before insertion. -
Dbms_xmlquery.getxml problem
SQL> select * from emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM --------- ---------- --------- ---------- --------- ---------- ---------- ---------- --------- ------------
7369 SMITH CLERK 7902 17-DEC-80 800 20
14 rows selected.
SQL> select dbms_xmlquery.getxml('select * from emp where rownum<2') from dual;
DBMS_XMLQUERY.GETXML('SELECT*FROMEMPWHEREROWNUM<2')
<?xml version = '1.0'?>
<ROWSET>
<ROW num="1">
<EMPNO>7369</EMPNO>
I'm just wondering why the query output XML has EMPNO alone, and not the other column data.Please help.
Thanks,
BhagatIt's because of the parameter settings in SQL*Plus. It's just not showing the whole output for you...
SQL> select dbms_xmlquery.getxml('select * from emp where rownum<2') from dual;
DBMS_XMLQUERY.GETXML('SELECT*FROMEMPWHEREROWNUM<2')
<?xml version = '1.0'?>
<ROWSET>
<ROW num="1">
<EMPNO>7369</EMPNO>
SQL> set long 2000
SQL> select dbms_xmlquery.getxml('select * from emp where rownum<2') from dual;
DBMS_XMLQUERY.GETXML('SELECT*FROMEMPWHEREROWNUM<2')
<?xml version = '1.0'?>
<ROWSET>
<ROW num="1">
<EMPNO>7369</EMPNO>
<ENAME>SMITH</ENAME>
<JOB>CLERK</JOB>
<MGR>7902</MGR>
<HIREDATE>12/17/1980 0:0:0</HIREDATE>
<SAL>800</SAL>
<DEPTNO>20</DEPTNO>
</ROW>
</ROWSET>
SQL> -
Removing ?xml version="1.0"? from the result
Hi Friends
How do we remove <?xml version="1.0"?> from the result if we have ran two query in one resultset
e.g
qryCtx := DBMS_XMLGEN.newContext('select ename, job from emp where empno > 7900');
DBMS_XMLGEN.setRowSetTag(qryCtx,'employeedata');
DBMS_XMLGEN.setRowTag(qryCtx,'emp');
result := DBMS_XMLGEN.getXML(qryCtx);
insert into temp_clob_tab values(result);
DBMS_XMLGEN.closeContext(qryCtx);
qryCtx := DBMS_XMLGEN.newContext('select * from dept');
DBMS_XMLGEN.setRowSetTag(qryCtx,'departments');
DBMS_XMLGEN.setRowTag(qryCtx,'dept');
result := DBMS_XMLGEN.getXML(qryCtx);
insert into temp_clob_tab values(result);
DBMS_XMLGEN.closeContext(qryCtx);
RESULT
<?xml version="1.0"?>
<employeedata>
<emp>
<ENAME>FORD</ENAME>
<JOB>ANALYST</JOB>
</emp>
<emp>
<ENAME>MILLER</ENAME>
<JOB>CLERK</JOB>
</emp>
</employeedata>
<?xml version="1.0"?>
<departments>
<dept>
<DEPTNO>10</DEPTNO>
<DNAME>ACCOUNTING</DNAME>
<LOC>NEW YORK</LOC>
</dept>
<dept>
<DEPTNO>20</DEPTNO>
<DNAME>RESEARCH</DNAME>
<LOC>DALLAS</L[i]Long postings are being truncated to ~1 kB at this time.Why do you want to get rid of the XML header ? If you want to concatenate the two values to produce a single XML document, I would recommend using XMLConcat or XMLAgg SQL functions.
- Ravi -
Error in inserting XML document
I'm trying to insert into a table from an HTML form.
Here's the table I'm trying to insert into
TABLE employee
name VARCHAR2(40),
ssnum NUMBER NOT NULL
Note: even though SSNUM is number I take it as a string and I
have a before insert trigger that converts it to number. Works
from SQL plus if entry is number.
Here's the testxsql.html
<html>
<body>
Input your name and ssnumber ..
<form action="testxsql.xsql" method="post">
Name<input type="text" name="name_field" size="30">
SSNUM<input type = "text" name="ssnum_field" size="10">
<input type="submit">
</form>
</body>
</html>
it calls testxsql.xsql which is
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="employee.xsl"?>
<page connection="demo">
<insert table="employee" transform="testxsql.xsl"/>
<content>
<query tag-case="lower" max-rows="5" rowset-element=""
row-element="emp" >
select *
from employee
order by ssnum desc
</query>
</content>
</page>
and testxsql.xsl is
<?xml version = '1.0'?>
<ROWSET xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:for-each select="request">
<ROW>
<NAME><xsl:value-of select="name_field"/></NAME>
<SSNUM><xsl:value-of select="ssnum_field"/></SSNUM>
<SOURCE>User-Submitted</SOURCE>
</ROW>
</xsl:for-each>
</ROWSET>
I get the following error while trying to insert
XSQL-015: Error inserting XML Document
invalid LABEL name in XML doc-
If I remove the insert tag, the query portion works fine.
I'm new to XML so I've already pulled all the hair that I can
muster. Thanks
nullKumar Pandey (guest) wrote:
: I'm trying to insert into a table from an HTML form.
: Here's the table I'm trying to insert into
: TABLE employee
: name VARCHAR2(40),
: ssnum NUMBER NOT NULL
: Note: even though SSNUM is number I take it as a string and I
: have a before insert trigger that converts it to number. Works
: from SQL plus if entry is number.
: Here's the testxsql.html
: <html>
: <body>
: Input your name and ssnumber ..
: <form action="testxsql.xsql" method="post">
: Name<input type="text" name="name_field"
size="30">
: SSNUM<input type = "text" name="ssnum_field"
size="10">
I'm using apache web and JServ and 8i as db
: <input type="submit">
: </form>
: </body>
: </html>
: it calls testxsql.xsql which is
: <?xml version="1.0"?>
: <?xml-stylesheet type="text/xsl" href="employee.xsl"?>
: <page connection="demo">
: <insert table="employee" transform="testxsql.xsl"/>
: <content>
: <query tag-case="lower" max-rows="5" rowset-element=""
: row-element="emp" >
: select *
: from employee
: order by ssnum desc
: </query>
: </content>
: </page>
: and testxsql.xsl is
: <?xml version = '1.0'?>
: <ROWSET xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
: <xsl:for-each select="request">
: <ROW>
: <NAME><xsl:value-of select="name_field"/></NAME>
: <SSNUM><xsl:value-of select="ssnum_field"/></SSNUM>
: <SOURCE>User-Submitted</SOURCE>
: </ROW>
: </xsl:for-each>
: </ROWSET>
: I get the following error while trying to insert
: XSQL-015: Error inserting XML Document
: invalid LABEL name in XML doc-
: If I remove the insert tag, the query portion works fine.
: I'm new to XML so I've already pulled all the hair that I can
: muster. Thanks
null -
Problem in use xmlgen.insertXML to insert XML file to Object Viewse
I am trying to update XML file to Object View but it failed. Refer to the steps that I was doing.
1) Use utl_file.get_line to read XML file which I generated (It is no problem)
2)The xml data is
<?xml version="1.0" ?>
- <ROWSET>
- <ROW num="1">
<PK_NO>305</PK_NO>
<ACC_NAME>PAPERS AND CLIPS</ACC_NAME>
<FROM_NAME>MB METAL PTE LTD</FROM_NAME>
<MAS_NO>990015</MAS_NO>
<MAS_DATE>2000-04-07 15:47:52.0</MAS_DATE>
<CURR_CODE>SGD</CURR_CODE>
<MAS_CODE>WRFQ</MAS_CODE>
<REMARK>SADKJAS</REMARK>
- <LINEITEMLIST_NTAB>
- <LINEITEMLIST_NTAB_ITEM>
<ITEM_NO>1</ITEM_NO>
<STK_C>2506401</STK_C>
<SP_STK_C>H282828</SP_STK_C>
<STK_NAME>STICK-ON-NOTES - 11110 1.5, 12 100 SHEET PADS</STK_NAME>
<UOM>SET</UOM>
<QTY>10</QTY>
<SALES_PRICE>95.50</SALES_PRICE>
<REMARK>SADKJAS</REMARK>
</LINEITEMLIST_NTAB_ITEM>
- <LINEITEMLIST_NTAB_ITEM>
<ITEM_NO>2</ITEM_NO>
<STK_C>7706001</STK_C>
<SP_STK_C>H282828</SP_STK_C>
<STK_NAME>FACESHIELD/EYE PROT CLEAR GLASS WTR PLATE, STANDARD DREW</STK_NAME>
<UOM>PCS</UOM>
<QTY>1</QTY>
<SALES_PRICE>100</SALES_PRICE>
<REMARK>SADKJAS</REMARK>
</LINEITEMLIST_NTAB_ITEM>
</LINEITEMLIST_NTAB>
</ROW>
</ROWSET>
3) From Object View, I generated xml file is
- <ROWSET>
- <ROW num="1">
<PK_NO>2</PK_NO>
<ACC_NAME>PAPERS AND CLIPS</ACC_NAME>
<FROM_NAME>MB METAL PTE LTD</FROM_NAME>
<MAS_NO>990015</MAS_NO>
<MAS_DATE>2000-06-07 00:00:00.0</MAS_DATE>
<CURR_CODE>SGD</CURR_CODE>
<MAS_CODE>WRFQ</MAS_CODE>
- <LINEITEMLIST_NTAB>
- <LINEITEMLIST_NTAB_ITEM>
<ITEM_NO>1</ITEM_NO>
<STK_C>2506401</STK_C>
<STK_NAME>STICK-ON-NOTES - 11110 1.5,X2 12 100 SHEET PADS</STK_NAME>
<UOM>SET</UOM>
<QTY>1</QTY>
<SALES_PRICE>10</SALES_PRICE>
</LINEITEMLIST_NTAB_ITEM>
</LINEITEMLIST_NTAB>
</ROW>
- <ROW num="2">
<PK_NO>4</PK_NO>
<ACC_NAME>ABC</ACC_NAME>
<FROM_NAME>VBF</FROM_NAME>
<MAS_NO>99200</MAS_NO>
<MAS_DATE>2000-01-04 00:00:00.0</MAS_DATE>
<CURR_CODE>SGD</CURR_CODE>
<MAS_CODE>DSDS</MAS_CODE>
<REMARK>WRFQ</REMARK>
<LINEITEMLIST_NTAB />
</ROW>
</ROWSET>
3) I use INSTEAD OF trigger for Object View to insert the data to database.
I got the message is:
ORA-29532: Java call terminated by uncaught Java exception: oracle.xml.sql.OracleXMLSQLException:5.
Anybody can give me the advise for that.
nullIf you have the ftp server at 8080 running (9iR2 only) the simples way is to upload it to the database through that server. You can then do whatever you want using the xdburitype() procedure.
Below is an excerpt of a script I use to register XML schema's (I've got some very long ones, about 150K). It should work with "any" file..
begin
dbms_xmlschema.registerSchema (
schemaURL => 'http://www.agralin.nl/WebQuery/ns/&1',
schemaDoc => xdburitype('/age/&1..xsd'),
local => TRUE,
genTables => FALSE,
genbean => FALSE,
genTypes => TRUE,
force => FALSE,
owner => 'AGE'
end; -
Error inserting XML records 4000 bytes through Pro*C
Hi,
I am seeing the following error while trying to insert XML records > 4000 bytes (Records < 4000 bytes get inserted without any issues). Any help in resolving the issue would be highly appreciated.
ORA return text: ORA-01461: can bind a LONG value only for insert into a LONG column.
I am also able to insert records > 4000 bytes using the following query, But, I want to insert the records through a C application (using Pro*C) that is not running on the database server.
INSERT INTO MY_XML_TABLE
VALUES (XMLType(bfilename('XML_DIR', 'MY_FILE.XML'),
nls_charset_id('AL32UTF8')));
Oracle Version
===============
SQL> select * from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production
TNS for Solaris: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
Pro*C/C++ version:
====================
Pro*C/C++ RELEASE 11.2.0.0.0 - PRODUCTION
Schema registration:
====================
begin
DBMS_XMLSCHEMA.registerSchema (
SCHEMAURL => 'MY_XML_SCHEMA.xsd',
SCHEMADOC => bfilename ('ENG_REPORTS', 'MY_XML_SCHEMA.xsd'),
GENTYPES => FALSE,
OPTIONS => DBMS_XMLSCHEMA.REGISTER_BINARYXML,
CSID =>nls_charset_id ('AL32UTF8'));
end;
Table creation
===============
CREATE TABLE MY_XML_TABLE (
MY_XML_RECORD XmlType )
XMLTYPE MY_XML_RECORD STORE AS BINARY XML
XMLSCHEMA "MY_XML_SCHEMA.xsd" ELEMENT "MYXMLTAG" ;
Record Insertion (Pro*C generated code):
=========================================
/* EXEC SQL FOR :l_sizeof_array_togo
insert INTO MY_XML_TABLE
(MY_XML_RECORD )
VALUES( XMLTYPE(:l_XML_ptr INDICATOR :l_XML_indicators )); */
struct sqlexd sqlstm;
sqlstm.sqlvsn = 12;
sqlstm.arrsiz = 1;
sqlstm.sqladtp = &sqladt;
sqlstm.sqltdsp = &sqltds;
sqlstm.stmt = "insert into MY_XML_TABLE (MY_XML_RECORD) values (XMLTYPE(:s1\
:s2 ))";
sqlstm.iters = (unsigned int )l_sizeof_array_togo;
sqlstm.offset = (unsigned int )20;
sqlstm.cud = sqlcud0;
sqlstm.sqlest = (unsigned char *)&sqlca;
sqlstm.sqlety = (unsigned short)4352;
sqlstm.occurs = (unsigned int )0;
sqlstm.sqhstv[0] = (unsigned char *)&l_XML_ptr->xml_record;
sqlstm.sqhstl[0] = (unsigned long )8002;
sqlstm.sqhsts[0] = ( int )sizeof(struct xml_rec_definition);
sqlstm.sqindv[0] = ( short *)&l_XML_indicators->XML_record_ind;
sqlstm.sqinds[0] = ( int )sizeof(struct XML_indicator);
sqlstm.sqharm[0] = (unsigned long )0;
sqlstm.sqadto[0] = (unsigned short )0;
sqlstm.sqtdso[0] = (unsigned short )0;
sqlstm.sqphsv = sqlstm.sqhstv;
sqlstm.sqphsl = sqlstm.sqhstl;
sqlstm.sqphss = sqlstm.sqhsts;
sqlstm.sqpind = sqlstm.sqindv;
sqlstm.sqpins = sqlstm.sqinds;
sqlstm.sqparm = sqlstm.sqharm;
sqlstm.sqparc = sqlstm.sqharc;
sqlstm.sqpadto = sqlstm.sqadto;
sqlstm.sqptdso = sqlstm.sqtdso;
sqlcxt((void **)0, &sqlctx, &sqlstm, &sqlfpn);
}After selecting data from xmltab table I just received first line of xmldata file. i.e
<?xml version="1.0" encoding="WINDOWS-12 52"?> <BAROutboundXM L xmlns="http://BARO
That must be a display issue.
What client tool are you using, and what version?
If SQL*Plus, you won't see the whole content unless you set some options :
{code}
SET LONG <value>
SET LONGCHUNKSIZE <value>
{code}
Could you try the following?
{code}
SET LONG 10000
SELECT t.object_value.getclobval() FROM xmltab t;
-- to force pretty-printing :
SELECT extract(t.object_value, '/*').getclobval() FROM xmltab t;
{code}
Edited by: odie_63 on 16 févr. 2011 08:58 -
Error while registering xsd and inserting xml
1) while inserting it is mentioning , no schema definition available for citeinfo
2) while registering it is mentioning, with changes that i have made that it is not valid xdb schema
how to register the xsd schema correctly.?
SQL> desc register2;
Name Null? Type
TABLE of SYS.XMLTYPE(XMLSchema "fgdc-std-001-19981.xsd" Element "metadata") STORAGE Object-relationa
SQL> alter session set events ='31156 trace name context forever, level 2'
2 /
Session altered.
SQL> INSERT INTO register2
2 VALUES (XMLType(bfilename('XMLDIR','metadata.xml'),
3 nls_charset_id('AL32UTF8')));
INSERT INTO register2
ERROR at line 1:
ORA-30937: No schema definition for 'citeinfo' (namespace '##local') in parent
'/metadata/idinfo'
SQL> BEGIN
2 DBMS_XMLSCHEMA.registerSchema(
3 SCHEMAURL => 'fgdc-std-001-199812.xsd',
4 SCHEMADOC => bfilename('XMLDIR','fgdc-std-001-199812.xsd'),
5 CSID => nls_charset_id('AL32UTF8'));
6 END;
7 /
BEGIN
ERROR at line 1:
ORA-31000: Resource 'fgdc-std-001-1998-sect012.xsd' is not an XDB schema
document
ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 37
ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 61
ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 126
ORA-06512: at line 2
this is the xsd document
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" blockDefault="#all">
<xsd:element name="idinfo" type="idinfoType"/>
<xsd:complexType name="idinfoType">
<xsd:sequence>
<xsd:element ref="citeinfo"/>
<xsd:element ref="descript"/>
<xsd:element ref="timeperd"/>
<xsd:element ref="status"/>
<xsd:element ref="spdom"/>
<xsd:element ref="keywords"/>
<xsd:element ref="accconst"/>
<xsd:element ref="useconst"/>
<xsd:element ref="ptcontac" minOccurs="0"/>
<xsd:element ref="browse" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element ref="datacred" minOccurs="0"/>
<xsd:element ref="secinfo" minOccurs="0"/>
<xsd:element ref="native" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="citeinfo" type="citeinfoType">
<xsd:complexType name="citeinfoType">
<xsd:sequence>
<xsd:element ref="origin">
<xsd:element ref="pubdate">
<xsd:element ref="pubtime">
<xsd:element ref="title">
<xsd:element ref="edition">
<xsd:element ref="geoform">
</xsd:sequence>
</xsd:complexType>
<xsd:element name="origin" type="originType"/>
<xsd:simpleType name="originType">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
<xsd:element name="pubdate" type="pubdateType"/>
<xsd:simpleType name="pubdateType">
<xsd:restriction base="xsd:date"/>
</xsd:simpleType>
<xsd:element name="pubtime" type="pubtimeType"/>
<xsd:simpleType name="pubtimeType">
<xsd:restriction base="xsd:time"/>
</xsd:simpleType>
<xsd:element name="title" type="titleType"/>
<xsd:simpleType name="titleType">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
<xsd:element name="edition" type="editionType"/>
<xsd:simpleType name="editionType">
<xsd:restriction base="xsd:double"/>
</xsd:simpleType>
<xsd:element name="geoform" type="geoformType"/>
<xsd:simpleType name="geoformType">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
<xsd:element name="descript" type="descriptType"/>
<xsd:complexType name="descriptType">
<xsd:sequence>
<xsd:element ref="abstract"/>
<xsd:element ref="purpose"/>
<xsd:element ref="supplinf" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="abstract" type="abstractType"/>
<xsd:simpleType name="abstractType">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
this is the xml document
<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE metadata SYSTEM "http://www.fgdc.gov/metadata/fgdc-std-001-1998.dtd"><metadata>
<idinfo>
<citation>
<citeinfo>
<origin>Jiohn</origin>
<pubdate>Unknown</pubdate>
<pubtime>Unknown</pubtime>
<title>isolation_valve</title>
<edition>we</edition>
<geoform>vector digital data</geoform>
<serinfo>
<sername>trial</sername>
<issue>akls</issue>
</serinfo>
<pubinfo>
<pubplace>india</pubplace>
<publish>rolta</publish>
</pubinfo>
<othercit>afdf</othercit>
<onlink>\\gedora09\prfd\3.Input\O&M\15Feb10\Rolta O&M Data\103 shape files updated on 12.01.2009\Points\isolation_valve.shp</onlink>
<lworkcit>
<citeinfo>
<origin>aedf</origin>
<pubdate>20041203</pubdate>
<pubtime>00290055</pubtime>
<title>test xml</title>
<edition>ert</edition>
<geoform>audio</geoform>
<onlink>ad</onlink>
</citeinfo>
</lworkcit>
</citeinfo>
</citation>
<descript>
<abstract>asdf</abstract>
<purpose>asdf</purpose>
<supplinf>werty</supplinf>
</descript>
<timeperd>
<timeinfo>"Events" are not there just for fun - they have a purpose. Most of the time they should only be used when asked by Oracle support or when you know what you are doing...
I assume you aren't using 11gR2 as suggested by Mark in an earlier thread...? -
DB XML version 2.5.13, php 5.2.10
Not sure what the problem is, but I'm not getting the XML content with this piece of code:
function getXmlDocumentByNameAsStringV1($documentName, $containerName){
$container = $this->mgr->openContainer($containerName);
$xmlDocument = $container->getDocument($documentName);
$xmlDocument->fetchAllData();
$content = $xmlDocument->getContent();
$documentName = $xmlDocument->getName();
echo "doc name= [$documentName]";
print $xmlDocument->getContent();
unset ($container);
return $content;
I basically created a wrapper class around the DB XML api.
I was trying to get the full XML content as a string with this function, but all I seem to get is just a reference.
I ended up doing a query on it instead to get me the getContent() call to get what I needed (which was full XML document with the document version and DOCTYPE refernces), but was wondering what I was doing wrong with this approach.
Also when I was inserting XML documents into the Oracle Berkely DB XML database that referenced a DTD the database seemed
to switch to a validate mode even though I did not turn on validation when either creating the container or opening the container.
Is there a way to overide what appears to be a valdiation mode when the document refernces a DTD?
I am running PHP 5.2.10 under Apache 2.2.14 with the binary release of DB XML version 2.5.13
I figured out that I had to put my DTD in the [Apache Root] directory for it to validate properly. Stuff I read
through the forums suggested that I needed to put the DTD at the root of where the databases are when
referencing a DTD with just a file name without any reference to file:/// etc.. or http://
I changed my home directory to a certain location:when I instantiated the
$env = new Db4Env();
$env->open($this->homeDirectory, $this->flagsDbEnvOpen)
In any case the work around for now is to just put the DTD in the location that it expects which is the Apache Root install directory.
It is a minor inconvenience, but thought I would mention it for others that may have run into this problem.
(I used the Process Monitor searching on my DTD name to discover the solution to where Oracle DB XML or rather Apache Web server, I suppose through the dlls
was expecting to find it)
Also it appears that the binary versino works with PHP 5.2.10 of apache. I did not need to recompile the code with the new apache version.
Is there any thing I should be worried about?
Also I was getting the following error:
// the code commented out below was an attempt to try and do a sub query from a valid XmlValue object.
// was unsuccesful. starting receiving errors such as
////[25-Nov-2009 15:24:26] PHP Fatal error: Uncaught exception 'xmlexception' with message 'Error: Sequence does not match type document-node() - found item of type element(APP_Test_Script, {http://www.w3.org/2001/XMLSchema}untyped) [err:XPTY0004], <query>:1:12' in C:\htdocs\app1\BackEnd.php:82
// Will attempt to reprocess xml into a php DOm node and extract out value that way, just to get something working.
// $subQuery = "//*";
// $categoryQContext = $this->mgr->createQueryContext();
// $categoryQuery = $this->mgr->prepare($subQuery, $categoryQContext);
// $testScriptValue = $AppScriptAsXmlValue->asString();
// echo $testScriptValue;
// echo "hello world";
// $categoryResults = $categoryQuery->execute($testScriptAsXmlValue, $categoryQContext);
// $categoryValue = null;
// while($categoryResults->hasNext()){
// $node = $categoryResults->next();
// $categoryValue = $node->asString();
Basically, I was trying to do a sub xquery from an initial xquery that returned a sequence of XML documents. According to the example in book The Definiitive Guide to Bekrely DB XML
it should have worked, but wasn't.
I also ran into an issue where I seemed to have locked up a container when I was editing an XML document in Oxygen and saving it back to the DB XML container from within Oxygen.
after that action it wouldn't return from the save function and I coudln't ever load up that container. Even trying to access the contain from the command line dbxml it wasn't able to access
that container again. I ended up having to blow it away from lack of knowledge on how to recover from that. If anyone has run into this and/or has some suggestions on this it would be nice.
I'm guessing could it be because I had some meta data values defined in some of these documents that I was updating. From Oxygen, can you create metadata? I dont think you can, at least it wasn't obvious to me except perhaps fro the name of the document (which is implicitly a meta data tag).Hi,
You'll have to compile yourself for different PHP API versions.
Regards,
George
Maybe you are looking for
-
Extracting an asset that has a portion off canvas
I want to point out something that has happened to me just a few times, and I'm sure some people will have this issue and some won't since it's totally based on how one designed their psd's. When extracting something like this header here... I get th
-
Zen mx 16gb player not recognising id3 tags.
,zen mx 6gb player not recognising id3 tags.I recently bought a zen mx and so far can not get it to recognise over half of my mp3's id3 tags. All of the files are drm free. All of the unrecognised files will play but get stuck in the unknown artist u
-
Banner image disappears when I move css to external style sheet
If I have the following code in the head of the document, the banner image is displayed: <link href="css/styles.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="javascript/copyNote.js"></script> <style type="text/css"> <!-
-
"Wirless Client List" button on WRT160NV3
Has anyone had any joy getting the Wireless -> Wireless Mac Filter -> Wireless Client List button to work? I've tried several browsers, and several versions of the firmware (v3.0.02 and v3.0.03) but no joy. In each case my browser pops open a new em
-
Getting waved-horizontal lines in my imagery just after working in photoshop...sending to files as with after completing some applications, such as printing. Nothing is wrong with my Mac...Issue does not occur every time I go into using Photoshop?