How to retrieve a part of XML document

Dear Everyone
I am using
Oracle: Berkeley DB XML 2.4.16: (October 21, 2008)
Berkeley DB 4.6.21: (September 27, 2007)
with python api on mac OSX.
I want to copy a part of XML document within the document.
For example, assume that we have the following XML in dbxml.
<A>
<B id="1">
<C>hello</C>
<D>hi</D>
</B>
</A>
I want to copy <B> with different "id" like,
<A>
<B id="1">
<C>hello</C>
<D>hi</D>
</B>
<B id="2">
<C>hello</C>
<D>hi</D>
</B>
</A>
How can I do this?
One more question. I want to retrieve a part of XML as string.
For example,
I want to have a string ' <B id="1"><C>hello</C><D>hi</D></B>'
How can I do this?
Thank you very much for your kind help in advance.
Best regards,
-Yoshi

Hi,
I couldn't add a document like you described:
dbxml
dbxml> createC test.dbxml
dbxml> putD "mydoc" "<C>hello</C><D>hi</D>" "s"
stdin:5: putDocument failed, Error: Error: XML Indexer: Fatal Parse error in document at line 1, char 13. Parser message: Expected comment or processing instruction (Document: mydoc)
but, if I fix it and make it well formed it worked, so for
the experiment I did that:
dbxml> putD "mydoc" "<mydoc><C>hello</C><D>hi</D></mydoc>" "s"
Document added, name = mydoc
I could have added as two separate documents, document 1: <C>hello</C>,
document 2: <D>hi</D>, but, I don't know what you are trying to do, so
I'll stick with this example to the first.
Then I ran a query to show what you did:
dbxml> query 'collection("test.dbxml")/mydoc/*'
2 objects returned for eager expression 'collection("test.dbxml")/mydoc/*'
dbxml> print
<C>hello</C>
<D>hi</D>
I can do the same thing using a query that returns something:
dbxml> query 'for $i in collection("test.dbxml")/mydoc/* return $i'
2 objects returned for eager expression 'for $i in collection("test.dbxml")/mydoc/* return $i'
dbxml> print
<C>hello</C>
<D>hi</D>
This duplicates, but the wrong way:
dbxml> query 'for $i in collection("test.dbxml")/mydoc/* return ($i,$i)'
4 objects returned for eager expression 'for $i in collection("test.dbxml")/mydoc/* return ($i,$i)'
dbxml> print
<C>hello</C>
<C>hello</C>
<D>hi</D>
<D>hi</D>
dbxml> query 'for $j in (1,2) for $i in collection("test.dbxml")/mydoc/* return $i'
4 objects returned for eager expression 'for $j in (1,2) for $i in collection("test.dbxml")/mydoc/* return $i'
dbxml> print
<C>hello</C>
<D>hi</D>
<C>hello</C>
<D>hi</D>
And, finally, for your last string example:
dbxml> query 'for $i in collection("test.dbxml")/mydoc/C for $j in collection("test.dbxml")/mydoc/D return concat("<C>",$i,"</C>", "<D>", $j, "</D>")'
1 objects returned for eager expression 'for $i in collection("test.dbxml")/mydoc/C for $j in collection("test.dbxml")/mydoc/D return concat("<C>",$i,"</C>", "<D>", $j, "</D>")'
dbxml> print
<C>hello</C><D>hi</D>
I don't get the 'id' change though.
I hope this helps.
-g

