XDK 10.1.0.2.0 NT XMLType and org.w3c.dom.Document problem/bug?

Hi Chaps,
I have Oracle 11g1 server side and am using the Oracle XDK 10.1.0.2.0 for Windows client side with Sun Java JDK 6 (1.6.0_06-b02).
(I couldnt find an XDK for 11g1???)
I have a table in my database that has an XMLType, its a very simple table -
CREATE TABLE hcr_xml_test
RRN VARCHAR(24) PRIMARY KEY,
ClipID VARCHAR2(27),
Lodgement XMLType
XMLTYPE COLUMN Lodgement
STORE AS OBJECT RELATIONAL
ELEMENT "/www.hcrregister.com/RequestServices/Messages/ConditionReportCreateRequest_1.xsd#ConditionReportCreateRequest_1"
Thats all fine, however with the XDK I am trying to construct an XMLType for use with JDBC from a valid org.w3c.dom.Document so that I can insert a row into my table. My code looks like this -
XMLType xml = new XMLType(realCon, doc);
stmt = (OraclePreparedStatement) realCon.prepareStatement(sql);
stmt.setString(1, id.getRRN());
stmt.setString(2, id.getCenteraClipID());
stmt.setObject(3, xml);
stmt.execute();
doc is a org.w3c.dom.Document
realCon is a java.sql.Connection
That code throws a SQLException at the line "stmt.setObject(3, xml);" -
java.sql.SQLException: Fail to convert to internal representation
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:173)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:229)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:403)
at oracle.sql.OPAQUE.<init>(OPAQUE.java:85)
at oracle.xdb.XMLType.toDatum(XMLType.java:480)
at oracle.jdbc.driver.OraclePreparedStatement.setORADataInternal(OraclePreparedStatement.java:7437)
at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:8158)
at oracle.jdbc.driver.OraclePreparedStatement.setObject(OraclePreparedStatement.java:8149)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.setObject(OraclePreparedStatementWrapper.java:229)
at uk.co.landmarkinfo.registers.datawarehouse.tools.oracle.lodgementloader.DocumentProcessor.run(DocumentProcessor.java:232)
Inspecting the exception I can see that the vendorCode is 17059.
If I use "XMLType xml = XMLType.createXML(realCon, doc);" then xml is null instead of throwing a SQLException, so something isnt working here...
However, if I serialize my Document to a String first and give that String to either the XMLType Constructor or XMLType.createXML() then it all works fine -
/////TEMP
Transformer transformer = saxTransformerFactory.newTransformer();
transformer.setOutputProperty("omit-xml-declaration", "no");
transformer.setOutputProperty("indent", "yes");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
transformer.transform(new DOMSource(doc), new StreamResult(baos));
XMLType stringXML = new XMLType(realCon, new String(baos.toByteArray()));
////END TEMP
stmt = (OraclePreparedStatement) realCon.prepareStatement(sql);
stmt.setString(1, id.getRRN());
stmt.setString(2, id.getCenteraClipID());
stmt.setObject(3, stringXML);
stmt.execute();
But why do I need to serialize to a String first??? Looking at the javadoc I dont think I should have to do this. So is there a problem in Oracles XDB handling of Document or have I missed something?

Anyone has any idea? Please help!!!
xu

