Reading XML using SQL

Hi,
Please could someone help me how to query an XML data (stored in oracle) using SQL.
My Table Name is ACCOUNT_SNAPSHOT
Column Name in which XML is stored: ACCOUNT_INFO
Here is the XML stored in ACCOUNT_INFO:
<PROPERTIES>
<PROPERTY name="AccountNumber" type="java.lang.String" value="222222222" />
<PROPERTY name="UserId" type="java.lang.String" value="Test001" />
<PROPERTY name="SecQuesId" type="java.lang.Integer" value="91" />
<PROPERTY name="CreatedDate" type="java.util.Date" value="1195851922000" />
<PROPERTY name="CreatedBy" type="java.lang.String" value="Admin" />
<PROPERTY name="AccountType" type="java.lang.String" value="Savings" />
</PROPERTIES>
I would like to retrieve all the records from table where AccountType in the XML is 'Savings' and CreatedDate is between two dates. How do i do this?
Thanks

Look at the XML Extract function...
Examples can be found in the documentation as well as on the forum...
http://forums.oracle.com/forums/search.jspa?threadID=&q=XML+Extract&objID=f75&dateRange=all&userID=&numResults=30
Also consider asking in the XML DB FAQ

Similar Messages

  • Read XML using DB Link

    Gurus,
    Is it possible to read/write XML using DB Link?
    If yes please let me know how to achieve this.
    Thanks in Advance.
    Venu

    You need to use quoted names. SQL Server data dictionary stores names in same case they were entered while Oracle in upper case. So when you issue
    Select test.status from testtable@DBLINK test Oracle parser will look for column STATUS while on SQL Server side it could be stored, for examle, as Status or status. Check column names on SQL Server side and use quoted names. Assuming column name is Status:
    Select test."Status" from testtable@DBLINK test SY.

  • Importing/Parsing XML using SQL and/or PL/SQL

    What is the recomended way of importing/parsing XML data using SQL and/or PL/SQL?
    I have an XSD that defines the structure of the file, and an XML file that has the content in the appropriate structure. I have parsed (checked) the structure of the XML file using JDOM in my java application, and then passed it to a function in a package on the database as a CLOB.
    What I need to do is parse the contents of the XML file that is passed into the function and extract the values of each XML element so that I can then do some appropriate validation before inserting and committing the data to the database (hence completing the import function).
    A DBA colleague of mine has been experimenting with various ways of acheiving this, but has encountered a number of problems along the way, one of which being that he thinks that it is not possible to parse XML elements that are nested more than four levels deep - is this the case?
    The structure of the XSD/XML that the database function needs to manipulate and import data from is very complex (and recursive by it's nature).
    I would appreciate any suggestions as to how I can achieve the above in the most efficient manner.
    Thanks in advance for your help
    David

    This is the forum for the SQLDeveloper tool. You will get better answers in the SQL and PL/SQL forum, and especially the XML DB forum.
    Oracle has comprehensive and varied support for XML, including a PL/SQL parser.

  • Getting error in Mozilla, reading xml using JavaScript

    Hi All,
    I am working with javascript with xml, getting error in Mozilla
    1. see html and xml file and check xml file path before test ---
    2. please, go through the html and xml file.
    read_xml.html
    =================
    <html>
    <head>
    <title>xml file using javascript</title>
    <script type="text/javascript">
    var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    //loading xml file
    function doLoadXML(xmlFile)
    xmlDoc.async="false";
    xmlDoc.onreadystatechange=doStateVerify;
    xmlDoc.load(xmlFile);
    rootData=xmlDoc.documentElement;
    function doStateVerify()
    if (xmlDoc.readyState != 4)
    return false;
    // reading xml file
    function doReadXML()
    alert("calling function");
    doLoadXML("C:/Documents and Settings/webdeveloper06/Desktop/for_test/comp-info.xml");
    alert("loading file...........");
    var dataArr=new Array();
    dataArr=xmlDoc.getElementsByTagName("comp-info");
    for(var m=0; m <= dataArr.length-1; m++)
              alert("entering inside looping here");
              document.write("<Table border='1px'><tr><td>");     
              document.write(dataArr[m].getElementsByTagName("name")[0].firstChild.nodeValue);
              document.write(dataArr[m].getElementsByTagName("description")[0].firstChild.nodeValue);
              document.write(dataArr[m].getElementsByTagName("web-addr")[0].firstChild.nodeValue);
              document.write(dataArr[m].getElementsByTagName("address")[0].firstChild.nodeValue);
              document.write(dataArr[m].getElementsByTagName("city")[0].firstChild.nodeValue);
              document.write(dataArr[m].getElementsByTagName("postal-code")[0].firstChild.nodeValue);
              document.write(dataArr[m].getElementsByTagName("country")[0].firstChild.nodeValue);
              document.write("</input></td></tr></table>");
    </script>
    </head>
    <body>
    <input type="button" value="Display XML Data" onClick="doReadXML()" />
    </body>
    </html>
    com-info.xml
    =========
    <?xml version="1.0" encoding="iso-8859-1"?>
    <itcopany>
    <comp-info>
    <name>xxx</name>
    <description>IT Reaserch Company</description>
    <web-addr>http://xxx.com</web-addr>
    <address>mehdipatnam</address>
    <city>Hyderabad</city>
    <postal-code>777888888</postal-code>
    <country>IN</country>
    </comp-info>
    <comp-info>
    <name>yyyyy </name>
    <description>Non IT Company</description>
    <web-addr>http://yyyy.com</web-addr>
    <address>xyxxyxyx</address>
    <city>Banglore</city>
    <postal-code>78878787878</postal-code>
    <country>IN</country>
    </comp-info>
    <comp-info>
    <name>zzzzzzz</name>
    <description>IT Company</description>
    <web-addr>http://zzzzzzz.com</web-addr>
    <address>secondrabad</address>
    <city>Hyderabad</city>
    <postal-code>9999999999999</postal-code>
    <country>IN</country>
    </comp-info>
    </itcopany>
    output status
    ============
    1. getting output in IE
    2. not getting output in Mozilla
    Can anyone Helpout, To get data in Mozilla
    regards,
    Abu

    Try to check this document Browser Support for SAP and use PAM (Product Availability Matrix) to check for the compatibility of your SAP system with the browser.
    If you are only the user of the Web Dynpro you would have probably no other choice than change the browser.

  • Reading XML using Java

    I want to read all <temp >nodes map them to some variable and create one more XML.
    I am stuck up in the first place itself where i need to read the data :( . I am getting null pointer exception, please find the code also.
    <?xml version="1.0" encoding="UTF-8"?>
    <ftpl id="47" name="XXXXXXXX xxx xxxxxxxx">
    <abc-cab name="Systems" id="43434">
    <abc-dr name="zzzzz" id="4545454">
    <temp key="Type">null</param>
    <temp key="Folder">/ZVZ/XXXXX - xyz</param>
    <temp key="Author">XYZ,ABC</param>
    <temp key="Comments">null</param>
    <temp key="Mailed_By">XYZ,ABC</param>
    <temp key="Subject">null</param>
    <temp key="Key_Words">null</param>
    <abc-page name="1" id="3524012">
    <file text="/asas/asasa/asa/asas/Oxxxxxx2276744.txt" count="1"/>
    </abc-page>
    </abc-dr>
    </abc-cab>
    </ftpl>
    try {
    File file = new File("source-file");
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = dbf.newDocumentBuilder();
    Document doc = db.parse(file);
    doc.getDocumentElement().normalize();
    System.out.println("Root element " + doc.getDocumentElement().getNodeName());
    NodeList nodeLst = doc.getElementsByTagName("abc-dr");
    for (int s = 0; s < nodeLst.getLength(); s++) {
    Node fstNode = nodeLst.item(s);
    if (fstNode.getNodeType() == Node.ELEMENT_NODE) {
    Element fstElmnt = (Element) fstNode;
    NodeList fstNmElmntLst = fstElmnt.getElementsByTagName("abc-dr");
    Element fstNmElmnt = (Element) fstNmElmntLst.item(1);
    NodeList fstNm = fstNmElmnt.getChildNodes();
    System.out.println("First Node : " + ((Node) fstNm.item(1)).getNodeValue());
    NodeList lstNmElmntLst = fstElmnt.getElementsByTagName("Folder");
    Element lstNmElmnt = (Element) lstNmElmntLst.item(0);
    NodeList lstNm = lstNmElmnt.getChildNodes();
    } catch (Exception e) {
    e.printStackTrace();
    Please help.. let me know the code which read XML I have tried with all SAX/DOM i am getting same NUllPointerExcetion
    Message was edited by:
    JavaNewUser

    Hi
    Thanks patricknz
    pls find the XMl and the java code
    I have again modified the code .. but got the same result as below
    [temp: null]----------------------param =
    [temp: null]----------------------param =
    [temp: null]----------------------param =
    [temp: null]----------------------param =
    [temp: null]----------------------param =
    [temp: null]----------------------param =
    [temp: null]----------------------param =
    [abc-page: null]----------------------abc-page=
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import org.w3c.dom.Document;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.w3c.dom.Element;
    import java.lang.*;
    public class SampleDOM
        public static void main(String s[]){
            try{
                DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
                Document document = docBuilder.parse("C:\\demo.xml");
                   NodeList nodeList = document.getElementsByTagName("abc-dr");
          for (int i = 0, length1 = nodeList.getLength(); i < length1; i++) {
            final Element rDoc = (Element)nodeList.item(i);
            final NodeList rDocC = rDoc.getChildNodes();
            for (int j = 0, length2 = rDocC.getLength(); j < length2; j++) {
              final Node child = rDocC.item(j);
            if (child.getNodeType() == Node.ELEMENT_NODE) {
                Element element = (Element)child;
                System.out.println(element.getChildNodes() + "----------------------" +
                                          new StringBuffer(element.getNodeName()).append(" = "));
            }catch(Exception e){
                e.printStackTrace();
    }XML FIle:-
    <?xml version="1.0" encoding="UTF-8"?>
    <ftpl id="47" name="XXXXXXXX xxx xxxxxxxx">
         <abc-cab name="Systems" id="43434">
              <abc-dr name="zzzzz" id="4545454">
                   <temp key="Type">null</param>
                   <temp key="Folder">/ZVZ/XXXXX - xyz</param>
                   <temp key="Author">XYZ,ABC</param>
                   <temp key="Comments">null</param>
                   <temp key="Mailed_By">XYZ,ABC</param>
                   <temp key="Subject">null</param>
                   <temp key="Key_Words">null</param>
                   <abc-page name="1" id="3524012">
                        <file text="/asas/asasa/asa/asas/Oxxxxxx2276744.txt" count="1"/>
                   </abc-page>
              </abc-dr>
         </abc-cab>
    </ftpl>Message was edited by:
    JavaNewUser
    Message was edited by:
    JavaNewUser

  • Read xml from SQL Server

    Hello
    I need to read a xml from a sql server 2000 database. The field in the database is declare as text.
    When a try to read <a>3</a> the database adapter returns something like this.
    /a/3//a/.
    How do I solve the problem?
    Thanks
    Gonçalo Ribeiro

    Hello again.
    I'm using ora:parseEscapedXML to convert the string that contains XML into XML.
    I'm doing it in an assign. My doubt is what kind of variable should received the information?
    Thanks
    Gonçalo Ribeiro

  • Need help with reading XML using File Adapter

    I have created a simple BPEL process that uses a file adapter to read files containing XML messages of a simple xsd schema. But when reading the xml, I get the following error message:
    [2010/03/01 23:43:13] Invalid data: The value for variable "Receive_1_Read_InputVariable", part "revision-report" does not match the schema definition for this part.The invalid xml document is shown below: More...
    [2010/03/01 23:43:13] "{http://schemas.oracle.com/bpel/extension}invalidVariables" has been thrown. less
    -<invalidVariables xmlns="http://schemas.oracle.com/bpel/extension">
    -<part name="code">
    <code>
    9710
    </code>
    </part>
    -<part name="summary">
    <summary>
    Invalid xml document.
    According to the xml schemas, the xml document is invalid. The reason is: Error::cvc-complex-type.4: Attribute 'doc' must appear on element 'revision-report'.
    Error::cvc-complex-type.4: Attribute 'model' must appear on element 'revision-report'.
    Error::cvc-complex-type.4: Attribute 'pubdate' must appear on element 'revision-report'.
    Error::cvc-complex-type.2.4.b: The content of element 'revision-report' is not complete. One of '{"http://xmlns.oracle.com/xmlfile":alternategroup}' is expected.
    Please make sure that the xml document is valid against your schemas.
    </summary>
    </part>
    </invalidVariables>
    It seems that there is some issue with the namespace, but even after trying out various combinations, I am not able to resolve this.
    Here the message schema (xsd):
    <?xml version="1.0" encoding="UTF-8" ?>
    <xs:schema elementFormDefault="qualified"
    targetNamespace="http://xmlns.oracle.com/xmlfile"
    xmlns:tns="http://xmlns.oracle.com/xmlfile"
    xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="revision-report">
    <xs:complexType>
    <xs:sequence maxOccurs="unbounded">
    <xs:element name="alternategroup">
    <xs:complexType>
    <xs:attribute name="name" use="required" type="xs:string"/>
    <xs:attribute name="Desc" use="required" type="xs:string"/>
    </xs:complexType>
    </xs:element>
    </xs:sequence>
    <xs:attribute name="doc" use="required" type="xs:string"/>
    <xs:attribute name="model" use="required" type="xs:string"/>
    <xs:attribute name="pubdate" use="required" type="xs:string"/>
    </xs:complexType>
    </xs:element>
    </xs:schema>
    And here is the xml file to be read by the file adapter:
    <?xml version="1.0" encoding="UTF-8" ?>
    <revision-report doc="doc2" model="model4" pubdate="pubdate5">
    <alternategroup Name="ABC" Desc="ABC-Desc">
    </alternategroup>
    <alternategroup Name="DEF" Desc="DEF-Desc">
    </alternategroup>
    <alternategroup Name="GHI" Desc="GHI-Desc">
    </alternategroup>
    </revision-report>
    Appreciate any help.
    Thanks in advance for your attention.
    Jay

    Thanks for your response.
    I am not sure if there is any easier way, but I tried out the following tool available on the net to check an xml against a xsd:
    http://tools.decisionsoft.com/schemaValidate/
    There were a few issues, that I corrected and finally had a xsd and xml that were matching and valid. I tried this out in my file reading BPEL process, but the error still remained the same!
    Here is my updated/simplified xsd and xml:
    <?xml version="1.0" encoding="UTF-8" ?>
    <xs:schema targetNamespace="http://xmlns.oracle.com/xmlfile"
    xmlns:tns="http://xmlns.oracle.com/xmlfile"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns="http://xmlns.oracle.com/xmlfile">
    <xs:element name="revision-report">
    <xs:complexType>
    <xs:sequence>
    <xs:element maxOccurs="unbounded" ref="alternategroup"/>
    </xs:sequence>
    <xs:attribute name="doc" use="required" type="xs:string"/>
    <xs:attribute name="model" use="required" type="xs:string"/>
    <xs:attribute name="pubdate" use="required" type="xs:string"/>
    </xs:complexType>
    </xs:element>
    <xs:element name="alternategroup">
    <xs:complexType>
    <xs:attribute name="Name" use="required" type="xs:string"/>
    <xs:attribute name="Desc" use="required" type="xs:string"/>
    </xs:complexType>
    </xs:element>
    </xs:schema>
    <?xml version="1.0" encoding="UTF-8" ?>
    <revision-report doc="doc2" model="model4" pubdate="pubdate5" xmlns="http://xmlns.oracle.com/xmlfile">
    <alternategroup Name="ABC" Desc="ABC-Desc"/>
    <alternategroup Name="DEF" Desc="DEF-Desc"/>
    <alternategroup Name="GHI" Desc="GHI-Desc"/>
    </revision-report>
    I even tried the option that is available in JDeveloper to generate a sample xml from a xsd (when in the context of a Transformation activity). The xml generated by this also seems exactly like the one above.
    So, I am not able to figure out why my BPEL process errors out with the message Invalid xml document.

  • How to read XML using vbscript

    hi friends I have A big XML having following format :
    <ECSC>
    <ATTRIBUTES>
    <ETTOOLNAME>ECATT</ETTOOLNAME>
    <ETOBJ_GNDT>
    <VERSION>00000001</VERSION>
    <TWB_TITLE>TF_FI_FP_FI_0569_MS07_CO_Search_Help_Internal_Orders_vTD0_1_EN.x</TWB_TITLE>
    <TWB_STATUS>X</TWB_STATUS>
    <TWB_RELE>N</TWB_RELE>
    <FUSER>ECATT</FUSER>
    <FDATE>2014-05-22</FDATE>
    <LUSER>ECATT</LUSER>
    <LDATE>2014-05-22</LDATE>
    <LTIME>13:59:50</LTIME>
    </ETOBJ_GNDT>
    <ETOBJNOVER>
    <NAME>ZX_FI_FP_0569_MS07_COAS_FB01</NAME>
    <TYPE>ECSC</TYPE>
    <TWB_RESP>ECATT</TWB_RESP>
    <TWB_DISTL>B</TWB_DISTL>
    <DEVCLASS>Z_SOL_ONEERP</DEVCLASS>
    <MASTERLANG>E</MASTERLANG>
    <TADIR_RESP>ECATT</TADIR_RESP>
    <FRANGE>BC</FRANGE>
    </ETOBJNOVER>
    <ETOBJ_DOC>
    <SEARCH_1>FI_FP_FI_0569_MS07</SEARCH_1>
    <SEARCH_2>COAS</SEARCH_2>
    <SEARCH_3>KO03</SEARCH_3>
    </ETOBJ_DOC>
    <ETOBJ_CNST>
    <TWB_WKREQ>0.000</TWB_WKREQ>
    <TWB_PRIO>3</TWB_PRIO>
    </ETOBJ_CNST>
    <ETSC_TSYS>
    <SYSTEMDATA>Z_SD_1ERP_Z</SYSTEMDATA>
    <TESTSYSTEM>FI_TRUSTED_EN</TESTSYSTEM>
    </ETSC_TSYS>
    <ETSYS_COMP_TABTYPE/>
    <ETSYS_REL_TABTYPE/>
    </ATTRIBUTES>
    <SCRIPT>
    <ETXML_LINE_TABTYPE>
    <item>***********************************************************************.</item>
    <item>* Information.</item>
    <item>**********************************************************************.</item>
    <item>* Script for test case 'TF_FI_FP_FI_0569_MS07_CO_Search_Help_Internal_Orders_vTD0_1_EN.x'</item>
    <item>*</item>
    <item>* For Sub script:</item>
    <item>*  'Test case 3: Choose an Internal Order in One.Fi using external order number while transaction posting (positive case)'.</item>
    <item>*</item>
    <item>* Script is to Display Internal Order using external order number while Transaction Posting 'FB01'</item>
    <item>* GETTAB command is being used to fetch the data from table 'COAS'.</item>
    <item>*</item>
    <item>*</item>
    <item>*     Test data related Information</item>
    <item>*     -----------------------------</item>
    <item>* Default test data present in parameter list has been used while Scripting ( script recording &amp; Performing Checks ).</item>
    <item>*</item>
    <item>* Final execution of result log: 0000037077.</item>
    <item>*</item>
    <item>***********************************************************************.</item>
    <item>* Preparation.</item>
    <item>***********************************************************************.</item>
    <item/>
    <item/>
    <item>***********************************************************************.</item>
    <item>* End Preparation.</item>
    <item>************************************************************************.</item>
    <item/>
    <item/>
    <item>***********************************************************************.</item>
    <item>* Execution.</item>
    <item>***********************************************************************.</item>
    <item>* To get the 'Table Entries' from table 'COAS'.</item>
    <item>  GETTAB ( COAS , COAS_1 ).</item>
    <item>* To display the value for the field 'External Order No'.</item>
    <item>  LOG ( V_EXTERNAL_ORDER_NO_FRM_TABL ).</item>
    <item/>
    <item>*----------------------Posting(FB01)-------------------------------------------*.</item>
    <item/>
    <item>* This part of Script is to Display Internal Order using external order number while Transaction Posting 'FB01'.</item>
    <item>MESSAGE ( MSG_1 ).</item>
    <item>* To get the name of the Title Screen.</item>
    <item>  GETGUI ( FB01_100_STEP_1 ).</item>
    <item>* Enter the Required details and Press Enter.</item>
    <item>  SAPGUI ( FB01_100_STEP_2 ).</item>
    <item>* Enter Amount and Tax Code.</item>
    <item>* and, Press F4 help in the Order Field.</item>
    <item>  SAPGUI ( FB01_300_STEP_1 ).</item>
    <item>* In F4 screen, enter the 'External Order Number'</item>
    <item>* pop-up screen is displayed with entries like Order, Description and External Order Number and select 1st order row, press Enter.</item>
    <item>  SAPGUI ( FB01_200_STEP_1 ).</item>
    <item>* To get the values for the field 'Order, Description and External Order No' from F4 help.</item>
    <item>  GETGUI ( FB01_120_STEP_1 ).</item>
    <item>  SAPGUI ( FB01_120_STEP_3 ).</item>
    <item>* To get the value for the field 'Order' from Main screen.</item>
    <item>  GETGUI ( FB01_300_STEP_2 ).</item>
    <item>* click on 'F3' back button.</item>
    <item>  SAPGUI ( FB01_300_STEP_3 ).</item>
    <item>* click on 'F3' back button.</item>
    <item>  SAPGUI ( FB01_700_STEP_1 ).</item>
    <item>* click 'Yes' button.</item>
    <item>  SAPGUI ( FB01_200_STEP_2 ).</item>
    <item>* click on 'F3' back button.</item>
    <item>  SAPGUI ( FB01_100_STEP_3 ).</item>
    <item>ENDMESSAGE ( E_MSG_1 ).</item>
    <item/>
    <item>* To display the Title Screen.</item>
    <item>  LOG ( V_TITLE_SCREEN ).</item>
    <item>* To display the 'Order' Number from F4 help.</item>
    <item>  LOG ( V_ORDER_NO_FROM_F4 ).</item>
    <item>* To display the 'Description' from F4 help.</item>
    <item>  LOG ( V_DESCRIPTION_FROM_F4).</item>
    <item>* To display the 'External Order no' value from F4 help.</item>
    <item>  LOG ( V_EXTERNAL_ORDER_NO_FROM_F4 ).</item>
    <item>* To display the 'Order' Number from main screen.</item>
    <item>  LOG ( V_ORDER_NO_FRM_MAIN_SCREEN ).</item>
    <item>************************************************************************.</item>
    <item>* End Execution.</item>
    <item>***********************************************************************.</item>
    <item/>
    <item>***********************************************************************.</item>
    <item>* Check.</item>
    <item>***********************************************************************.</item>
    <item>* To check name of Title screen for transaction FB01.</item>
    <item>  CHEVAR ( V_TITLE_SCREEN = I_TITLE_SCREEN ).</item>
    <item>* To check the value for the field 'External Order No' from F4 help, which should be equal to 'External Order No' from table.</item>
    <item>  CHEVAR ( V_EXTERNAL_ORDER_NO_FRM_TABL = V_EXTERNAL_ORDER_NO_FROM_F4 ).</item>
    <item>* To check the values for the field 'Order' number from Table, which should be equal to 'Order' no from F4 screen and Main screen.</item>
    <item>  CHEVAR ( ( I_ORDER_NUMBER_FROM_TABLE = V_ORDER_NO_FROM_F4 ) AND ( I_ORDER_NUMBER_FROM_TABLE = V_ORDER_NO_FRM_MAIN_SCREEN )).</item>
    <item>************************************************************************.</item>
    <item>* End Check.</item>
    <item>************************************************************************.</item>
    </ETXML_LINE_TABTYPE>
    </SCRIPT>
    <PARAMETERS>
                     <ETPAR_GUIX>
    <item>
    <PNAME>COAS_1</PNAME>
    <PTYP>X</PTYP>
    <PDESC>Generated Table for View</PDESC>
    <PINDEX>0001</PINDEX>
    <PGROUP>GETTAB</PGROUP>
    <XMLREF_TYP>T</XMLREF_TYP>
    <PSTRUC_TYP>T</PSTRUC_TYP>
    <PREF_TYPE>VIEW</PREF_TYPE>
    <PREF_NAME>COAS</PREF_NAME>
    <PDATLEN>0000</PDATLEN>
    <PINTLEN>000000</PINTLEN>
    <PDECIMALS>000000</PDECIMALS>
    <SORT_LNR>0001</SORT_LNR>
    <PREF_NAME2>COAS</PREF_NAME2>
    <VALUE>&lt;VALUE&gt;</VALUE>
    <VAL_TYPE>T</VAL_TYPE>
    <TAB_INDEX>0</TAB_INDEX>
                              </item>
    <item>
    <PNAME>IOAS_1</PNAME>
    <PTYP>I</PTYP>
    <PDESC>Generated Table for View</PDESC>
    <PINDEX>0001</PINDEX>
    <PGROUP>IETTAB</PGROUP>
    <XMLREF_TYP>T</XMLREF_TYP>
    <PSTRUC_TYP>T</PSTRUC_TYP>
    <PREF_TYPE>VIEW</PREF_TYPE>
    <PREF_NAME>COAS</PREF_NAME>
    <PDATLEN>0000</PDATLEN>
    <PINTLEN>000000</PINTLEN>
    <PDECIMALS>000000</PDECIMALS>
    <SORT_LNR>0001</SORT_LNR>
    <PREF_NAME2>COAS</PREF_NAME2>
    <VALUE>&lt;VALUE&gt;</VALUE>
    <VAL_TYPE>T</VAL_TYPE>
    <TAB_INDEX>0</TAB_INDEX>
                            </item>
     </ETPAR_GUIX>
    </PARAMETERS>
    </ECSC>
    I want to write vbscript for above XML file. Vbscript should display following result :
    1) It should validate <SCRIPT> node The line staring with * symbol is called comment and the line staring without * symbol is call code in above XML file.
    2) Vb Script should display such line numbers those code don't have any comment line specified.
    for example : In above XML the code line : <item>  SAPGUI ( FB01_120_STEP_3 ).</item> it doesn't have any comment line means this code don't have any comment. So vbscript should find such line numbers and code text and show error message.
    3) Each code had its own comment just above line of code.
    4) In <PARAMETER> node we have to check <PNAME> is staring with letter "I" or not.. If its staring with letter "I" then its <PTYPE> and <PGROUP> staring letter should be "I". We have to check this condition
    for every child node of <PARAMETER> node using vbscript.
     Please help me and Thank You so much in advance.
    My Vb Script is as follows :
    filename = "D:\Automation\o.txt"
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set f = fso.OpenTextFile(filename)
    fl=0
    Do Until f.AtEndOfStream
                    strLine = f.ReadLine
                    if (strLine ="MESSAGE ( MSG_1 ).") then
                                Document.write("<br>Inside MESSAGE ")
                                     Do until f.AtEndOfStream
                                                    strLine = f.ReadLine
                                                                    if((Left(strLine,1)="*"))
    Then
                                                                    if((Right(strLine,1)="."))
    then 
          Document.write("<br>ERROR Found  at Line No :" & f.line-1&" "& strLine)
                                                                    end if
                                                                     fl=1
                                                    else 
                                                                    if((Right(strLine,1)=".")
    and (fl=1))Then
          fl=0
        else
          Document.write("<br>ERROR Found  at Line No :" & f.line-1&" "& strLine)
                                                                    end if
                                                    end if
                              Loop
    end if
       And the following code for <PARAMETER> tag :
    Const XMLDataFile = "D:\Automation\imp\p.xml"
    Set xmlDoc = CreateObject("Microsoft.XMLDOM")
    xmlDoc.Async = False
    xmlDoc.Load(XMLDataFile)
     xmlDoc.validateOnParse = True  
     If xmlDoc.Load(XMLDataFile) Then 
              Document.write "SUCCESS loading XML File"  
     Else  
         Document.write "ERROR loading XML File"  
          End If
    counter=0  
    Set root = xmlDoc.documentElement
    Set items = root.childNodes
    for each item in items
        myPNAME = xmlDoc.getElementsByTagName("PNAME").item(counter).text
        myPTYP = xmlDoc.getElementsByTagName("PTYP").item(counter).text
        myPGROUP = xmlDoc.getElementsByTagName("PGROUP").item(counter).text
        If (Left(myPNAME, 1) = "I") Then
            'Document.write("myPNAME Starts with I")
            IsValid = True
            'Innocent until proven guilty
            If (Left(myPTYP, 1) <> "I") Then
                IsValid = False
            End If
            If (Left(myPGROUP, 1) <> "I" )Then
                IsValid = False
            End If
            If IsValid = False Then
                Document.write(myPNAME & " is not valid.")
            End If
            IsValid = True
        End If
        If (Left(myPNAME, 1) = "V") Then
            'Document.write("myPNAME Starts with I")
            IsValid = True
            'Innocent until proven guilty
            If (Left(myPTYP, 1) <> "V") Then
                IsValid = False
            End If
            If (Left(myPGROUP, 1) <> "V" )Then
                IsValid = False
            End If
            If IsValid = False Then
                Document.write(myPNAME & " is not valid.")
            End If
            IsValid = True
        End If
    If (Left(myPNAME, 1) = "E") Then
            'Document.write("myPNAME Starts with I")
            IsValid = True
            'Innocent until proven guilty
            If (Left(myPTYP, 1) <> "E") Then
                IsValid = False
            End If
            If (Left(myPGROUP, 1) <> "E" )Then
                IsValid = False
            End If
            If IsValid = False Then
                Document.write(myPNAME & " is not valid.")
            End If
            IsValid = True
        End If
    counter=counter+1
    next
                                                                    

    Here is a better example of how to pull all of the text.
    strXmlFile = "D:\Automation\imp\p.xml"
    Set xmlDoc = CreateObject("Microsoft.XMLDOM")
    xmlDoc.Async = False
    If xmlDoc.Load(strXmlFile) Then
    WScript.Echo "SUCCESS loading XML File"
    Else
    WScript.Echo "ERROR loading XML File"
    End If
    Set items = xmlDoc.SelectNodes("//SCRIPT/ETXML_LINE_TABTYPE/item")
    For Each item In items
    WScript.Echo item.Text
    Next
    ¯\_(ツ)_/¯

  • Reading XML using JSP

    Hi,
    My company just bought a software, which this s/w will generate a HTML file with the XML tags and data inside it.
    I will need to read the XML tags and data inside the HTML file using JSP.
    Does anyone know how to do this?
    Please help mi!!Thanks!

    http://java.sun.com/webservices/docs/1.1/tutorial/doc/index.html

  • Read xml using xpath in java

    Hi ALL,
    I have a xml as follows:
    <AAA>
    <BBB>
    <CCC>xyz</CCC>
    <DDD>abc</DDD>
    </BBB>
    </AAA>
    Now using any of the java class, i just need read the value of "CCC" as follows:
    (i.e using xpath i need to read the value)
    String val = x.somemethod("/AAA/BBB/CCC");
    Thanks!

    In case you're curious - here's the dom4j equivalent of dvohra09's sample code.
    SAXReader saxReader = new SAXReader("org.apache.xerces.parsers.SAXParser");
    Document doc = saxReader.read(source); //Where source is your file, input source, input stream, reader, or url
    String value = doc.valueOf("//AAA/BBB/CCC"); //Result given the xml from OP = 'xyz'OK - not much difference with this simple example but if you haven't settled on an API, dom4j is worth looking at (IMHO).
    &#8734; brewman &#8734;

  • Error while try to read XML using JDOM

    hi' i don't know what's wrong with this. i try to read my XML document, but i already got exception when i try to initialize it.
    public class readXML
         public readXML()
              try
                   SAXBuilder builder = new SAXBuilder();
                   Document doc = builder.build("XMLTutorial/data.xml");     
              catch(Exception e)
                   e.printStackTrace();
         public static void main(String[] args)
              new readXML();
    }This is my XML Document :
    <f:table>
       <f:name>African Coffee Table</f:name>
       <f:width>80</f:width>
       <f:length>120</f:length>
    </f:table>when i try to run it, i got this exception :
    Caused by: org.xml.sax.SAXParseException: The prefix "f" for element "f:table" is not bound.what's wrong?
    Thanks a lot.

    Namespace prefixes must always be bound to a namespace.
    http://www.w3.org/TR/xml-names11/#sec-namespaces
    For example:<f:table xmlns:f="some namespace">
      <f:name>African Coffee Table</f:name>
      <f:width>80</f:width>
      <f:length>120</f:length>
    </f:table>

  • Faster way to read XML files using power shell !!

    At the moment i have about 1000 XML files (ranging from size 15kb to 120kb), I have a powershell script which extracts information and writes all extracts to the same LOG file!!
    It works well but am only concerned with the time it takes!! it took about 1.5 hrs to finish the script! Is this normal?
    How can i speed it up, your inputs and thoughts helps!!
    Reading XML using the following syntax!
    $Inputfile=[xml](Get-Content $XFILE)
    Script has only foreach loop!  and no other conditions.
    cheers!

    For a small file it is about twice as fast.  It gets faster as the file size gets bigger.
    PS C:\scripts> Measure-Command {$xml=[xml](cat FooProx.xml -raw)}
    Days : 0
    Hours : 0
    Minutes : 0
    Seconds : 0
    Milliseconds : 275
    Ticks : 2758195
    TotalDays : 3.19235532407407E-06
    TotalHours : 7.66165277777778E-05
    TotalMinutes : 0.00459699166666667
    TotalSeconds : 0.2758195
    TotalMilliseconds : 275.8195
    PS C:\scripts> Measure-Command {$xml.Load("$pwd\FooProx.xml")}
    Days : 0
    Hours : 0
    Minutes : 0
    Seconds : 0
    Milliseconds : 108
    Ticks : 1081647
    TotalDays : 1.25190625E-06
    TotalHours : 3.004575E-05
    TotalMinutes : 0.001802745
    TotalSeconds : 0.1081647
    TotalMilliseconds : 108.1647
    ¯\_(ツ)_/¯

  • How to read xml

    I'm getting xml from   customFieldsFeed.getEnumerationValues()  it is comming from  a web services looks like this
    <xml-fragment xmlns:b=""http://schemas.microsoft.com/2003/10/Serialization/Arrays""
    xmlns:i=""http://www.w3.org/2001/XMLSchema-instance""
    xmlns:a=""http://schemas.xxxxxxxx""
    xmlns:u=""http://docs.oasis-open.org/wss/xxxxxxx-utility-1.0.xsd""
    xmlns:s=""http://schemas.xmlsoap.org/soap/envelope/"">
      <b:anyType i:type=""a:Enumeration"">
        <a:EnumerationID>AAAAA</a:EnumerationID>
        <a:Name>A3 MFD</a:Name>
      </b:anyType>
      <b:anyType i:type=""a:Enumeration"">
        <a:EnumerationID>BBBBB</a:EnumerationID>
        <a:Name>A3 Printer</a:Name>
      </b:anyType>
      <b:anyType i:type=""a:Enumeration"">
        <a:EnumerationID>CCCCC</a:EnumerationID>
        <a:Name>A4 MFP</a:Name>
      </b:anyType>
    </xml-fragment>"
    I need to read EnumerationID ex if AAAAA need to retrive Name value " A3 MFD"
    java 1.6
    Thanks,
    HJ

    This could be a starting point:
    http://stackoverflow.com/questions/2811001/how-to-read-xml-using-xpath-in-java
    bye
    TPD

  • How to read XML message present in Table using PL/SQL?

    Hi,
    How to read XML content present in Table using PL/SQL .And is it possible to parse the xml uisng xslt and insert xml output in same table again ?
    Thanks!

    Late reply, but hopefully better late than never.
    You can possibly do it all via a single SQL statement, such as {message:id=4232077}
    XMLTable Syntax can be found at http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions228.htm#CIHGGHFB (for 10.2 users) else find your correct version at http://www.oracle.com/technology/documentation/index.html

  • Load XML File into temporary tables using sql loader

    Hi All,
    I have an XML file as below. I need to insert the contents into a temporary staging table using sql loader. Please advice how I need to do that.
    For example Portfolios should go into a seperate table, and all the tags inside it should be populated in the columns of the table.
    Family should go into a seperate table and all the tags inside it should be populated in the columns of the table.
    Similarly offer, Products etc.
    - <ABSProductCatalog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    - <ProductSalesHierachy>
    - <Portfolios>
    - <Portfolio productCode="P1">
      <Attribute name="CatalogProductName" value="Access" />
      <Attribute name="Status" value="Active" />
      </Portfolio>
    - <Portfolio productCode="P2">
      <Attribute name="CatalogProductName" value="Data" />
      <Attribute name="Status" value="Active" />
      </Portfolio>
    - <Portfolio productCode="P3">
      <Attribute name="CatalogProductName" value="Voice" />
      <Attribute name="Status" value="Active" />
      </Portfolio>
    - <Portfolio productCode="P4">
      <Attribute name="CatalogProductName" value="Wireless" />
      <Attribute name="Status" value="Active" />
      </Portfolio>
      </Portfolios>
    - <Families>
    - <Family productCode="F1">
      <Attribute name="CatalogProductName" value="Internet Access Services" />
      <Attribute name="Status" value="Active" />
    - <ParentHierarchy>
      <Item productCode="P1" modelType="Portfolio" />
      </ParentHierarchy>
      </Family>
    - <Family productCode="F2">
      <Attribute name="CatalogProductName" value="Local Access Services" />
      <Attribute name="Status" value="Active" />
    - <ParentHierarchy>
      <Item productCode="P2" modelType="Portfolio" />
      </ParentHierarchy>
      </Family>
      </Families>
    - <SubFamilies>
    - <SubFamily productCode="SF1">
      <Attribute name="CatalogProductName" value="Business Internet service" />
      <Attribute name="Status" value="Active" />
    - <ParentHierarchy>
      <Item productCode="F1" modelType="Family" />
      </ParentHierarchy>
      </SubFamily>
      </SubFamilies>
    - <ProductRefs>
    - <ProductRef productCode="WSP1" modelType="Wireline Sales Product">
      <ActiveFlag>Y</ActiveFlag>
    - <ProductHierarchy>
      <SalesHierarchy family="F1" subFamily="SF1" portfolio="P1" primary="Y" />
      <SalesHierarchy family="F2" portfolio="P2" primary="N" />
      <FinancialHierarchy quotaBucket="Voice" strategicProdCategory="Local Voice" />
      </ProductHierarchy>
      </ProductRef>
    - <ProductRef productCode="MSP2" modelType="Handset">
      <ActiveFlag>Y</ActiveFlag>
    - <ProductHierarchy>
      <SalesHierarchy portfolio="P4" primary="Y" />
      </ProductHierarchy>
      </ProductRef>
      </ProductRefs>
      </ProductSalesHierachy>
    - <Offers>
    - <Offer productCode="ABN">
      <OfferName>ABN</OfferName>
      <OfferDescription>ABN Description</OfferDescription>
    - <Segments>
      <Segment>SCG</Segment>
      <Segment>PCG</Segment>
      </Segments>
      <OfferUpdateDate>2009-11-20</OfferUpdateDate>
      <ActiveFlag>Y</ActiveFlag>
      </Offer>
    - <Offer productCode="OneNet">
      <OfferName>OneNet</OfferName>
      <OfferDescription>OneNet Description</OfferDescription>
    - <Segments>
      <Segment>SCG</Segment>
      <Segment>PCG</Segment>
      <Segment>PCG2</Segment>
      </Segments>
      <OfferUpdateDate>2009-11-20</OfferUpdateDate>
      <ActiveFlag>Y</ActiveFlag>
      </Offer>
      </Offers>
    - <Products>
    - <Product productCode="WSP1" modelType="Wireline Sales Product">
      <ProductName>AT&T High Speed Internet</ProductName>
      <ProductDescription>High Speed Internet</ProductDescription>
      <LegacyCoProdIndicator>SBC</LegacyCoProdIndicator>
      <RevenueCBLCode>1234B</RevenueCBLCode>
      <VolumeCBLCode>4567A</VolumeCBLCode>
      <SAARTServiceIDCode>S1234</SAARTServiceIDCode>
      <MarginPercentRequired>Y</MarginPercentRequired>
      <PercentIntl>%234</PercentIntl>
      <UOM>Each</UOM>
      <PriceType>OneTime</PriceType>
      <ProductStatus>Active</ProductStatus>
      <Compensable>Y</Compensable>
      <Jurisdiction>Everywhere</Jurisdiction>
      <ActiveFlag>Y</ActiveFlag>
    - <Availabilities>
      <Availability>SE</Availability>
      <Availability>E</Availability>
      </Availabilities>
    - <Segments>
      <Segment>SCG</Segment>
      <Segment>PCG</Segment>
      </Segments>
      <VDIndicator>Voice</VDIndicator>
      <PSOCCode>PSOC 1</PSOCCode>
      <USBilled>Y</USBilled>
      <MOWBilled>N</MOWBilled>
      <ProductStartDate>2009-11-20</ProductStartDate>
      <ProductUpdateDate>2009-11-20</ProductUpdateDate>
      <ProductEndDate>2010-11-20</ProductEndDate>
    - <AliasNames>
      <AliasName>AT&T HSI</AliasName>
      <AliasName>AT&T Fast Internet</AliasName>
      </AliasNames>
    - <OfferTypes>
      <OfferType productCode="ABN" endDate="2009-11-20" />
      <OfferType productCode="OneNet" />
      </OfferTypes>
    - <DynamicAttributes>
    - <DynamicAttribute dataType="String" defaultValue="2.5 Mbps" name="Speed">
      <AttrValue>1.5 Mbps</AttrValue>
      <AttrValue>2.5 Mbps</AttrValue>
      <AttrValue>3.5 Mbps</AttrValue>
      </DynamicAttribute>
    - <DynamicAttribute dataType="String" name="TransportType">
      <AttrValue>T1</AttrValue>
      </DynamicAttribute>
      </DynamicAttributes>
      </Product>
    - <Product productCode="MSP2" modelType="Handset">
      <ProductName>Blackberry Bold</ProductName>
      <ProductDescription>Blackberry Bold Phone</ProductDescription>
      <LegacyCoProdIndicator />
      <RevenueCBLCode />
      <VolumeCBLCode />
      <SAARTServiceIDCode />
      <MarginPercentRequired />
      <PercentIntl />
      <UOM>Each</UOM>
      <PriceType />
      <ProductStatus>Active</ProductStatus>
      <Compensable />
      <Jurisdiction />
      <ActiveFlag>Y</ActiveFlag>
    - <Availabilities>
      <Availability />
      </Availabilities>
    - <Segments>
      <Segment>SCG</Segment>
      <Segment>PCG</Segment>
      </Segments>
      <VDIndicator>Voice</VDIndicator>
      <PSOCCode />
      <USBilled />
      <MOWBilled />
      <ProductStartDate>2009-11-20</ProductStartDate>
      <ProductUpdateDate>2009-11-20</ProductUpdateDate>
    - <AliasNames>
      <AliasName />
      </AliasNames>
    - <OfferTypes>
      <OfferType productCode="ABN" />
      </OfferTypes>
    - <DynamicAttributes>
    - <DynamicAttribute dataType="String" name="StlmntContractType">
      <AttrValue />
      </DynamicAttribute>
    - <DynamicAttribute dataType="String" name="BMG 2 year price">
      <AttrValue>20</AttrValue>
      </DynamicAttribute>
    - <DynamicAttribute dataType="String" name="MSRP">
      <AttrValue>40</AttrValue>
      </DynamicAttribute>
    - <DynamicAttribute dataType="String" name="BMGAvailableType">
      <AttrValue />
      </DynamicAttribute>
    - <DynamicAttribute dataType="String" name="ProductId">
      <AttrValue>123456</AttrValue>
      </DynamicAttribute>
    - <DynamicAttribute dataType="String" name="modelSource">
      <AttrValue>product</AttrValue>
      </DynamicAttribute>
      </DynamicAttributes>
      </Product>
      </Products>
      <CatalogChanged>Y</CatalogChanged>
      </ABSProductCatalog>

    Two options that come to mind. Others exist.
    #1 - {thread:id=474031}, which is basically storing the XML in an Object Relational structure for parsing
    #2 - Dump the XML into either an XMLType based table or column and use SQL (with XMLTable) to create a view that parses the data. This would be the same as the view shown in the above post.
    Don't use sql*loader to parse the XML. I was trying to find a post from mdrake about that but couldn't. In short, sql*loader was not build as an XML parser so don't try to use it that way.

Maybe you are looking for

  • Error while creating the Generic Connector for flatfile

    Hi All, I was trying to create the Generic connector for the flat file reconciliation. But i was throwed into errors. I'm using 11.1.1.3 OIM and as well as SOA also. I have been following the OIM 9 document to create the GENERIC connector. i'm copyin

  • DASYLab 11 and Win 8.1 Pro

    Hi, i am going to get a new laptop with Win 8.1 pro, currently i am using DASYLab 11, I believe DASYLab 11 works iwth Win 8.1, but i want to ask if anyone has some experience with it, do i need to upgrade some drive or do something? i just want to pr

  • How to loop through Multiple Excel sheets and load them into a SQL Table?

    Hi , I am having 1 excel sheet with 3 worksheet. I have configured using For each loop container and ADO.net rowset enumerator. Every thing is fine, but after running my package I am getting below error [Excel Source [1]] Error: SSIS Error Code DTS_E

  • Fragment Bundle Classpath problems

    Does anyone have any tips for solving classpath problems in fragment bundles? I'm getting a no-class-def that I can't explain. I've used maven to create a fragment, hosted by com.day.crx.sling.server, to create a custom login. It needs to call a web

  • Private directory CCME

    Hi everyone, I got two questions about CCME. 1. the directory entries defined under the telephony-service are accessible to everybody who has an IP Phone. Is there any solution to make private directory entries for each IP Phone so that IP Phone does