Similar Messages

  • How to parse this kind of XML documents and store in a relational tables

    Can u guys help me out ,..how to parse these kind of XML documents..like under PR there Sr,CreationDate and DoBID.. Again under Sr...there are LD, CID,TID, RID and so on.....
    so how to parse this kind of data..how to create the structure of the table....pls help me out..
    <nk8:PR>
              <nk8:Sr>
                   <nk8:LD>---------</nk8:LID>
                   <nk8:CID>---------</nk8:CID>
                   <nk8:TID>---------</nk8:TID>
                   <nk8:RID>---------</nk8:RID>
                   <nk8:CC>OnError</nk8:CC>
                   <nk8:AID>---------</nk8:AID>
              </nk8:Sr>
              <nk8:CreationDateTime>2002-07-01</nk8:CreationDateTime>
              <nk8:DOBID>---------</nk8:DOBID>
         </nk8:PR>
         <ssm:ER>
              <ssm:PN>---------</ssm:PN>
              <ssm:SN>---------</ssm:SN>
              <ssm:SCt>---------</ssm:SC>
              <ssm:IA>
                   <ssm:NT>---------</ssm:NT>
                   <nk8:LID>---------</nk8:LID>
                   <nk8:CID>---------</nk8:CID>
                   <ssm:AN>---------</ssm:AN>
              </ssm:A>
         </ssm:ER>
         </nk8:PR>

    First, your XML document is not well formatted. Once you're done with that you can extract the values and store it in a table column.
    sql> WITH xml_table AS
      2  (SELECT XMLTYPE(
      3  '
      4  <nk8:PR xmlns:nk8="http://www.w3.org">
      5  <nk8:Sr>
      6  <nk8:LID>LID Value</nk8:LID>
      7  <nk8:CID>CID Value</nk8:CID>
      8  <nk8:TID>TID Value</nk8:TID>
      9  <nk8:RID>RID Value</nk8:RID>
    10  <nk8:CC>OnError</nk8:CC>
    11  <nk8:AID>---------</nk8:AID>
    12  </nk8:Sr>
    13  </nk8:PR>') XMLCOL FROM DUAL)
    14  SELECT extractvalue(t.column_value,'//nk8:LID','xmlns:nk8="http://www.w3.org"') "LID",
    15   extractvalue(t.column_value,'//nk8:CID','xmlns:nk8="http://www.w3.org"') "CID",
    16   extractvalue(t.column_value,'//nk8:RID','xmlns:nk8="http://www.w3.org"') "RID",
    17  extractvalue(t.column_value,'//nk8:CC','xmlns:nk8="http://www.w3.org"') "CC"
    18  FROM xml_table, table(xmlsequence(extract(xmlcol,'/nk8:PR/nk8:Sr','xmlns:nk8="http://www.w3.org"'))) t;
    LID        CID        RID        CC
    LID Value  CID Value  RID Value  OnError

  • How do i query attributes from xml documents

    I want to to query only details in Issue id="705230" (id is an attribute)
    I tried this, but does not help. I should be able to query the value of core_org_id attribute
    select extract(CLOB_DATA, 'PcrDocument/PcrOrganization/core_org_id) CORE_ORG_ID from from pcr_files where existsNode(CLOB_DATA, 'PcrDocument/PcrOrganization/Issues/Issue[@id="705230"]')=1;
    -- does not return anything....
    I tried to extract value for R_DATE & R_REVIEW_DATE for issue id=705230, but iam not able to.
    Data for all the issues is retured.
    Here is the query used...
    select extract(CLOB_DATA, 'PcrDocument/PcrOrganization/Issues/Issue') ISSUE from pcr_files where existsNode(CLOB_DATA, 'PcrDocument/PcrOrganization/Issues/Issue[@id="705230"]')=1;
    Here is the part of XML document iam querying on...
    - <ns1:PcrDocument id="PCR-13562" title="EU Disclosures - EC 1060/2009" version="1" pcrPublishDate="2012-01-11T12:49:02" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="http://integration.mysite.com/ServiceSchema/v3">
    - <ns1:PcrOrganization core_org_id="345840">
    <ns1:PcrLinkedTo value="ISSUE" />
    - <ns1:AdditionalInfo>
    <ns1:Info type="AdditionalInfo_QuartelyReport_URL"><br></br>MGH</ns1:Info>
    </ns1:AdditionalInfo>
    - <ns1:Issues>
    - <ns1:Issue id="705230">
    - <ns1:AdditionalInfo>
    <ns1:Info type="R_DATE">Credit Release Date: 09-Apr-2010</ns1:Info>
    <ns1:Info type="R_REVIEW_DATE">Credit Last Review Date: 12-Oct-2011</ns1:Info>
    <ns1:Info type="AdditionalInfo_QuartelyReport_URL"><br></br>MGH</ns1:Info>
    </ns1:AdditionalInfo>
    - <ns1:IssueDetail id="114766798">
    - <ns1:AdditionalInfo>
    <ns1:Info type="R_DATE">Credit Release Date: 09-Apr-2010</ns1:Info>
    <ns1:Info type="R_REVIEW_DATE">Credit Last Review Date: 12-Oct-2011</ns1:Info>
    <ns1:Info type="AdditionalInfo_QuartelyReport_URL"><br></br>MGH</ns1:Info>
    </ns1:AdditionalInfo>
    </ns1:IssueDetail>
    </ns1:Issue>
    - <ns1:Issue id="727193">
    - <ns1:AdditionalInfo>
    <ns1:Info type="R_DATE">Credit Release Date: 09-Apr-2010</ns1:Info>
    <ns1:Info type="R_REVIEW_DATE">Credit Last Review Date: 12-Oct-2011</ns1:Info>
    <ns1:Info type="AdditionalInfo_QuartelyReport_URL"><br></br>MGH</ns1:Info>
    </ns1:AdditionalInfo>
    - <ns1:IssueDetail id="117994574">
    - <ns1:AdditionalInfo>
    <ns1:Info type="R_DATE">Credit Release Date: 09-Apr-2010</ns1:Info>
    <ns1:Info type="R_REVIEW_DATE">Credit Last Review Date: 12-Oct-2011</ns1:Info>
    <ns1:Info type="AdditionalInfo_QuartelyReport_URL"><br></br>MGH</ns1:Info>
    </ns1:AdditionalInfo>
    </ns1:IssueDetail>
    </ns1:Issue>
    </ns1:Issues>
    </ns1:PcrOrganization>
    </ns1:PcrDocument>

    I did not include the name space declaration for it is working fine. Really? Then I suppose you must be using a schema-based XMLType column?
    Is it Object-Relational or Binary XML storage?
    You mentioned it is depricated in 11.2, but iam able to run it on 11.2.Deprecated doesn't mean it ceases functioning.
    Any suggestions to covert this to XMLTable/XMLQuery format please..If you read the documentation, it covers this part too ;)
    Example :
    create table tmp_xml of xmltype;
    insert into tmp_xml values(
    xmltype('<ns1:PcrDocument id="PCR-13562" title="EU Disclosures - EC 1060/2009" version="1" pcrPublishDate="2012-01-11T12:49:02" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="http://integration.mysite.com/ServiceSchema/v3">
      <ns1:PcrRatingDetails>
        <ns1:LeadAnalyst>
          <ns1:FirstName>xxxxx</ns1:FirstName>
          <ns1:MiddleName/>
          <ns1:LastName>xxxxxx</ns1:LastName>
          <ns1:Title>Director</ns1:Title>
          <ns1:Label>Primary Analyst</ns1:Label>
          <ns1:Telephone>xxxxxxxxxxxx</ns1:Telephone>
          <ns1:Email>[email protected]</ns1:Email>
          <ns1:Address>
            <ns1:Line1>Main Tower</ns1:Line1>
            <ns1:Line2>Neue Mainzer Strasse</ns1:Line2>
            <ns1:City>FFT</ns1:City>
            <ns1:State/>
            <ns1:ZipCode>99999</ns1:ZipCode>
            <ns1:Country>Germany</ns1:Country>
          </ns1:Address>
        </ns1:LeadAnalyst>
        <ns1:RatingApprover>
          <ns1:FirstName>Nick</ns1:FirstName>
          <ns1:MiddleName/>
          <ns1:LastName>Mate</ns1:LastName>
        </ns1:RatingApprover>
      </ns1:PcrRatingDetails>
      <ns1:PcrOrganization core_org_id="345840">
        <ns1:PcrLinkedTo value="ISSUE"/>
        <ns1:AdditionalInfo>
          <ns1:Info type="AdditionalInfo_QuartelyReport_URL">
            <br/>
            <A href="http://www.mysite.com/rts/articles/en/us/?articleType=HTML&amp;assetID=1245321070686" target="_blank">MGH</A>
          </ns1:Info>
        </ns1:AdditionalInfo>
        <ns1:Issues>
          <ns1:Issue id="705230">
            <ns1:AdditionalInfo>
              <ns1:Info type="R_DATE">Credit  Release Date: 09-Apr-2010</ns1:Info>
              <ns1:Info type="R_REVIEW_DATE">Credit Last Review Date: 12-Oct-2011</ns1:Info>
              <ns1:Info type="AdditionalInfo_QuartelyReport_URL">
                <br/>
                <A href="http://www.mysite.com/rts/articles/en/us/?articleType=HTML&amp;assetID=1245321070686" target="_blank">MGH</A>
              </ns1:Info>
            </ns1:AdditionalInfo>
            <ns1:IssueDetail id="114766798">
              <ns1:AdditionalInfo>
                <ns1:Info type="R_DATE">Credit Release Date: 09-Apr-2010</ns1:Info>
                <ns1:Info type="R_REVIEW_DATE">Credit Last Review Date: 12-Oct-2011</ns1:Info>
                <ns1:Info type="AdditionalInfo_QuartelyReport_URL">
                  <br/>
                  <A href="http://www.mysite.com/rts/articles/en/us/?articleType=HTML&amp;assetID=1245321070686" target="_blank">MGH</A>
                </ns1:Info>
              </ns1:AdditionalInfo>
            </ns1:IssueDetail>
          </ns1:Issue>
          <ns1:Issue id="727193">
            <ns1:AdditionalInfo>
              <ns1:Info type="R_DATE">Credit Release Date: 09-Apr-2010</ns1:Info>
              <ns1:Info type="R_REVIEW_DATE">Credit Last Review Date: 12-Oct-2011</ns1:Info>
              <ns1:Info type="AdditionalInfo_QuartelyReport_URL">
                <br/>
                <A href="http://www.mysite.com/rts/articles/en/us/?articleType=HTML&amp;assetID=1245321070686" target="_blank">MGH</A>
              </ns1:Info>
            </ns1:AdditionalInfo>
            <ns1:IssueDetail id="117994574">
              <ns1:AdditionalInfo>
                <ns1:Info type="R_DATE">Credit Release Date: 09-Apr-2010</ns1:Info>
                <ns1:Info type="R_REVIEW_DATE">Credit Last Review Date: 12-Oct-2011</ns1:Info>
                <ns1:Info type="AdditionalInfo_QuartelyReport_URL">
                  <br/>
                  <A href="http://www.mysite.com/rts/articles/en/us/?articleType=HTML&amp;assetID=1245321070686" target="_blank">MGH</A>
                </ns1:Info>
              </ns1:AdditionalInfo>
            </ns1:IssueDetail>
          </ns1:Issue>
        </ns1:Issues>
      </ns1:PcrOrganization>
    </ns1:PcrDocument>')
    SQL> set long 10000
    SQL>
    SQL> select x1.analyst
      2       , x1.chair
      3       , x1.core_org_id
      4       , x2.*
      5  from tmp_xml t
      6     , xmltable(
      7         xmlnamespaces(default 'http://integration.mysite.com/ServiceSchema/v3')
      8       , '/PcrDocument'
      9         passing t.object_value
    10         columns analyst     xmltype path 'PcrRatingDetails/LeadAnalyst'
    11               , chair       xmltype path 'PcrRatingDetails/RatingApprover'
    12               , core_org_id number  path 'PcrOrganization/@core_org_id'
    13               , issues      xmltype path 'PcrOrganization/Issues/Issue'
    14       ) x1
    15     , xmltable(
    16         xmlnamespaces(default 'http://integration.mysite.com/ServiceSchema/v3')
    17       , '/Issue'
    18         passing x1.issues
    19         columns issue                 number       path '@id'
    20               , rating_date           varchar2(40) path 'AdditionalInfo/Info[@type="R_DATE"]'
    21               , rating_review_date    varchar2(40) path 'AdditionalInfo/Info[@type="R_REVIEW_DATE"]'
    22               , issue_detail          number       path 'IssueDetail/@id'
    23               , id_rating_date        varchar2(40) path 'IssueDetail/AdditionalInfo/Info[@type="R_DATE"]'
    24               , id_rating_review_date varchar2(40) path 'IssueDetail/AdditionalInfo/Info[@type="R_REVIEW_DATE"]'
    25       ) x2
    26  where x2.issue = 705230
    27  ;
    ANALYST                                                                          CHAIR                                                                            CORE_ORG_ID      ISSUE RATING_DATE                              RATING_REVIEW_DATE                       ISSUE_DETAIL ID_RATING_DATE                           ID_RATING_REVIEW_DATE
    <LeadAnalyst xmlns="http://integration.mysite.com/ServiceSchema/v3">             <RatingApprover xmlns="http://integration.mysite.com/ServiceSchema/v3">               345840     705230 Credit  Release Date: 09-Apr-2010        Credit Last Review Date: 12-Oct-2011        114766798 Credit Release Date: 09-Apr-2010         Credit Last Review Date: 12-Oct-2011
      <FirstName>xxxxx</FirstName>                                                     <FirstName>Nick</FirstName>                                                                                                                                                                                                                  
      <MiddleName/>                                                                    <MiddleName/>                                                                                                                                                                                                                                
      <LastName>xxxxxx</LastName>                                                      <LastName>Mate</LastName>                                                                                                                                                                                                                    
      <Title>Director</Title>                                                        </RatingApprover>                                                                                                                                                                                                                              
      <Label>Primary Analyst</Label>                                                                                                                                                                                                                                                                                                
      <Telephone>xxxxxxxxxxxx</Telephone>                                                                                                                                                                                                                                                                                           
      <Email>[email protected]</Email>                                                                                                                                                                                                                                                                                         
      <Address>                                                                                                                                                                                                                                                                                                                     
        <Line1>Main Tower</Line1>                                                                                                                                                                                                                                                                                                   
        <Line2>Neue Mainzer Strasse</Line2>                                                                                                                                                                                                                                                                                         
        <City>FFT</City>                                                                                                                                                                                                                                                                                                            
        <State/>                                                                                                                                                                                                                                                                                                                    
        <ZipCode>99999</ZipCode>                                                                                                                                                                                                                                                                                                    
        <Country>Germany</Country>                                                                                                                                                                                                                                                                                                  
      </Address>                                                                                                                                                                                                                                                                                                                    
    </LeadAnalyst>                                                                                                                                                                                                                                                                                                                  

  • How do I retrieve elements in a xml document ?

    I would like to know how to retrieve elements from xml document ?
    I have created a document already, but how do I proceed from there ?
    Also, how do I access the values inside, the attributes and value ?
    Thank you.

    parse the xml file in node wise using compare criteria according to programmer choice u can able to retrieve the elements which u want promptly

  • SQLException while selecting only part of XML document

    Hi,
    I'm newbie in oracle XML DB. I'm trying to make an example application but I'm still getting an SQLException while selecting only part of my XML document. I'm using oracle 11g release 1.
    I have following XML document:
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <CATALOG>
    <CD>
    <TITLE>Empire Burlesque</TITLE>
    <ARTIST>Bob Dylan</ARTIST>
    <COUNTRY>USA</COUNTRY>
    <COMPANY>Columbia</COMPANY>
    <PRICE>10.90</PRICE>
    <YEAR>1985</YEAR>
    </CD>
    <CD>
    <TITLE>Hide your heart</TITLE>
    <ARTIST>Bonnie Tyler</ARTIST>
    <COUNTRY>UK</COUNTRY>
    <COMPANY>CBS Records</COMPANY>
    <PRICE>9.90</PRICE>
    <YEAR>1988</YEAR>
    </CD>
    </CATALOG>
    and following java code:
    import oracle.jdbc.OraclePreparedStatement;
    import oracle.jdbc.OracleResultSet;
    import oracle.xdb.XMLType;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    public class Select {
    private static String SQL_1 = "SELECT OBJECT_VALUE FROM CATALOG";
    private static String SQL_2 = "SELECT extract(OBJECT_VALUE,'/CATALOG/CD/ARTIST') FROM CATALOG";
    public static void main(String[] args) throws SQLException {
    Connection conn = createConnection();
    OraclePreparedStatement stmt = (OraclePreparedStatement) conn.prepareStatement(SQL_1);
    OracleResultSet orset = (OracleResultSet)stmt.executeQuery();
    while (orset.next()) {
    // get the XMLType
    XMLType poxml = XMLType.createXML(orset.getOPAQUE(1));
    // get the XMLDocument as a string...
    System.out.println(poxml.getStringVal());
    conn.close();
    private static Connection createConnection() {
    try {
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection conn =
    DriverManager.getConnection("jdbc:oracle:thin:@hruby.marbes.cz:1521:oracle", "hruby", "password");
    return conn;
    } catch (SQLException e) {
    e.printStackTrace();
    return null;
    While executing SQL_1 statement everything goes well and I get whole document.
    While executing SQL_2 statement I get following exception:
    Exception in thread "main" java.sql.SQLException: Only LOB or String Storage is supported in Thin XMLType
         at oracle.xdb.XMLType.processThin(XMLType.java:2817)
         at oracle.xdb.XMLType.<init>(XMLType.java:1238)
         at oracle.xdb.XMLType.createXML(XMLType.java:698)
         at oracle.xdb.XMLType.createXML(XMLType.java:676)
         at Select.main(Select.java:27)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
    I expect to get such result:
    <ARTIST>Bob Dylan</ARTIST>
    <ARTIST>Bonnie Tyler</ARTIST>
    any suggestion???
    Thanks

    OBJECT_VALUE in this case refers to an XMLType datatype (fragment due to the use of "extract"). Convert it on "the fly" to a CLOB using getCLOBVal(). Then pick it up in java as a LOB.

  • How do I print part of a document, say a paragraph?

    I am a newcomer to Macdom, being ex-PC. Can anyone tell me how, in iWrite, I can print part of a document, say a paragraph. At present all I can do is print everything on the page, sometimes pages long.

    Some applications have a choice for this in the print window. For those applications that do no offer this option, I recommend using Print Selection available from http://www.schubert-it.com/free/
    Matt

  • JEditorPane: how to replace small parts of the document?

    Hi
    Im trying to create an application that will allow two people to type into two different JEditorPanes, but have the two people essentially editing the same document. So if one person types someting into thier frame, I want that modification sent to the other frame as well.
    The problem I've come across is how to make changes to the contents of the frame without interfering with the person whos trying to type into it. That problem boils down to how do you replace only a small part of the document whithout taking control of the users caret?

    Hopfully I got your problem right. To change only small parts of the EditorPane's document should not be the probelm you can get it with EditorPane.getDocument(). But I think you have to take control over the caret, because the when user 1 has finished editing and sends the doc to user 2 who is editing the doc, user 2's caret position will change because the document length has changed.
    The easiest way would be to add an input area (TextArea) for each user where they can type theit text and than to add the text into the document when they press enter, so you don't have the trouble with te caret position. If you don't want to do this then you could try that: the input of the users is cached while they are typing (not changing the doc) till they press enter. Then the doc is send to the other user, the users doc in the pane is updated and his current typing is added to the end of the new received doc. You can figure out the correct position by doc.getLength() and set the new caret position to doc.length + currentTyping.length
    Hope that helps
    Eryk

  • OSB: How to get stored in sbconsole xml document in message flow

    Hi
    I created a xml document (say ram.xml) as a XML document utility resource in OSB sbconsole.
    I want to refer this in message flow with fn:doc. Unlike xquery i can't assign ram.xml to a variable.
    I tried fn:doc("/home/osbuser/user_projects/domains/domain_name/osb/config/core/ram.xml") and fn:doc("file:////home/osbuser/user_projects/domains/domain_name/osb/config/core/ram.xml") it didn't work!
    I know if i store this xml as a xquery, it will get assigned to a variable. But i am just curious to see how fn:doc works!
    Any light !

    The reason for this is to eliminitate each assign action for each of XMLs that I use. Each assign gets converted into a xml bean and thats overhead.
    If this fn:doc() works, what i am planning is to use fn:doc() inside my xquery transformations directly, without using assign action to load XML.
    Also message flow will become somewhat cleaner.
    fn:doc() has to be used in a way that it uses relative path to access xml and not complete path (starting from /home/user_doamains/..) because development and production environment domain names are different. Using relative path, code can migrate without any change across environments.

  • How to declare the namespace of XML document to use in oracle DB?

    I have an XML Schema file( 'Hospital.xsd' ) that reference the XML document ('Hospitals.xml' ).
    That I use JDeveloper to build them up.
    JDeveloper had set the default namespace as 'http://www.example.org'
    like this :
    <?xml version="1.0" encoding="UTF-8" ?>
    <Hospitals xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.example.org src/Hospital.xsd"
    xmlns="http://www.example.org">
    If I want these two files ('Hospital.xsd' and 'Hospitals.xml') placed into
    the table in the oracle database.
    1. Should I create two tables? one for XSD and another for XML.
    2. Should I keep the XSD file in the oracle database?
    3. What is the namespace to declare in the heading of XML file?
    The database name or my website URL?
    Thank you very much.
    Kanokporn P.

    Sounds a lot like this question, only with less details.
    how to read data from XML  variable and insert into table variable
    We can only help if you provide us details to help as we cannot see what you are doing and only know what you tell us.  Plenty of examples abound on the forums that cover the topics you seek as well.

  • How to use OAF transform sotred xml documents using XSLT...

    Does anyone have any experience using XSLT in OAF? Specifically, I have xml documents stored in a clob to which I wish to apply an XSLT transformation and then store the transformed documents back into the clob. Is there a way to apply an XSLT transformation using say BI-Publisher via OAF?

    "XML DIFF" are the keywords you can use to search for products that do this. Last time I looked there was a lot of XML Diff implementations, but none of them produced human-readable output that I really liked. I expect that's because XML diff is an easy thing for people to ask for but not an easy thing to do, given the considerable number of ways there are to change a document.

  • How to use NodeIterator on an XML document

    I have been trying to create a NodeIterator using the following code:
    try
    FileInputStream inStream;
    Document doc;
    String xmlDocumentPath = "I have a real path here";
    inStream = new FileInputStream(xmlDocumentPath);
    DOMParser parser = new DOMParser();
    parser.parse(inStream);
    doc = parser.getDocument();
    Node root = doc.getDocumentElement();
    formInputFilter filter = new formInputFilter();
    DocumentTraversal traverse = (DocumentTraversal)doc;
    NodeIterator iter = traverse.createNodeIterator(root, NodeFilter.SHOW_ALL, filter, true);
    Node n = (Node)iter.nextNode();
    while (n != null)
    System.out.println(n.getNodeName());
    catch (Exception e)
    System.out.println(e.toString());
    When the nextNode method is executed I get an NPE. Looking in the iterator it shows the value of next as null when it is created. I have found a couple of code sources that all show this as the correct way to create a NodeIterator and I can't figure out what I am doing wrong. I have tried creating it with and without my filter and I still have the same problem. I had other code that could loop through the XML file that worked but the NodeIterator would be much simpler to use. Anyone have a suggestion.

    Using JDev 9.0.3.1, and with a C:\temp\test.xml file setup ahead of time, running the following program works for me just fine. How is yours different?
    package test;
    import java.io.FileInputStream;
    import oracle.xml.parser.v2.DOMParser;
    import org.w3c.dom.Document;
    import org.w3c.dom.Node;
    import org.w3c.dom.traversal.DocumentTraversal;
    import org.w3c.dom.traversal.NodeFilter;
    import org.w3c.dom.traversal.NodeIterator;
    public class Test {
      public static void main(String[] args) throws Throwable {
        Test t = new Test();
        t.test();
      void test() throws Throwable {
        String xmlDocumentPath = "c:\\temp\\test.xml";
        FileInputStream inStream = new FileInputStream(xmlDocumentPath);
        DOMParser parser = new DOMParser();
        parser.parse(inStream);
        Document doc = parser.getDocument();
        Node root = doc.getDocumentElement();
        MyNodeFilter filter = new MyNodeFilter();
        DocumentTraversal traverse = (DocumentTraversal)doc;
        NodeIterator iter = traverse.createNodeIterator(root, NodeFilter.SHOW_ALL, filter, true);
        Node n = null;
        while ((n = (Node)iter.nextNode()) != null) {
          System.out.println(n.getNodeName());
      class MyNodeFilter implements NodeFilter {
        public short acceptNode(Node n){
          return FILTER_ACCEPT;
    }

  • How to retrieve data from this XML

    Hi
    I am getting below XML file and I need to get data from the file into table in a database ( SQL SERVER ). Please kindly help to shred and load the data into a table 
    <claimInvoice xmlns="http://www.XYZ.com">
      <INum>INum1</INum>
      <dueAmount xmlns="">1</dueAmount>
      <Billadd xmlns="">Billadd1</Billadd>
      <remittance xmlns="">
        <RemCom>RemCom1</RemCom>
      </remittance>
      <summary xmlns="">
        <title>title1</title>   
        <accountAging>
              <totalDue>1</totalDue>
        </accountAging>
    </summary>
    </claimInvoice>
    How Can i get  data for the following :
    INum,
    dueDate,
    Billadd,
    RemCom,
    title,
    totalDue
    Thanks
    Kodi

    see illustration below
    declare @x xml='<claimInvoice xmlns="http://www.XYZ.com">
    <INum>INum1</INum>
    <dueAmount xmlns="">1</dueAmount>
    <Billadd xmlns="">Billadd1</Billadd>
    <remittance xmlns="">
    <RemCom>RemCom1</RemCom>
    </remittance>
    <summary xmlns="">
    <title>title1</title>
    <accountAging>
    <totalDue>1</totalDue>
    </accountAging>
    </summary>
    </claimInvoice>'
    ;WITH XMLNAMESPACES ('http://www.XYZ.com' AS def)
    SELECT t.u.value('def:INum[1]','varchar(50)') AS INum,
    t.u.value('dueAmount[1]','int') AS dueAmount,
    t.u.value('Billadd[1]','varchar(10)') AS Billadd,
    t.u.value('(remittance/RemCom)[1]','varchar(50)') AS RemCom,
    t.u.value('(summary/title)[1]','varchar(50)') AS title,
    t.u.value('(summary/accountAging/totalDue)[1]','int') AS totalDue
    FROM @x.nodes('/def:claimInvoice')t(u)
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How to retrieve value from AIAInstallProperties.xml in AIA Flow.

    After PIP Developement, Installer team will build the OUI installer for the PIP.They will build the screens for our PIP based on the requirements we give them.We give them a list of properties that we need the installer to prompt for and then the installer will store the values entered by the user in AIAInstallProperties.xml file.When the code is written, these properties are used instead of hardcoding any machine names, usernames, passwords, etc. When the services are deployed the properties are replaced with the values in AIAInstallProperties.xml.
    How to retreive those values from AIAInstallProperties.xml file to your participating applications or any adapters in your code?
    When the services are deployed how the properties are getting replaced with the values in AIAInstallProperties.xml.?
    Can anyone explain the above two flow.
    Thanks in advance.

    Hi
    Prem Edwin's posting about AIAInstallProperties.xml is correct.
    Two points, the 11gR1 is a foundation pack only release, that is why the OUI is only built to collect FP related information. In the future, when PIPs arrive, new wizard steps will involve to collect PIP specific information during installation/deployment time.
    For your example of of getting a file location during installation, it would be effectively for your self-built PIPs. That is why the 11gR1 FP OUI would not support that.
    Also, there are only finite number of tokens can be detokenized from AIAInstallProperties.xml to composite.xml, if you were introducing a random new 'file path', I don't believe it would be replaced automatically by default in R1 time.
    Thanks!

  • How to support chinese gb2312 in XML Document?

    the Doc of oracle xml parser said as below,where to get the doc ? Please help me.
    ========================================
    The parser currently supports the following encodings: UTF-8, UTF-16, US-ASCII, ISO-10646-UCS-2, ISO-8859-1, ISO-8859-2, ISO-8859-3, ISO-8859-4, ISO-8859-5, ISO-8859-6, ISO-8859-7, ISO-8859-8, ISO-8859-9, EUC-JP, SHIFT_JIS, BIG5, GB2312, KOI8-R, EBCDIC-CP-US, EBCDIC-CP-CA, EBCDIC-CP-NL, EBCDIC-CP-WT, EBCDIC-CP-DK, EBCDIC-CP-NO, EBCDIC-CP-FI, EBCDIC-CP-SE, EBCDIC-CP-IT, EBCDIC-CP-ES, EBCDIC-CP-GB, EBCDIC-CP-FR, EBCDIC-CP-HE, EBCDIC-CP-BE, EBCDIC-CP-CH, EBCDIC-CP-ROECE, EBCDIC-CP-YU, and EBCDIC-CP-IS. In addition, any character set specified in Appendix A, Character Sets, of the Oracle National Language Support Guide may be used.
    In order to be able to use these encodings, you must have the ORACLE_HOME environment variable set and pointing to the location of your Oracle installation. In addition, the environment variables ORA_NLS, ORA_NLS32, and ORA_NLS33 must be set to point to the location of the NLS data files. On Unix systems, this is usually $ORACLE_HOME/ocommon/nls/admin/data. On Windows NT, this is usually $ORACLE_HOME/nlsrtl/admin/nlsdata.
    null

    I mean how to get the file : $ORACLE_HOME/ocommon/nls/admin/data or $ORACLE_HOME/nlsrtl/admin/nlsdata
    null

  • How to set only part of the document as "read-only"?

    Hi,
    I am using SharePoint 2010. I would like to set some of the columns as "read-only" while some of them are still editable. If I use Advanced Settigns>Item-Level Permissions, I can only set the whole document as "read-only".
    Is there a way I can do what I wannt?
    Thanks a lot!

    Hi,
     There is no OOTB way to set a column as read-only.  I think you want to make some of the fields as Read-Only in the EditForm.aspx. If so, then you can use the Javascript to do. 
    Add a Content editor webpart to the Editform.aspx page and place the javascript method to make a field read-only.
    You can use the _spBodyOnLoadFunctionNames.push("MakeReadOnly()") method to assocaite your method to the EditForm.
    Here are the links which will help you.
    http://dishasharepointworld.blogspot.in/2011/08/read-only-field-in-sharepoint.html
    http://nishantrana.wordpress.com/2009/01/30/read-only-field-in-sharepoint-editformaspx/
    http://www.jbmurphy.com/2010/06/01/how-to-make-a-field-in-a-sharepoint-edit-form-readonly/
    *******Don't forgot to MARK AS ANSWER / VOTE AS HELPFUL if it really helps************
    R.Mani http://rmanimaran.wordpress.com

Maybe you are looking for

  • How do I save .ai as .dwg as 1:1?

    This should be so easy but it ain't working for me! Original size of my pattern in AI (version CS6) is 800 x 600mm but after saving and viewing it in DWG, the size is 20304.195 x 15239.734mm. The Save As command (when saving it as dwg) gives one the

  • Printing error after securing documents

    Hi - I'm wondering if anyone else has come across the problem I'm having printing large PDF files (>300 pages) after they have been secured.  When the document is sent to the printer I get an error part way through the spooling such as 'insufficient

  • Duplicate albums in music app...

    After updating to ios5 on my iphone4 there are random duplicate albums. I have done a restore and that didnt fix it...any help?

  • Check Entry in Action Matrix

    Sap documentation about this field is very poor, does anybody know what it is for? Definition Controls whether the status of an entry in the Action Matrix is to be checked or not. Use If you select this field, the system checks whether a required sta

  • Address Book Keeps Crashing

    Hi, Every time I open the address book, the application crashes with the following message.  Any ideas? Process:         Address Book [31187] Path:            /Applications/Address Book.app/Contents/MacOS/Address Book Identifier:      com.apple.Addre