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

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

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

  • 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 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 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 append nodes to the xml document

    hi
    when i run the servlet program i want to append nodes to existing to nodes;but actually it is overwriting the nodes;what changes should i made to get desired output
    package example;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.PrintWriter;
    import java.io.IOException;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerException;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import javax.xml.transform.*;
    import java.io.FileReader;
    import java.io.FileWriter;
    import java.io.StringWriter;
    import java.io.IOException;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Text;
    public class XMLController extends HttpServlet
    private static final String CONTENT_TYPE = "text/html; charset=windows-1252";
    public void init(ServletConfig config) throws ServletException
    super.init(config);
    public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException {
    String fname="name.xml";
    DocumentBuilderFactory fac = DocumentBuilderFactory.newInstance();
    try {
    DocumentBuilder db = fac.newDocumentBuilder();
    Document doc = db.newDocument();
    Element rt = doc.createElement("India");
                   Element main1 = doc.createElement("IndianPlayer");
                   Element productnames1 = doc.createElement("Name");
                   Text product1 = doc.createTextNode(request.getParameter("name1"));
                   Element price1 = doc.createElement("Age");
                   Text priceValues1 = doc.createTextNode(request.getParameter("age1"));
                   productnames1.appendChild(product1);
                   price1.appendChild(priceValues1);
                   main1.appendChild(productnames1);
                   main1.appendChild(price1);
                   rt.appendChild(main1);
         doc.appendChild(rt);
    saveDocAsFile(doc,fname);
    catch (ParserConfigurationException e) {
    e.printStackTrace();
    public static void saveDocAsFile(Document doc, String fname) {
    try {
    TransformerFactory tfFac = TransformerFactory.newInstance();
    // use null trandformation
    Transformer tf = tfFac.newTransformer();
    tf.setOutputProperty(OutputKeys.INDENT,"yes");
    tf.transform(new DOMSource(doc), new StreamResult(fname));
    /* catch (IOException ioe) {
    ioe.printStackTrace();
    catch (TransformerException e) {
    e.printStackTrace();
    bye
    chaitanya

    Adding a Node to a DOM Document
    http://javaalmanac.com/egs/org.w3c.dom/AddNode.html

  • How to parse an XML document with oracle8i

    Has anyone a good link or an example how to decode and store an XML document into an oracle8i database.
    I' ve found only good things for oracle9i.
    Thank you
    Roger

    Here is an example of parsing xml taken fro Oracle8i 8.1.7 xdk.
    This one uses external OS files to pase, but could be easily converted to
    use CLOB or VARCHAR2 string for parsing XML documents.
    IF you wanted to use CLOB to store and manipulate xml documents you can use XMLParser and XMLDom
    packages along with the DBMS_LOB package to do that.
    -- This file demonstates a simple use of the parser and DOM API.
    -- The XML file that is given to the application is parsed and the
    -- elements and attributes in the document are printed.
    -- The use of setting the parser options is demonstrated.
    set serveroutput on;
    create or replace procedure domsample(dir varchar2, inpfile varchar2,
    errfile varchar2) is
    p xmlparser.parser;
    doc xmldom.DOMDocument;
    -- prints elements in a document
    procedure printElements(doc xmldom.DOMDocument) is
    nl xmldom.DOMNodeList;
    len number;
    n xmldom.DOMNode;
    begin
    -- get all elements
    nl := xmldom.getElementsByTagName(doc, '*');
    len := xmldom.getLength(nl);
    -- loop through elements
    for i in 0..len-1 loop
    n := xmldom.item(nl, i);
    dbms_output.put(xmldom.getNodeName(n) || ' ');
    end loop;
    dbms_output.put_line('');
    end printElements;
    -- prints the attributes of each element in a document
    procedure printElementAttributes(doc xmldom.DOMDocument) is
    nl xmldom.DOMNodeList;
    len1 number;
    len2 number;
    n xmldom.DOMNode;
    e xmldom.DOMElement;
    nnm xmldom.DOMNamedNodeMap;
    attrname varchar2(100);
    attrval varchar2(100);
    begin
    -- get all elements
    nl := xmldom.getElementsByTagName(doc, '*');
    len1 := xmldom.getLength(nl);
    -- loop through elements
    for j in 0..len1-1 loop
    n := xmldom.item(nl, j);
    e := xmldom.makeElement(n);
    dbms_output.put_line(xmldom.getTagName(e) || ':');
    -- get all attributes of element
    nnm := xmldom.getAttributes(n);
    if (xmldom.isNull(nnm) = FALSE) then
    len2 := xmldom.getLength(nnm);
    -- loop through attributes
    for i in 0..len2-1 loop
    n := xmldom.item(nnm, i);
    attrname := xmldom.getNodeName(n);
    attrval := xmldom.getNodeValue(n);
    dbms_output.put(' ' || attrname || ' = ' || attrval);
    end loop;
    dbms_output.put_line('');
    end if;
    end loop;
    end printElementAttributes;
    begin
    -- new parser
    p := xmlparser.newParser;
    -- set some characteristics
    xmlparser.setValidationMode(p, FALSE);
    xmlparser.setErrorLog(p, dir || '/' || errfile);
    xmlparser.setBaseDir(p, dir);
    -- parse input file
    xmlparser.parse(p, dir || '/' || inpfile);
    -- get document
    doc := xmlparser.getDocument(p);
    -- Print document elements
    dbms_output.put('The elements are: ');
    printElements(doc);
    -- Print document element attributes
    dbms_output.put_line('The attributes of each element are: ');
    printElementAttributes(doc);
    -- deal with exceptions
    exception
    when xmldom.INDEX_SIZE_ERR then
    raise_application_error(-20120, 'Index Size error');
    when xmldom.DOMSTRING_SIZE_ERR then
    raise_application_error(-20120, 'String Size error');
    when xmldom.HIERARCHY_REQUEST_ERR then
    raise_application_error(-20120, 'Hierarchy request error');
    when xmldom.WRONG_DOCUMENT_ERR then
    raise_application_error(-20120, 'Wrong doc error');
    when xmldom.INVALID_CHARACTER_ERR then
    raise_application_error(-20120, 'Invalid Char error');
    when xmldom.NO_DATA_ALLOWED_ERR then
    raise_application_error(-20120, 'Nod data allowed error');
    when xmldom.NO_MODIFICATION_ALLOWED_ERR then
    raise_application_error(-20120, 'No mod allowed error');
    when xmldom.NOT_FOUND_ERR then
    raise_application_error(-20120, 'Not found error');
    when xmldom.NOT_SUPPORTED_ERR then
    raise_application_error(-20120, 'Not supported error');
    when xmldom.INUSE_ATTRIBUTE_ERR then
    raise_application_error(-20120, 'In use attr error');
    end domsample;
    show errors;

  • How to Find Number of Given Element in a XML Document

    Hello Experts,
    I want to know the number of given element in a XML document. For example if we have an employees information as a XML document, can we have how many <phone> element in the XML document?
    Thanks in advance.
    Regards,
    JP

    Hello,
    Once you've answered all the above.
    If you can run xpath that supports functions against the xml, the expression:
    count(//phone)Otherwise, without leaving SQL:
    select count(*) from
    xmltable('//phone' passing
      -- Your XML goes here, could be a table column with type XMLTYPE.
      xmltype('<person><phone>123-456-7890</phone><phone>098-765-4321</phone></person>')
      columns phone varchar2(24 char) path '/phone'
    ;

  • HOW TEXT CAN BE MADE SUBSCRIPTED IN XML DOCUMENT?

    SIR,
    I WANT TO DISPLAY MATHEMATICAL FORMULAS,WHICH INCLUDE MATHAMATICAL NOTATIONS LIKE "SIGMA" "DELTA" AND SO ON, AND ALSO SYMBOLS WITH SUBSCRIPTED TEXTS OR LETTERS,IN XML DOCUMENT.
    MY PROBLEM IS HOW CAN WE RENDER SUBSCRIPTED TEXTS IN XML DOCUMENT.
    FOR Eg.CONSIDER THE FORMULA SHOWN BELOW,IN HTML FORMAT.
    ÓAli * Bli / Cli
    PLEASE,TELL HOW THIS CAN BE REPRESENTED IN XML DOCUMENT.
    AND ALSO TELL ME HOW CAN A HORIZONTAL RULE BE DRAWN IN XML DOCUMENT
    THANK YOU.

    Ouch. Would you please not type in all capitals. It's hard to read.
    Anyway the question doesn't make sense. XML is just a format for storing and transmitting data. XML doesn't have the concepts of subscripting and drawing horizontal rules. Perhaps you were thinking of HTML?

  • UCCX 8 - Dramatic change in the Create File Document step that is used by the Create XML Document step in order to read an XML file

    /* Style Definitions */
    table.MsoNormalTable
    {mso-style-name:"Table Normal";
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-priority:99;
    mso-style-qformat:yes;
    mso-style-parent:"";
    mso-padding-alt:0in 5.4pt 0in 5.4pt;
    mso-para-margin:0in;
    mso-para-margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:11.0pt;
    font-family:"Calibri","sans-serif";
    mso-ascii-font-family:Calibri;
    mso-ascii-theme-font:minor-latin;
    mso-fareast-font-family:"Times New Roman";
    mso-fareast-theme-font:minor-fareast;
    mso-hansi-font-family:Calibri;
    mso-hansi-theme-font:minor-latin;
    mso-bidi-font-family:"Times New Roman";
    mso-bidi-theme-font:minor-bidi;}
    For the last 5 years (and in IPCC3.x/4.x,UCCX/5.x/7.x) I've used the same basic subflow to read a XML document that contains holiday dates where the queue should be closed.  I've re-used this script on 20+ client installs and it's always worked.  The structure of the script allows you to pass the path and filename of the XML document as parameters to the subflow. (The document is in the repository)
    I loaded this script in UCCX 8.0.2 recently and it crashed with a Java.IO error.  It looked like it was trying to read the file system directly and not the repository. (In the Linux appliance model this kind of makes sense but why is the step trying to read the file system directly?)
    So I open a TAC case (SR# 615243125) and TAC tells me that the method of using the Create File Document step is not supported anymore and that I should specify the filename directly in the Create XML Document step
    The problem that I see (aside from having to edit all my scripts that use XML files) is that the Create XML Document step is looking for the input to be a type DOCUMENT and not a type STRING.  This seems to imply that I have to hardcode the document in each script that I deploy for a customer.  When it was a string it was easy to construct the full file path from parameters and pass to the subflow.
    Questions to the group
    #1 Am I missing something here?
    #2  Do you assume that you'll be able to load a script that worked fine in UCCX 7 into UCCX 8 and that it should completely function when you're doing everything according to the step reference documentation.
    #3 Cisco didn’t document this in any way that I can find.
    #4 How can you use the Create XML Document step in a fashion that would let you construct the path of the file and the filename previously in the script so you could pass it to a subflow ?  It would seem this functionality has been killed in UCCX 8
    /* Style Definitions */
    table.MsoNormalTable
    {mso-style-name:"Table Normal";
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-priority:99;
    mso-style-qformat:yes;
    mso-style-parent:"";
    mso-padding-alt:0in 5.4pt 0in 5.4pt;
    mso-para-margin:0in;
    mso-para-margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:11.0pt;
    font-family:"Calibri","sans-serif";
    mso-ascii-font-family:Calibri;
    mso-ascii-theme-font:minor-latin;
    mso-fareast-font-family:"Times New Roman";
    mso-fareast-theme-font:minor-fareast;
    mso-hansi-font-family:Calibri;
    mso-hansi-theme-font:minor-latin;
    mso-bidi-font-family:"Times New Roman";
    mso-bidi-theme-font:minor-bidi;}
    (Background)
    Create File Document Step
    The input filename is a STRING, could be an explicit path and filename in the repository or a variable that represents that path and string
    The output of this step is a DOCUMENT to be used in the Create XML Document step
    The string FILE_FullPathHolidayFiles references  en_us\folderName\documentName.xml
    The document was properly uploaded into the repository only, NOT trying to directly read c:\foo\blah…
    /* Style Definitions */
    table.MsoNormalTable
    {mso-style-name:"Table Normal";
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-priority:99;
    mso-style-qformat:yes;
    mso-style-parent:"";
    mso-padding-alt:0in 5.4pt 0in 5.4pt;
    mso-para-margin:0in;
    mso-para-margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:11.0pt;
    font-family:"Calibri","sans-serif";
    mso-ascii-font-family:Calibri;
    mso-ascii-theme-font:minor-latin;
    mso-fareast-font-family:"Times New Roman";
    mso-fareast-theme-font:minor-fareast;
    mso-hansi-font-family:Calibri;
    mso-hansi-theme-font:minor-latin;
    mso-bidi-font-family:"Times New Roman";
    mso-bidi-theme-font:minor-bidi;}
    The create XML document input can only be a type DOCUMENT

    #1 Am I missing something here?
    You are mixing two different issues together here.
    The Create File Document step is indeed not needed or supported for creating an XML document. That is why there is a unique step; to trigger XML parsing within the MIVR subsystem.
    Accessing the file system is restricted to a single folder within the VOS model (i.e. 8.0+). This folder is not backed up, replicated, or cleaned up automatically. It was intended to give developers some FS access as a temporary swap location only.
    #2  Do you assume that you'll be able to load a script that
    worked fine in UCCX 7 into UCCX 8 and that it should completely
    function when you're doing everything according to the step reference
    documentation.
    Assume nothing; read the documentation and attend one of the dozens of partner training sessions that CCBU put on advising of the upcoming changes.
    #3 Cisco didn’t document this in any way that I can find.
    You're right, I guess, on the Create File vs. XML Document step. AFAIK Cisco never wrote a notice into the Step Reference Guide explicitly stating that you cannot use the Create File Document although the documentation seemed pretty clear to me without it. File system restrictions are documented in the 8.0 release notes.
    Scripting and Development Series: Volume 2, Editor Step ReferenceUse the Create XML Document step to create a logical document that maps a document to another document variable (where the document has already been pre-parsed as an XML document and is ready to be accessed by the Get XML Document Data step).Use this step before the Get XML Document Data step to obtain data from a document formatted using the Extensible Markup Language (XML).
    #4 How can you use the Create XML Document step in a fashion that would
    let you construct the path of the file and the filename previously in
    the script so you could pass it to a subflow ?  It would seem this functionality has been killed in UCCX 8
    No it hasn't; just concatinate a string to build the Source Document parameter the step needs. Example:  "DOC[" + myFilePath + "]"

  • About DBD XML physical storage xml document

    Recently I survey about BDB XML,
    and I want to know how is it to storage the XML document, what format?? is like Natix storage like in page file ?? So if there are not index can be utilize, the system will use tree travel method to get query answer.
    Or there are any document or technical manual support to introduction how DBD XML system internal storage format,how query process, how index build ....etc, because I ready some aboubt document but it major explain how to use the system (like API introduction).
    Thanks very much !!

    Hi Henry,
    The physical nodes store a large amount of information in a record, including it's node ID, it's parent's node ID, it's level in the tree and the node ID of it's last descendant.
    Ancestor-descendant relationships can be calculated using the node ID and last descendant ID as upper and lower bounds. Parent-child relationships additionally use the node level information. Sibling relationships need to use the parent's ID to check they have the same parent.
    Navigation, on the other hand, uses other node IDs stored in the physical node, or implicit information. For instance if a node has children, it's first child is always the next node record stored. The last child ID is stored in the physical node, since this cannot be similarly calculated, as are the next and previous sibling node IDs.
    If you are interested look in dbxml/src/dbxml/nodeStore/NsFormat.(hpp|cpp), which contains the marshaling code for the node storage format.
    John

  • Loading XML Document into DOM

    I know Safari 1.3 does not support loading of an XML Document, but does Safari 2 or 3 support the XML DOM? I will be really really really disappointed in apple if they still do not support the XML DOM for parsing with javascript. Why is Apple so negligent to Javascript?
    My XML doc loads fine in IE 5.5+ and FF1+ but I cannot get Safari clients to load the document. This is extremely detrimental to my site considering over 20% of the users are safari clients. I absolutely need this XML doc to be available to them.
    What is the safari specific javascript needed to load an XML document?
    Any help is GREATLY appreciated
    Mac OS X (10.4.8)

    Why does no one know the answer to this question? I've posted in every forum I could find.
    This procedure should be very standard and very easy. Much like it is in IE/FF. Why does no one know how to do it for Safari?

Maybe you are looking for