XMLType and JPublisher

Hi, I'm trying to use a table with a XMLType column in combination with Java classes generated by JPublisher.
Table:
CREATE TABLE TEST_XML_TAB (
     TESTID           NUMBER(10),
     FILENAME      CHAR(127) UNIQUE,
     TESTDOC      SYS.XMLTYPE,
CONSTRAINT TESTID_PK PRIMARY KEY(TESTID))
XMLTYPE COLUMN TESTDOC XMLSCHEMA "http://xxx/METADATA"
ELEMENT "Metadata";
There seems to be no problem materializing data into a generated class:
orset = (OracleResultSet)stmt.executeQuery("select x.FILENAME, x.TESTDOC.xmldata from TEST_XML_TAB x");
Metadata meta = (Metadata)orset.getORAData(2, Metadata.getORADataFactory());
But I can't find an easy way to make an insert or update!
Any Help?
Thanks!

OK, I tried building an object view around the table:
CREATE TYPE TEST_XML_TAB_TYPE AS OBJECT (
     TESTID           NUMBER(10),
     FILENAME      CHAR(127),
     TESTDOC DD."Metadata_T"
CREATE VIEW TEST_XML_TAB_VIEW OF TEST_XML_TAB_TYPE
WITH OBJECT IDENTIFIER (TESTID) AS
SELECT e.TESTID, e.FILENAME, e.TESTDOC.xmldata
FROM TEST_XML_TAB e;
Then the following works fine:
opstmt = (OraclePreparedStatement) conn.prepareStatement(
"insert into TEST_XML_TAB_VIEW (TESTID, FILENAME, TESTDOC) values(?,?,?)");
opstmt.setORAData(3, meta);
Using SQL*Plus Worksheet the statement
SELECT TESTDOC FROM TEST_XML_TAB;
shows all inserted data sets.
But selecting the data sets by using Java and XMLType the inserted data sets couldn't be streamed out.
Which information is lost when inserting as described above?
Any Help?
Thanks!

Similar Messages

  • 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 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

  • JDeveloper and JPublisher

    I'm looking for some guidance on how JDeveloper and JPublisher work together. I'm attempting to use the Oracle Apps adapter to connect to E-Biz R12, and as part of that JDeveloper has an adapter service creation wizard which uses JPublisher to create PLSQL wrapper objects. I've documented the exact issue I'm having in this thread over in the adapter forum:
    WSDL Exception while defining an App Adapter Service
    The reason I'm posting here is that I'm having trouble finding anything about how JDeveloper and JPublisher work together. Is there any documentation on using the two together? Specifically, I'm looking for a way that I can get JDeveloper to display whatever error message JPublisher is encountering when it tries to create those PLSQL wrapper objects.
    I've looked through the JPublisher documentation, but I didn't find anything about using it with JDeveloper. Similarly I've looked through JDeveloper's doc but didn't find any reference to JPublisher, at least not in the context of the adapter wizard.
    Thanks,
    Skip

    It seems the issue I was seeing was the fault of the Oracle Apps adapter - we tried the exact same test using the DB Adapter and it worked fine. So it looks like JPublisher wasn't the issue.

  • 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?

  • 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

  • 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

  • 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

  • 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 Vector

    Hi !
    I try to save an XMLType java object in a a Collection or a Vector and it seems that when I extract the XMLType from the Vector or Collection I get and empty object ...
    an idea ?
    Thx

    You've probably lost the database connection between loading the XMLtype into the Vector and getting it back out. THe XMLType needs a persistant database connection...

  • XMLType and CLOB

    For full document retrieval and inserts is there a performance difference between declaring a XMLType or a simple CLOB database column type in table.
    Thanks in advance.

    I have a related question:
    Is there any difference between using the XMLTYPE constructor function and using XMLTYPE.CREATEXML to convert a temporary CLOB to XMLTYPE?
    I have the following in a PL/SQL function (simplified):
    FUNCTION get_geocode_xml( p_geocodes IN CLOB) RETURN XMLTYPE IS
      r_geocodes XMLTYPE;
    BEGIN
      r_geocodes := XMLTYPE.CREATEXML(p_geocodes);
      RETURN r_geocodes;
    END;Is this the same as using the constructor as in
    r_geocodes := XMLTYPE(p_geocodes);
    It seems to work either way, but I've only extensively tested the first method.

Maybe you are looking for

  • Converting Scope_Identity from tsql to pl\sql

    Here is my MS proc: CREATE Procedure [dbo].[sp_AddLabel] @v_LabelName NVARCHAR(50) = Null,           @v_LabelDescription NVARCHAR(255)= Null,           @v_Label_Data IMAGE = NULL,           @v_ProfileID SMALLINT) As begin      INSERT INTO LABELS (LAB

  • HOW the cost of good sold account is l liked with GL code_combination_id

    Can any one pass the query how the cost of good sold account is l liked with GL code_combination_id

  • Parse HTML from URL

    Hello everyone, I am working on a project where I need to be able to pull data out of a website. So essentially I will give the program the url of the site and then parse the source to extract the information I need. If the built in java html parsing

  • Photos from ipod, preserving structure

    So I lost a hard drive in my macbook recently, and I didn't have proper backups (silly silly boy, I know ). I've managed to get a lot of content back, but now I want to restore my photos. I've got all my photos synced to my ipod (including full-res v

  • How do I request help for an Acrobat search efficiency question?

    I have had a search time degradation of 60x-70x when I switch to Acrobat X or XI (went from 14 seconds on v9.5 to 841 seconds with X or 991 seconds seconds with XI).  I am trying to find out where I can ask about this to see what I can do to improve