Similar Messages

  • XMLType.getDOM().createDocumentFragment() NOT org.w3c.dom.DocumentFragment ?

    Hi,
    i have an XMLType variable xml ( (XMLType) ResultSet.getObject() ) and i want to create an org.w3c.DocumentFragment by : xml.createDocumentFragment(). But i get a ClassCastException.
    oracle.xdb.dom.XDBDocumentFragment does not implement org.w3c.dom.DocumentFragment ?
    Thanks
    Alessandro Scotti

    I think that oracle.xdb.dom.XDBDocumentFragment is "internal" oracle view of org.w3c.dom.DocumentFragment
    because xmltype!= DOM Document.One question:
    how I can implement org.w3c.dom.DocumentFragment.getOwnerDocument() method?
    Regards.

  • Slow to convert Oracle 11g XMLType into Java String or Document

    After retrieving a result set from an Oracle 11g database, it takes roughly 75 seconds to convert the XMLType (this is a structured XML Storage, registered with an xsd) into either a java String or Document. I'm using Java 1.6, have the xdb.jar and xmlparserv2.jar
    This xsd is <100 lines and the xml document is also <100 lines.
    Sample code:
    oracle.xdb.XMLType xml = oracle.xdb.XMLType.createXML((oracle.sql.OPAQUE)rset.getObject("XMLDATA"));
    the other way, but still took just as long:
    XMLType xml = (XMLType)rset.getObject("XMLDATA");
    xml.getStringVal();
    or
    org.w3c.dom.Document doc = xml.getDocument();
    either way of the above ways takes just as long.

    If I put this value into the database table, I can
    see only the date. Time part is missing. Is this the
    problem with java.sql.Date or Oracle datatype Date?This is not a problem, this is the defined behaviour of the Date type. RTFAPI and have a look at Timestamp, while you're at it.

  • Xmltype and payload_factory

    Hello,
    I hope someone can help. Thanks
    I am trying to dequeue a XMLType msg.
    I am not having any luck, not much support that i could find on the web.
    I get the following error
    oracle.jms.AQjmsException: JMS-137: Payload factory must be specified for destinations with ADT payloads
    the erros accurs at the following line
    this.receiver = ((AQjmsSession)this.session).createReceiver(que[b]ue);
    So my question what kind of payload facotry do I specify, and how do I define it??
    For a custom sqldata type I do the following:
    I have a class that implemtns couple interface
    CBMessageDat implements CustomDatum, CustomDatumFactory
    then i do the following:
    this.receiver = ((AQjmsSession)this.session).createReceiver(queue, CBMessageDat.getFactory());
    This works fine
    Any help, code on how to dequeeu a xmltype would be great, thanks in advance.

    To answer my question for xmltype and payload_factory when using JMS
    This is what I needed to do
    ORADataFactory orad = XMLType.getORADataFactory();
    this.receiver = ((AQjmsSession)this.session).createReceiver(queue, orad);
    XMLType implements ORADataFactory interface, and has a static get for that member.

  • XMLType and Curled Double Quotes (8220, 8221)

    The following select fails with an XML parser error:
    select xmltype('<tag>&#8220;A&#8221;</tag>') from dual
    I'm trying to definitively determine why...
    We have XML that goes into a CLOB column in our 9.2 database, then is put into an XMLTYPE variable (in PL/SQL) and manipulated as XML. (The above select statement is just a highly-simplified test case, but we do use XMLTYPE in this manner in our select to convert the CLOB to an XMLTYPE instance.) The data has occasional instances of curled double quotes, represented as &#8220; and &#8221; and when these exist, the XML parse error occurs.
    My impression is that these Unicode representations of the curled double quote characters are acceptable in XML. They parse and validate fine in XMLSpy for whatever that's worth. Also, I can construct a DOM document in Java, using Oracle's XMLParser V2, that contains these Unicode representations.
    Why can't I do this using XMLTYPE in PL/SQL?
    Thanks for any assistance!
    Jim

    In the prior message, the sentence that reads:
    ...represented as “ and ” and when these exist...
    the pair of double quotes should read, respectively, &# followed by 8220; and &# followed by 8221; - the forum renderer actually rendered those as the curled double quotes...

  • XMLType and Oracle JMS compatibility

    We need to receive messages from a Oracle-AQ queue with paylod_type XMLType,
    and we would like manage this with JMS and MDB using OC4J 10.1.3.
    Somebody know if is it possible to map such a queue as a JMS source or are there
    limitations to the specific SYS.AQ$_JMS_MESSAGE paylod_type?
    In the second case, what kind of workaround can we put in place? The XMLType is
    a must in our environment, so we have to manage it in some way...
    Thanks,
    Giorgio.

    We need to receive messages from a Oracle-AQ queue with paylod_type XMLType,
    and we would like manage this with JMS and MDB using OC4J 10.1.3.
    Somebody know if is it possible to map such a queue as a JMS source or are there
    limitations to the specific SYS.AQ$_JMS_MESSAGE paylod_type?
    In the second case, what kind of workaround can we put in place? The XMLType is
    a must in our environment, so we have to manage it in some way...
    Thanks,
    Giorgio.

  • Xmltype and validarion with xsd.

    Hi,
    How can I create a relation between a column (xmltype) and a xml schema (file.xsd) ?
    Thanks.

    You should create a schema based XMLType object using createSchemaBasedXML(), then validate it with schemaValidate()
    http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96616/arxml24.htm#1014214
    http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96616/arxml24.htm#1014272
    Also you may use XMLType's constructor to define a XSD, whether it must be validated and must be well formed.
    There lots of ways for storing, managing and developing with XML in oracle. java, c, pl/sql or xml/sql.
    Best Regards
    Erturk

  • Problems with XMLType and namespace

    Dear subscribers:
    I have been using XMLType successfully with simple XMLs - without namespaces. Now I must handle messages with "xmlns" and it seems XMLType is failing.
    I tested the following XML, extracted from w3c.org examples:
    <?xml version="1.0"?>
    <bk:book xmlns:bk=''urn:loc.gov:books''
    xmlns:isbn=''urn:ISBN:0-395-36341-6''>
    <bk:title>Cheaper by the Dozen</bk:title>
    <isbn:number>1568491379</isbn:number>
    </bk:book>
    The result of “xmlt.getRootElement()” is “book”.
    However, the use of “xmlt.extract( 'book' )” returns an empty object:
    xmlt1 := xmlt.extract( 'book' );
    dbms_output.put_line( 'StringVal: ' || xmlt1.getStringVal() );
    ORA-30625: method dispatch on NULL SELF argument is disallowed
    The following usages also raise errors:
    xmlt1 := xmlt.extract( 'bk:book' );
    ORA-31011: XML parsing failed ORA-19202: Error occurred in XML processing LPX-00601: Invalid token in: 'bk:book' ORA-06512: at "SYS.XMLTYPE", line 111
    xmlt1 := xmlt.extract( 'bk::book' );
    ORA-31011: XML parsing failed ORA-19202: Error occurred in XML processing LPX-00601: Invalid token in: 'bk::book' ORA-06512: at "SYS.XMLTYPE", line 111
    xmlt1 := xmlt.extract( 'book', 'bk' );
    ORA-31013: Invalid XPATH expression ORA-06512: at "SYS.XMLTYPE", line 119
    I am using Oracle version 10.2.0.1.0. Had someone also faced this problem?
    The code I used to test is at the end of this message.
    Thanks in advance
    ====================================
    DECLARE
    xml varchar2(32000);
    xmlt XMLType;
    xmlt1 XMLType;
    root varchar2(3000);
    BEGIN
    --Example from w3c.org
    xml := '<?xml version="1.0"?>
    <bk:book xmlns:bk=''urn:loc.gov:books''
    xmlns:isbn=''urn:ISBN:0-395-36341-6''>
    <bk:title>Cheaper by the Dozen</bk:title>
    <isbn:number>1568491379</isbn:number>
    </bk:book>';
    xmlt := XMLType( xml );
    root := xmlt.getRootElement();
    dbms_output.put_line( 'StringVal: ' || xmlt.getStringVal() ); -- The XML is ok…
    dbms_output.put_line( 'Namespace: ' || xmlt.getNameSpace() ); -- Returns NULL
    dbms_output.put_line( 'Root element: ' || root ); -- Returns ‘book’
    dbms_output.put_line( 'Exists: ' || xmlt.existsNode('book') ); -- Returns ZERO
    xmlt1 := xmlt.extract( 'bk:book' ); Raises error (see above)
    xmlt1 := xmlt.extract( 'bk::book' ); Raises error (see above)
    xmlt1 := xmlt.extract( 'book', 'bk' ); Raises error (see above)
    --xmlt1 := xmlt.extract( 'book' );
    dbms_output.put_line( 'StringVal: ' || xmlt1.getStringVal() ); Raises error
    END;
    /

    If you put your XML into a namespace then you also need to extract from that namespace.... e.g.
    No namespace...
    SQL> select t.xml.extract('myroot')
    2 from (select XMLTYPE('<myroot><mychild>test</mychild></myroot>') as xml from dual) t
    3 ;
    T.XML.EXTRACT('MYROOT')
    <myroot>
    <mychild>test</mychild>
    </myroot>Put XML in namespace and now the extract returns nothing...
    SQL> ed
    Wrote file afiedt.buf
    1 select t.xml.extract('myroot')
    2* from (select XMLTYPE('<myroot xmlns="fred"><mychild>test</mychild></myroot>') as xml from dual) t
    3 /
    T.XML.EXTRACT('MYROOT')
    --------------------------------------------------------------------------------------------------------Extract, specifying the namespace to extract from and now returns the result...
    SQL> ed
    Wrote file afiedt.buf
    1 select t.xml.extract('myroot', 'xmlns="fred"')
    2* from (select XMLTYPE('<myroot xmlns="fred"><mychild>test</mychild></myroot>') as xml from dual) t
    SQL> /
    T.XML.EXTRACT('MYROOT','XMLNS="FRED"')
    <myroot xmlns="fred">
    <mychild>test</mychild>
    </myroot>
    SQL>;)

  • XMLTYPE and International Characters

    Database: Oracle9i
    Characterset: US7ASCII
    I am trying to insert a very small xml document into an XMLTYPE column in a table.
    My xml document, however, contains international characters like French and Spanish letters with their accompanying accent marks.
    I have tried setting various encoding schemes in the encoding attribute on the xml document but none of them work.
    The parser stops at the first international character and complains that it is invalid.
    Is there anything I can do to insert these characters into my XMLTYPE column without complaint?
    Thanks.

    Please post this message at:
    Forums Home » Oracle Technology Network (OTN) » Products » Database » XML DB

  • Oracle XMLType and clobs

    Hi,
    I've been struggling for days trying to figure out how to populate an XMLType
    field in Oracle 9i. I'm using the OracleThinDriver, WL 7.0, weblogic oracle extensions
    and a WL connection pool but to no avail.
    Has anyone done this? Is it possible? I keep getting an invalid LOB when I do
    a select on the XMLType field and cast it to a OracleThinClob type and attempt
    to write to it.
    Any help is much appreciated.
    Thx.
    Rachel

    We do not support XMLType oracle extension in 7.0. That feature is available from next
    major release(8.0?).
    Mitesh
    Rachel Hall wrote:
    Hi,
    I've been struggling for days trying to figure out how to populate an XMLType
    field in Oracle 9i. I'm using the OracleThinDriver, WL 7.0, weblogic oracle extensions
    and a WL connection pool but to no avail.
    Has anyone done this? Is it possible? I keep getting an invalid LOB when I do
    a select on the XMLType field and cast it to a OracleThinClob type and attempt
    to write to it.
    Any help is much appreciated.
    Thx.
    Rachel

  • How to convert PL/SQL Objects to XMLTYPE and use external schema

    We are creating PL/SQL Objects using Jpublisher to set values.
    We need to build a SOAP request based on that to call Web Service using utl_DBWS/UTL_HTTP.
    l_RequestHeader := OBJ_RequestHeader(l_UserObj,l_SourceDet,
    l_ReqHeaderId);
    XMLTYPE or CreateXML – both take schema(namespace) argument.
    For example
    reqhead := XMLType(l_RequestHeader,
    'Schema URL');
    We need converted XML in following format:-
    <proc:RequestHeader>
    <id>Id</id>
    <source>sr1</source>
    <user>
    <credentials>pass</credentials>
    <userID>user</userID>
    </user>
    </proc:RequestHeader>
    But after running XMLType, we are getting like this.
    <OBJ_REQUESTHEADER><USER_><USERID_>user</USERID_>
    <CREDENTIALS_>pass</CREDENTIALS_></USER_>
    <SOURCE_>sr1</SOURCE_>
    <ID_>Id</ID_></OBJ_REQUESTHEADER>
    XML tags are as per Oracle PL/SQL Wrapper and they are not matching with the request.
    Please let us know what is the problem here and any syntax/method to rectify this problem.

    "I have created few non cache tables in TT, to compile PL/SQL objects .
    if i make any DML's through PL/SQL(passthrough 1) , it is updationg with TT tables but not Oracle table ."
    [T2C]: This is correct and it is what you want to do, right?
    what is the way to handle non cahe tables updates through PL/SQL, how can we achive non cahe tables updates in TT ,refresh with oracle ( i.e non cahe table updates need to go to the oracle ).
    [T2C]: Sorry, but I am not sure I understand. Were you not able to update the non-cached tables, like you mentioned in the first paragraph? Do you mean that you want the non-cached tables to propagate to Oracle? Would that not be a cache table then?

  • Extracting data from XML using xmltype and extract

    Hello all,
    I want to write a pl/sql functions that takes a clob as an input and return a some data extracted from the data passed into it.
    the input will be an xml similar to the following:
    <FIXML xsi:schemaLocation="http://www.finacle.com/fixml executeFinacleScript.xsd" xmlns="http://www.finacle.com/fixml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <Header>
            <ResponseHeader>
                <RequestMessageKey>
                    <RequestUUID>IVR201306180841060310000000000000000</RequestUUID>
                    <ServiceRequestId>executeFinacleScript</ServiceRequestId>
                    <ServiceRequestVersion>10.3</ServiceRequestVersion>
                    <ChannelId>IVR</ChannelId>
                </RequestMessageKey>
                <ResponseMessageInfo>
                    <BankId>01</BankId>
                    <TimeZone></TimeZone>
                    <MessageDateTime>2013-06-18T05:36:55.918</MessageDateTime>
                </ResponseMessageInfo>
                <UBUSTransaction>
                    <Id/>
                    <Status/>
                </UBUSTransaction>
                <HostTransaction>
                    <Id/>
                    <Status>SUCCESS</Status>
                </HostTransaction>
                <HostParentTransaction>
                    <Id/>
                    <Status/>
                </HostParentTransaction>
                <CustomInfo/>
            </ResponseHeader>
        </Header>
        <Body>
            <executeFinacleScriptResponse>
                <ExecuteFinacleScriptOutputVO>
                    <executeFinacleScript_customData>
                        <DataCategory>ACC</DataCategory>
                        <New_Data>0001019300101001</New_Data>
                    </executeFinacleScript_customData>
                </ExecuteFinacleScriptOutputVO>
            </executeFinacleScriptResponse>
        </Body>
    </FIXML>'
    I want to extract the value of new_data.
    I wrote the following anonymous block to test the code :
    declare
    xparam xmltype;
    v_xpath varchar2(500);
    begin
    xparam:=xmltype('<FIXML xsi:schemaLocation="http://www.finacle.com/fixml executeFinacleScript.xsd"  xmlns="http://www.finacle.com/fixml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <Header>
            <ResponseHeader>
                <RequestMessageKey>
                    <RequestUUID>IVR201306180841060310000000000000000</RequestUUID>
                    <ServiceRequestId>executeFinacleScript</ServiceRequestId>
                    <ServiceRequestVersion>10.3</ServiceRequestVersion>
                    <ChannelId>IVR</ChannelId>
                </RequestMessageKey>
                <ResponseMessageInfo>
                    <BankId>01</BankId>
                    <TimeZone></TimeZone>
                    <MessageDateTime>2013-06-18T05:36:55.918</MessageDateTime>
                </ResponseMessageInfo>
                <UBUSTransaction>
                    <Id/>
                    <Status/>
                </UBUSTransaction>
                <HostTransaction>
                    <Id/>
                    <Status>SUCCESS</Status>
                </HostTransaction>
                <HostParentTransaction>
                    <Id/>
                    <Status/>
                </HostParentTransaction>
                <CustomInfo/>
            </ResponseHeader>
        </Header>
        <Body>
            <executeFinacleScriptResponse>
                <ExecuteFinacleScriptOutputVO>
                    <executeFinacleScript_customData>
                        <DataCategory>ACC</DataCategory>
                        <New_Data>0001019300101001</New_Data>
                    </executeFinacleScript_customData>
                </ExecuteFinacleScriptOutputVO>
            </executeFinacleScriptResponse>
        </Body>
    </FIXML>');
    v_xpath:='//New_Data/text()';-
    dbms_output.put_line(xparam.EXTRACT(v_xpath).GETSTRINGVAL());
    end;
    but I get the following Error:
    dbms_output.put_line(xparam.EXTRACT(v_xpath).GETSTRINGVAL());
    end;
    Error at line 1
    ORA-30625: method dispatch on NULL SELF argument is disallowed
    ORA-06512: at line 46
    the problem is that when I remove : xmlns="http://www.finacle.com/fixml" attribute from the root node the code works correctly.
    of course , I can simply use replace to remove it, but I want to know what is causing the error.
    I am using oracle database 10g

    Let me explain that the issue is not only related to Oracle.
    If you google a bit for default namespace and Xpath you will find many topic.
    Basically when you have an XML having a definition of namespace without a prefix:
    i.e.:
    <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
        <title>Example XHTML document</title>
      </head>
      <body>
        <p>Sample content</p>
      </body>
    </html>
    this means that all unprefixed elements are belonging to this default namespace.
    In this case an Xpath equal to '//title/text()' will not get anything because it is assuming to find the element title within a null namespace. But title in this case is automatically assigned to the default namespace.
    When you specify a prefix in a namespace then all elements without prefix are associated to namespace NULL. Using a default namespace is causing a lot of headache.
    These links can be giving a clearer picture:
    http://www.edankert.com/defaultnamespaces.html
    Assuming that you have data like this:
    WITH mydata AS
    (   SELECT '
    <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
        <title>Example XHTML document</title>
      </head>
      <body>
        <p>Sample content</p>
      </body>
    </html>' xmldata FROM DUAL
    SELECT xmltype (xmldata).EXTRACT ('//title/text()').getstringval ()
      FROM mydata;
    This query will not give anything back to you. You will have to specify:
    SELECT xmltype (xmldata).EXTRACT ('//title/text()', 'xmlns="http://www.w3.org/1999/xhtml"').getstringval ()
      FROM mydata;
    Note also that you should be able to get the default namespace when it is specified (without prefix) by using:
    SELECT xmltype(xmldata).getnamespace() from mydata;
    Post your Oracle version to see if it something related to your version. In mine I got this:
    SQL*Plus: Release 11.2.0.1.0 Production on Thu Jun 20 18:32:58 2013
    Copyright (c) 1982, 2010, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> WITH mydata AS
      2  (   SELECT '
      3  <html xmlns="http://www.w3.org/1999/xhtml">
      4    <head>
      5      <title>Example XHTML document</title>
      6    </head>
      7    <body>
      8      <p>Sample content</p>
      9    </body>
    10  </html>' xmldata FROM DUAL
    11  )
    12  SELECT xmltype(xmldata).getnamespace() from mydata;
    XMLTYPE(XMLDATA).GETNAMESPACE()
    http://www.w3.org/1999/xhtml
    SQL>
    If this would work, then it would be enough to add the optional additional parameter namespace. In case it is null it will be set as xmlsn="" and it will work anyway:
    Please note that it will work both if the XML has a default namespace or not
    i.e.:
    with default namespace:
    SQL> DECLARE
      2     xparam         XMLTYPE;
      3     v_xpath        VARCHAR2 (500);
      4     v_ns           VARCHAR2 (500);
      5  BEGIN
      6     xparam :=
      7        xmltype ('
      8  <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ns="http://www.w3.org/1999/xhtml" >
      9    <head>
    10      <title>Example XHTML document</title>
    11    </head>
    12    <body>
    13      <p>Sample content</p>
    14    </body>
    15  </html>');
    16     v_xpath := '//title/text()';
    17     v_ns := 'xmlns="' || xparam.getnamespace () || '"';
    18     DBMS_OUTPUT.
    19      put_line (
    20        'Value of title:' || xparam.EXTRACT (v_xpath, v_ns).getstringval ());
    21  END;
    22  /
    Value of title:Example XHTML document
    PL/SQL procedure successfully completed.
    SQL>
    and without default namespace
    SQL> DECLARE
      2     xparam         XMLTYPE;
      3     v_xpath        VARCHAR2 (500);
      4     v_ns           VARCHAR2 (500);
      5  BEGIN
      6     xparam :=
      7        xmltype ('
      8  <html xmlns:ns="http://www.w3.org/1999/xhtml" >
      9    <head>
    10      <title>Example XHTML document</title>
    11    </head>
    12    <body>
    13      <p>Sample content</p>
    14    </body>
    15  </html>');
    16     v_xpath := '//title/text()';
    17     v_ns := 'xmlns="' || xparam.getnamespace () || '"';
    18     DBMS_OUTPUT.
    19      put_line (
    20        'Value of title:' || xparam.EXTRACT (v_xpath, v_ns).getstringval ());
    21  END;
    22  /
    Value of title:Example XHTML document
    PL/SQL procedure successfully completed.
    Regards.
    Al
    Message was edited by: AlbertoFaenza
    IF removed as it is working anyway.

  • Oracle9i XMLType and namespace declaration

    Hi Folks,
    I am using the new XMLType for storing XML data and when I want to insert a XML document that contains a namespace declaration
    using sys.XMLType.createXML('<lom xmlns="http://www.imsglobal.org/xsd/imsmd_rootv1p2p1"...>...</lom>') function, nothing is inserted into the field and no error message is shown. If I remove the namespace declaration like: sys.XMLType.createXML('<lom>...</lom>') then it works.
    I am wondering if there is a problem with the XML Parser or I should do something that I don't. I have read most of the online documents in this regard but couldn't find any answer.
    Your help is really appreciated.
    Bahram Jalili

    I ran into the same (almost) problem a few weeks ago and posted a question to this forum - no response... sigh. Seems like a pretty obvious bug.

  • XMLType and uploading XML data

    I have a XMLType column in the a table in Oracle9i database.
    The XML will be sent as a String from some other object.
    The sample XML is
    <?xml version="1.0"?>
    <xmlStr>
    <data>some data</data>
    </xmlStr>
    The code I use is the following:
    public void upload(String xmlStr) {
    //Assuming connection etc is properly established
    try {
    XMLType xmlStrXt = XMLType.createXML(conn, xmlStr);
    oracle.jdbc.OraclePreparedStatement pStmt =
    (OraclePreparedStatement) conn.prepareStatement
    ("insert into testTable values(?)");
    pStmt.setOPAQUE(1, xmlStrXt);
    pStmt.executeUpdate();
    conn.commit();
    System.out.println("Record updated");
    catch(SQLException sqle) {
    System.out.println(sqle.getMessage());
    Everything works fine till the executeUpdate is called. Then I
    get the following exception:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00230: invalid character 191 (\u00BF) found in a NAME or NMTOKEN
    I found out that the exception occurs if the
    <?xml version="1.0"?> line is present in the input xmlStr or any
    other Processing Instruction such as "<?xml-stylesheet?>"
    Any help in resolving this issue is greatly appreciated.
    Thanx in advance,
    Chetan

    Hi CC
    So you need to take your current XML format to their XML format per their XSD schema. the Schema basically defines the structure for the final XML that they wish to receive. Publisher can help you with this ie converting from one schema (yours) to another (theirs) but it needs a template to apply to your data. This will take the form of an XSL document, Publisher does not provide a mapping tool to build this but Oracle does.
    I recently wrote a blog article on using a JDeveloper tool to build the XSL for you. You load your base document ie the XML you are currently generating and the XSD file (schema) that has been provided to you and then visually map the source data to the target data.
    More info in the blog article here - http://blogs.oracle.com/xmlpublisher/templates/xsl/
    regards
    Tim

  • XMLType and materialized subquery factoring

    Hi,
    Out of curiosity, I've been wondering what kind of storage is used when a view with an XMLType column gets materialized, for example via the WITH clause.
    So I tried :
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Express Edition Release 11.2.0.2.0 - Beta
    PL/SQL Release 11.2.0.2.0 - Beta
    CORE    11.2.0.2.0      Production
    TNS for 32-bit Windows: Version 11.2.0.2.0 - Beta
    NLSRTL Version 11.2.0.2.0 - Production
    SQL> with t as (
      2    select /*+ materialize */
      3           xmltype('<root>Hello!</root>') as doc
      4    from dual
      5  )
      6  select doc
      7  from t
      8  ;
    with t as (
    ERROR at line 1:
    ORA-00600: internal error code, arguments: [kkdlsexp:qbcp], [], [], [], [], [],
    [], [], [], [], [], []Apparently, that's bug #9372157 "WITH clause with XML causes OERI [kkdlsexp:qbcp]" which should have been fixed in 11.2.0.2, but maybe not in XE?
    Well, my question is : could someone having access to a full 11.2.0.2 EE check it?
    Below is a working example on a "regular" view, describing how to do it :
    SQL> set autotrace on
    SQL> with t as (
      2    select /*+ materialize */
      3           cast('Hello' as varchar2(30)) as text1,
      4           cast('World' as varchar2(30)) as text2
      5    from dual
      6  )
      7  select text1, text2
      8  from t
      9  ;
    TEXT1                          TEXT2
    Hello                          World
    Execution Plan
    Plan hash value: 2441519912
    | Id  | Operation                  | Name                     | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT           |                          |     1 |    34 |     4   (0)| 00:00:01 |
    |   1 |  TEMP TABLE TRANSFORMATION |                          |       |       |            |          |
    |   2 |   LOAD AS SELECT           | SYS_TEMP_0FD9D6618_E893C |       |       |            |          |
    |   3 |    FAST DUAL               |                          |     1 |       |     2   (0)| 00:00:01 |
    |   4 |   VIEW                     |                          |     1 |    34 |     2   (0)| 00:00:01 |
    |   5 |    TABLE ACCESS FULL       | SYS_TEMP_0FD9D6618_E893C |     1 |    34 |     2   (0)| 00:00:01 |
    Statistics
              2  recursive calls
              8  db block gets
              4  consistent gets
              1  physical reads
            576  redo size
            487  bytes sent via SQL*Net to client
            419  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processed
    SQL> desc sys.SYS_TEMP_0FD9D6618_E893C
    Name                        Null?    Type
    C0                                   VARCHAR2(30)
    C1                                   VARCHAR2(30)Thanks.

    SQL> show parameter compatible
    NAME                                 TYPE        VALUE
    compatible                           string      11.2.0.0.0

Maybe you are looking for

  • How do I find the date an app was added to my i phone ?

    My child downloaded some apps to my i phone that he did not need to be and i Need to know WHAT DATE these apps where installed ? They are in the not on this phone folder ???  HELP !

  • Local Client Copy error in post processing phase

    Hello All, We are facing issues in local client copy on SRM 5.5 system Basis 700 SP19 with Oracle Db. I have ran the same twice. All the tables are getting copied but the error or warning is occuring in "Post-Processing" phase. Table Name            

  • Java batch compile on UNIX  errorlevel checking

    What would the unix equivalent of the ERRORLEVEL checking in this DOS batch command be? javac -g -d %CLASS_HOME% -classpath %MY_CP% com/abc/def/*.java IF %ERRORLEVEL% GEQ 1 GOTO ERROREXIT I kind of know my way around unix but I've never had to do thi

  • Viewing streaming video

    I recently had help using this forum so i'm going to try it again. I downloaded windows media player to view my saved media player clips. i use mozilla firefox, now when i go to a website to view streaming video, it tells me i need a plug-in. when i

  • Shaking after rendering...

    I have finished my project on FCP but when I try to render it all, some of the scenes come out shaky. I tried it a couple of times but each time it happens to the same few clips. These scenes don't have any big special effects on them; only colour co