I need help! XML Parsing

This is my xml code file.
<?xml version="1.0" encoding="iso-8859-1"?>
<contato_lista xmlns="includes:net_schema.xml">
     <contato ID="001">
          <nome>Andr�teste</nome>
          <ip>192.168.25.242</ip>
     </contato>
     <contato ID="002">
          <nome>Gustavo</nome>
          <ip>192.168.25.72</ip>
     </contato>
</contato_lista>
I am trying to get the text from the tags <nome> and <ip> from the 2 tags <contato>. And this is the method I am using. I am trying to get the text in the tags <nome> in the array contatos_lista[], everytime I run the program I get empty. Please I need help. I am desperade.
Thanks in advace.
public String[] importaContatos() {
String contatos_lista[] = new String[ 12 ];
contatos_lista[0] = "N�o h� contatos";
Node nodeContato;
NodeList contatoChild;
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try {
File contatos = new File("D:/userdir/mycodes/NetMessage/contatos.xml");
DocumentBuilder builder = factory.newDocumentBuilder();
document = builder.parse( contatos );
}catch (SAXParseException spe) {
}catch (ParserConfigurationException e){
}catch(SAXException e){
}catch (IOException e){
Node nodeElement = document.getDocumentElement();
Node nodeChild = nodeElement.getParentNode();
Node nodeContatoLista = nodeChild;
NodeList contatoListaChild = nodeContatoLista.getChildNodes();
//JOptionPane.showMessageDialog(null , contatos_lista[0]);
for (int i = 0; i <= contatoListaChild.getLength(); i++){
nodeContato = nodeContatoLista.getFirstChild();
nodeContato = nodeChild.getNextSibling();
contatoChild = nodeContato.getChildNodes();
int count = 0;
for (int y = 0; y < contatoChild.getLength(); y++){
contatos_lista[count] = contatoChild.item(y).getNodeValue();
count++;
return contatos_lista;
}

This is my xml code file.
<?xml version="1.0" encoding="iso-8859-1"?>
<contato_lista xmlns="includes:net_schema.xml">
     <contato ID="001">
          <nome>Andr�teste</nome>
          <ip>192.168.25.242</ip>
     </contato>
     <contato ID="002">
          <nome>Gustavo</nome>
          <ip>192.168.25.72</ip>
     </contato>
</contato_lista>
I am trying to get the text from the tags <nome> and
<ip> from the 2 tags <contato>. And this is the method
I am using. I am trying to get the text in the tags
<nome> in the array contatos_lista[], everytime I run
the program I get empty. Please I need help. I am
desperade.
Thanks in advace.
public String[] importaContatos() {
String contatos_lista[] = new String[ 12 ];
contatos_lista[0] = "N�o h� contatos";
Node nodeContato;
NodeList contatoChild;
DocumentBuilderFactory factory =
ctory = DocumentBuilderFactory.newInstance();
try {
File contatos = new
tatos = new
File("D:/userdir/mycodes/NetMessage/contatos.xml");
DocumentBuilder builder =
r builder = factory.newDocumentBuilder();
document = builder.parse( contatos );
}catch (SAXParseException spe) {
}catch (ParserConfigurationException e){
}catch(SAXException e){
}catch (IOException e){
Node nodeElement =
ement = document.getDocumentElement();
Node nodeChild = nodeElement.getParentNode();
Node nodeContatoLista = nodeChild;
NodeList contatoListaChild =
Child = nodeContatoLista.getChildNodes();
//JOptionPane.showMessageDialog(null ,
(null , contatos_lista[0]);
for (int i = 0; i <=
0; i <= contatoListaChild.getLength(); i++){
nodeContato =
deContato = nodeContatoLista.getFirstChild();
nodeContato = nodeChild.getNextSibling();
contatoChild =
tatoChild = nodeContato.getChildNodes();
int count = 0;
for (int y = 0; y <
y = 0; y < contatoChild.getLength(); y++){
contatos_lista[count] =
atos_lista[count] =
contatoChild.item(y).getNodeValue();
count++;
return contatos_lista;
}This line appears to be wrong to me
Node nodeChild = nodeElement.getParentNode();
Why are you doing that?
Anyway it would be easier just to do
ement = document.getDocumentElement();
NodeList contatoListaChild = ement.getElementsByTagName("contato");
for (int i = 0; i <= contatoListaChild.getLength(); i++){
  Element contato = contatoListaChild.item(i);

Similar Messages

  • Urgent : Need help in parsing XML from Sharepoint and save it into DB

    Hi ,
    I am Sharepoint guy and a newbie in Oracle . PL/SQL
    I am using UTL_DBWS Package to call a Sharepoint WebService " and was sucessfull , Now the xml has to be parsed and stored into a Table. I am facing the issue as the XML has a different namesoace and normal XPATH query is not working
    Below is the XML and need help in parsing it
    declare
    responsexml sys.XMLTYPE;
    testparsexml sys.XMLTYPE;
    begin
    responsexml := sys.XMLTYPE('<GetListItemsResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/">
    <GetListItemsResult>
    <listitems xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
    <rs:data ItemCount="2">
    <z:row ows_MetaInfo="1;#" ows__ModerationStatus="0" ows__Level="1" ows_Title="Test Title 1" ows_ID="1" ows_owshiddenversion="1" ows_UniqueId="1;#{9C45D54E-150E-4509-B59A-DB5A1B97E034}" ows_FSObjType="1;#0" ows_Created="2009-09-12 17:13:16" ows_FileRef="1;#Lists/Tasks/1_.000"/>
    <z:row ows_MetaInfo="2;#" ows__ModerationStatus="0" ows__Level="1" ows_Title="Testing Tasks" ows_ID="2" ows_owshiddenversion="1" ows_UniqueId="2;#{8942E211-460B-422A-B1AD-1347F062114A}" ows_FSObjType="2;#0" ows_Created="2010-02-14 16:44:40" ows_FileRef="2;#Lists/Tasks/2_.000"/>
    </rs:data>
    </listitems>
    </GetListItemsResult>
    </GetListItemsResponse>');
    testparsexml := responsexml.extract('/GetListItemsResponse/GetListItemsResult/listitems/rs:data/z:row/@ows_Title');
    DBMS_OUTPUT.PUT_LINE(testparsexml.extract('/').getstringval());
    end;
    The issue is with rs:data , z:row nodes.... please suggest how to handle these kind of namespaces in Oracle
    I need the parse the attribute "ows_Title" and save it into a DB
    this script would generate "Error occured in XML Parsing"
    Help is appriciated, thanks for looking

    SQL> SELECT *
      FROM XMLTABLE (
              xmlnamespaces ('http://schemas.microsoft.com/sharepoint/soap/' as "soap",
                             '#RowsetSchema' AS "z"
              'for $i in //soap:*//z:row return $i'
              PASSING xmltype (
                         '<GetListItemsResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/">
    <GetListItemsResult>
    <listitems xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
    <rs:data ItemCount="2">
    <z:row ows_MetaInfo="1;#" ows__ModerationStatus="0" ows__Level="1" ows_Title="Test Title 1" ows_ID="1" ows_owshiddenversion="1" ows_UniqueId="1;#{9C45D54E-150E-4509-B59A-DB5A1B97E034}" ows_FSObjType="1;#0" ows_Created="2009-09-12 17:13:16" ows_FileRef="1;#Lists/Tasks/1_.000"/>
    <z:row ows_MetaInfo="2;#" ows__ModerationStatus="0" ows__Level="1" ows_Title="Testing Tasks" ows_ID="2" ows_owshiddenversion="1" ows_UniqueId="2;#{8942E211-460B-422A-B1AD-1347F062114A}" ows_FSObjType="2;#0" ows_Created="2010-02-14 16:44:40" ows_FileRef="2;#Lists/Tasks/2_.000"/>
    </rs:data>
    </listitems>
    </GetListItemsResult>
    </GetListItemsResponse>')
    columns ows_MetaInfo varchar2(20) path '@ows_MetaInfo',
             ows_Title varchar2(20) path '@ows_Title',
             ows__ModerationStatus varchar2(20) path '@ows__ModerationStatus'
    OWS_METAINFO         OWS_TITLE            OWS__MODERATIONSTATUS
    1;#                  Test Title 1         0                   
    2;#                  Testing Tasks        0                   
    2 rows selected.

  • Urgently  need help for parsing IP header

    Hi, could anyone tell which class I should use to parsing the IP header of a packet?
    Thanks many many times!

    > Hi, could anyone tell which class I should use to
    parsing the IP header of a packet?
    DatagramPacket?
    > Urgently need help for parsing IP header
    Don't flag your question as urgent, even if it is for you.
    * We all answer questions here voluntarily, in our leisure time. We do that because doing so is fun for us, because we enjoy helping people and having interesting discussions. Guess what, it is much less fun if it gets stressful. So the last thing you want to do to get us to answer your question is to pass your stress over to us.
    * People who are stressed and want a fast answer often don't even find the time to do the necessary research or to formulate their question in an easy to comprehend way. That's even less fun to work with. So you really don't want us to feel your stress. Instead you want to take your time to write a well formulated post that is fun to answer. The less likely it is for us to know that your question is urgent, the more likely you are to get a fast answer!
    * The simple notion that you want your post to be answered faster than those of the other members might feel rather unfair to some of us. Doubly so because often "urgent" questions actually are homework questions. Yours might be different, but someone who had bad experiences with this type of question might not read far enough to notice.

  • Immediate help needed with XML Parser

    I am currently running Oracle 8i and trying to use the XML utilities. Just to make sure things are working, I tried a very simple program. I followed the xslsample.sql code that was supplied by Oracle. Code is as follows:
    declare
    p xmlparser.parser;
    begin
    p := xmlparser.newparser;
    end;
    When the code executes, I get a PLS-00201: identifier 'XMLPARSER.PARSER' must be declared. Anyone have any ideas on what is going on and how to fix it? Any assistance would be greatly appreciated. You can email directly if you wish since I am really under a tight timeline to get these utilities to work correctly.

    Michael,
    Seems to be some problem with privileges. XMLPARSER is owned by SYS. You will need to grant execute access from SYS to the user under which you are trying to compile the procedure. It might be useful to create a public synonym and then grant access.
    Hope this helps.

  • Need help in Parsing XML Document in Oracle

    Hello Experts,
    I urgently need your help. We have xml document on the Web but not on the File System. How can I parse the xml document on the web in Oracle.
    Any link, blog or sample code would be appreciated.
    Your help would be appreciated.
    Kind Regards,
    Bhavin
    London, UK

    This breaks down to two issues
    1) Getting the XML into Oracle
    2) Parsing the XML inside Oracle
    For #1, the first two options that come to my mind are httpuirtype and utl_http. Both can be used to get information from a URL that understands HTTP requests.
    For #2, you can treat the XML as a DOMDocument or XMLType to parse it. You also could parse it via a SQL statement using XQuery or XMLTable as well.
    Many of those examples can be found on the {forum:id=34} forum or [Marco&apos;s blog|http://www.liberidu.com/blog/]. A few parsing examples that I've done can be seen at {message:id=3610259}, make sure to also follow the link I put in there to a previous example before that.

  • Need help on parsing xml file...

    Hi all,
    I need to collect some data from an Xml file using java. I have the following code with me but I am unable to get the required result. I am unable to get the data from the tags belonging to the header and footer elements. Please find the code and the sample xml file below.
    Program to parse XML:
    import java.io.IOException;
    import java.util.ArrayList;
    import java.util.Iterator;
    import java.util.List;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.NodeList;
    import org.xml.sax.SAXException;
    public class JobLogDetails3{
         //No generics
         List myJobs;
         Document dom;
         public JobLogDetails3(){
              //create a list to hold the job objects
              myJobs = new ArrayList();
         public void runJobDetails() {
              //parse the xml file and get the dom object
              parseXmlFile();
              //get each joblog element and create a job object
              parseDocument();
              //Iterate through the list and print the data
              printData();
         private void parseXmlFile(){
              //get the factory
              DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
              try {
                   //Using factory get an instance of document builder
                   DocumentBuilder db = dbf.newDocumentBuilder();
                   //parse using builder to get DOM representation of the XML file
                   dom = db.parse("test.xml");
              }catch(ParserConfigurationException pce) {
                   pce.printStackTrace();
              }catch(SAXException se) {
                   se.printStackTrace();
              }catch(IOException ioe) {
                   ioe.printStackTrace();
         private void parseDocument(){
              //get the root elememt
              Element docEle = dom.getDocumentElement();
              //get a nodelist of <joblog> elements
              NodeList nl = dom.getElementsByTagName("*");
              if(nl != null && nl.getLength() > 0) {
                   for(int i = 0 ; i < nl.getLength();i++) {
                        //get the joblog element
                        Element el = (Element)nl.item(i);
                        //get the joblog object
                        Job J = getJob(el);
                        //add it to list
                        myJobs.add(J);
         * I take an joblog element and read the values in, create
         * an joblog object and return it
         * @param JobEl
         * @return
         private Job getJob(Element JobEl) {
              //for each <joblog> element get text or int values of
              //name ,id, age and name
              String jobServer = getTextValue(JobEl,"server");
              String jobName = getTextValue(JobEl,"name");
              String jobClient = getTextValue(JobEl,"machine_name");
              String jobStart = getTextValue(JobEl,"start_time");
              String jobType = getTextValue(JobEl,"type");
              String jobEnd = getTextValue(JobEl,"end_time");
              String jobSize = getTextValue(JobEl,"new_processed_bytes");
              //Create a new Job with the value read from the xml nodes
              Job J = new Job(jobServer,jobName,jobClient,jobStart,jobType,jobEnd,jobSize);
              return J;
         * I take a xml element and the tag name, look for the tag and get
         * the text content
         * i.e for <employee><name>John</name></employee> xml snippet if
         * the Element points to employee node and tagName is name I will return John
         * @param ele
         * @param tagName
         * @return
         private String getTextValue(Element ele, String tagName) {
              String textVal = null;
              NodeList nl = ele.getElementsByTagName(tagName);
              if(nl != null && nl.getLength() > 0) {
                   Element el = (Element)nl.item(0);
                   textVal = el.getFirstChild().getNodeValue();
              return textVal;
         * Calls getTextValue and returns a int value
         * @param ele
         * @param tagName
         * @return
         private int getIntValue(Element ele, String tagName) {
              //in production application you would catch the exception
              return Integer.parseInt(getTextValue(ele,tagName));
         * Iterate through the list and print the
         * content to console
         private void printData(){
              System.out.println("No of Jobs '" + myJobs.size() + "'.");
              Iterator it = myJobs.iterator();
              while(it.hasNext()) {
                   System.out.println(it.next().toString());
         public static void main(String[] args){
              //create an instance
              JobLogDetails JLD = new JobLogDetails();
              //call run example
              JLD.runJobDetails();
    Job Class
    public class Job {
         private String jobServer;
    private String jobName;
    private String jobClient;
    private String jobStart;
    private String jobType;
    private String jobEnd;
    private String jobSize;
         public Job(){
         public Job(String jobServer,String jobName,String jobClient,String jobStart,String jobType,String jobEnd,String jobSize ) {
              this.jobServer = jobServer;
              this.jobName = jobName;
              this.jobClient = jobClient;
    this.jobStart = jobStart;
              this.jobType = jobType;
    this.jobEnd = jobEnd;
    this.jobSize = jobSize;
         public String getjobServer() {
              return jobServer;
         public void setjobServer(String jobServer) {
              this.jobServer = jobServer;
         public String getjobName() {
              return jobName;
         public void setjobname(String jobName) {
              this.jobName = jobName;
         public String getjobClient() {
              return jobClient;
         public void setjobClient(String jobClient) {
              this.jobClient = jobClient;
    public String getjobStart() {
              return jobStart;
         public void setjobStart(String jobStart) {
              this.jobStart = jobStart;
    public String getjobType() {
              return jobType;
         public void setjobType(String jobType) {
              this.jobType = jobType;
    public String getjobEnd() {
              return jobEnd;
         public void setjobEnd(String jobEnd) {
              this.jobEnd = jobEnd;
    public String getjobSize() {
              return jobSize;
         public void setjobSize(String jobSize) {
              this.jobSize = jobSize;
         public String toString() {
              StringBuffer sb = new StringBuffer();
    sb.append(getjobServer());
              sb.append(",");
    sb.append(getjobName());
              sb.append(",");
              sb.append(getjobClient());
              sb.append(",");
              sb.append(getjobType());
              sb.append(",");
              sb.append(getjobStart());
              sb.append(",");
              sb.append(getjobEnd());
              sb.append(",");
              sb.append(getjobSize());
              sb.append(",");
              return sb.toString();
    Sample XML File:
    <?xml version="1.0" encoding="UTF-16" ?>
    - <joblog>
    <job_log_version version="2.0" />
    - <header>
    <filler>======================================================================</filler>
    <server>Job server: TGBBAK</server>
    <name>Job name: TGBSAP4-SQL-SQL DB Servers S2T - High-Weekly Full Backup</name>
    <start_time>Job started: 26 September 2011 at 01:00:04</start_time>
    <type>Job type: Backup</type>
    <log_name>Job Log: GFD_TGBBAK_71887.xml</log_name>
    <filler>======================================================================</filler>
    </header>
    <media_mount_date>Drive and media mount requested: 26/09/2011 01:00:04</media_mount_date>
    - <media_drive_and_media_info>
    <media_mount_date>Drive and media information from media mount: 26/09/2011 01:00:39</media_mount_date>
    <robotic_library_name>Robotic Library Name: HP 1</robotic_library_name>
    <drive_name>Drive Name: LTO4_2</drive_name>
    <slot>Slot: 43</slot>
    <media_label>Media Label: 000059L</media_label>
    <media_guid>Media GUID: {a6ca0062-7a6f-4b4b-8144-732ca25f2f9d}</media_guid>
    <media_overwrite_date>Overwrite Protected Until: 25/10/2011 19:24:58</media_overwrite_date>
    <media_append_date>Appendable Until: 02/10/2011 14:00:30</media_append_date>
    <media_set_target>Targeted Media Set Name: Weekly Tape</media_set_target>
    </media_drive_and_media_info>
    - <backup>
    <filler>======================================================================</filler>
    <title>Job Operation - Backup</title>
    <append_or_overwrite>Media operation - append.</append_or_overwrite>
    <compression>Compression Type: Hardware [if available, otherwise none]</compression>
    <verify_option>WARNING: The option 'Verify after backup completes' was not selected. Performing a verify operation to make sure that media can be read after the backup has completed is recommended.</verify_option>
    <filler>======================================================================</filler>
    - <machine>
    <machine_name>TGBSAP4.Tetley.Grp</machine_name>
    <info>Network control connection is established between 10.22.2.18:3271 <--> 10.22.2.4:10000</info>
    <info>Network data connection is established between 10.22.2.18:3301 <--> 10.22.2.4:3094</info>
    - <set>
    <set_resource_name>TGBSAP4.Tetley.Grp</set_resource_name>
    <tape_name>Family Name: "Media created 25/09/2011 13:59:55"</tape_name>
    - <volume>
    <display_volume>Backup of "TGBSAP4.Tetley.Grp "</display_volume>
    </volume>
    <description>Backup set #45 on storage media #1 Backup set description: "Weekly Full Backup"</description>
    <backup_type>Backup Method: Full - Back up entire database or filegroup</backup_type>
    <agent_started>Microsoft SQL Server Agent: Started</agent_started>
    <start_time>Backup started on 26/09/2011 at 01:01:45.</start_time>
    - <database>
    <database>Database PRD</database>
    </database>
    - <database>
    <database>Database master</database>
    </database>
    - <database>
    <database>Database model</database>
    </database>
    - <database>
    <database>Database msdb</database>
    </database>
    <end_time>Backup completed on 26/09/2011 at 02:42:25.</end_time>
    - <summary>
    <backed_up_database>Backed up 4 databases</backed_up_database>
    <new_processed_bytes>Processed 573363576542 bytes in 1 hour, 40 minutes, and 40 seconds.</new_processed_bytes>
    <vlm_hist_rateformat2>Throughput rate: 5432 MB/min</vlm_hist_rateformat2>
    </summary>
    <filler>----------------------------------------------------------------------</filler>
    </set>
    </machine>
    </backup>
    - <footer>
    <filler>======================================================================</filler>
    <end_time>Job ended: 26 September 2011 at 02:43:12</end_time>
    <engine_completion_status>Job completion status: Successful</engine_completion_status>
    <filler>======================================================================</filler>
    <completeStatus>19</completeStatus>
    </footer>
    </joblog>

    1. your code does not compile (in your main method you try to create an instance of a class which does not exist).
    2. your XML document is not well formed.
    +[Fatal Error] test.xml:34:74: The content of elements must consist of well-formed character data or markup.+
    org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup.
    Maybe there are other problems but you can start by fixing these.

  • Need Help XML Publisher Report

    Hi Friends
    I need to generate a report in xml publisher responsibility .
    I have create and designed the RTF file using word , And i have genetared an XML file(template )
    I have some doubt please clarify by doubts
    In RTF template i have some 4columns
    For EXample i Give some column name
    Invoice Number , Invoice Line Number ,Tax Type ,Tax Code Name etc....
    In my RTF I have done like this
    I have created two 2 row and 4column
    In the 1st row i have all the 4 column heading
    In the 2nd row i have done like this
    Developer tab> Design mode > In the legacy tool i have selected text Form field
    Once i double click the text form field in the default text i have Given C1 Then in the Add help text button i have given <?C_INVOICE_NUMBER?> like this i have done for alls the columns
    My RTF design is completed
    Now i need load the XML is it?
    In the XMl data query i have placed my sql statement
    Here my doubt starts
    wether all the column in the RTF should be in the XML sql statement ha?
    2)In the top of my RTF i need to add date and page No how to add that ?
    Thanks In advance
    AT

    Hi Friend
    Iam saying this is my XML file
    <LIST_G_TAX_NAME>
    <G_TAX_NAME>
    <C_SORT_TAX_NAME>USE TAX</C_SORT_TAX_NAME>
    <C_TAX_NAME>Use Tax</C_TAX_NAME>
    <C_TAX_RATE>8.25</C_TAX_RATE>
    <C_TAX_TYPE>USE</C_TAX_TYPE>
    <C_PERIOD_NAME>OCT-11</C_PERIOD_NAME>
    <LIST_G_VENDOR>
    <G_VENDOR>
    <C_SORT_VENDOR_NAME/>
    <C_SORT_SITE_CODE/>
    <C_VENDOR_ID>851</C_VENDOR_ID>
    <C_VENDOR_NAME>ORACLE CORPORATION</C_VENDOR_NAME>
    <C_SITE_CODE>CHICAGO</C_SITE_CODE>
    <LIST_G_INVOICE>
    <G_INVOICE>
    <C_INVOICE_DATE>17-OCT-11</C_INVOICE_DATE>
    <C_SORT_INVOICE_NUMBER>1308</C_SORT_INVOICE_NUMBER>
    <C_INVOICE_ID>350889</C_INVOICE_ID>
    <C_INVOICE_NUMBER>1308</C_INVOICE_NUMBER>
    <C_INVOICE_LINE_NUMBER>1</C_INVOICE_LINE_NUMBER>
    <C_PO_NUMBER>256388</C_PO_NUMBER>
    <C_DESCRIPTION>TEST</C_DESCRIPTION>
    <C_GL_DATE>17-OCT-11</C_GL_DATE>
    <C_INVOICE_LINE_AMOUNT>15</C_INVOICE_LINE_AMOUNT>
    <C_CHARGE_ACCOUNT>412.00.6410.7831.1076.1001.00.000.0000</C_CHARGE_ACCOUNT>
    <C_LIABILITY_ACCOUNT>412.00.0000.2152.1208.1001.00.000.0000</C_LIABILITY_ACCOUNT>
    <C_BATCH_NAME>101711</C_BATCH_NAME>
    <C_SITE_CODE2>CHICAGO</C_SITE_CODE2>
    <C_INVOICE_AMOUNT>15</C_INVOICE_AMOUNT>
    <LIST_G_DIST>
    <G_DIST>
    <C_INVOICE_TAX_ID>10061</C_INVOICE_TAX_ID>
    <C_LINE_TYPE>ITEM</C_LINE_TYPE>
    </G_DIST>
    </LIST_G_DIST>
    <C_TAXABLE_AMOUNT>15</C_TAXABLE_AMOUNT>
    <C_TAX_AMOUNT>1.24</C_TAX_AMOUNT>
    <C_INVOICE_AMOUNT_DISP> 15.00 </C_INVOICE_AMOUNT_DISP>
    <C_TAXABLE_AMOUNT_DISP> 15.00 </C_TAXABLE_AMOUNT_DISP>
    <C_TAX_AMOUNT_DISP> 1.24 </C_TAX_AMOUNT_DISP>
    </G_INVOICE>
    </LIST_G_INVOICE>
    <C_INVOICE_SITE_SUM>124.9</C_INVOICE_SITE_SUM>
    <C_INVOICE_SITE_SUM_DISP> 124.90 </C_INVOICE_SITE_SUM_DISP>
    <C_TAX_SITE_SUM>5.4</C_TAX_SITE_SUM>
    <C_TAX_SITE_SUM_DISP> 5.40 </C_TAX_SITE_SUM_DISP>
    <C_TAXABLE_SITE_SUM>65.66</C_TAXABLE_SITE_SUM>
    <C_TAXABLE_SITE_SUM_DISP> 65.66 </C_TAXABLE_SITE_SUM_DISP>
    </G_VENDOR>
    </LIST_G_VENDOR>
    <C_OLD_VENDOR_ID>0</C_OLD_VENDOR_ID>
    <C_INVOICE_SUM>124.9</C_INVOICE_SUM>
    <C_INVOICE_SUM_DISP> 124.90 </C_INVOICE_SUM_DISP>
    <C_TAX_SUM>5.4</C_TAX_SUM>
    <C_TAX_SUM_DISP> 5.40 </C_TAX_SUM_DISP>
    <C_TAXABLE_SUM>65.66</C_TAXABLE_SUM>
    <C_TAXABLE_SUM_DISP> 65.66 </C_TAXABLE_SUM_DISP>
    </G_TAX_NAME>
    </LIST_G_TAX_NAME>
    And if i need all the column to be displayed in my report
    1)Invoice Number
    2)Invoice Line Number
    3)Tax Type
    4)Tax Code Name
    5)Tax Rate Percent
    6)Supplier Name
    7)Description
    8)Gl Date
    9)Invoive Line Amount
    10)Taxable Line Amount
    11)Tax Liability
    12)Po Number
    13)Charge Account
    14)Liability Account
    Which tag do i need to use fro grouping
    For ex
    Instead of this <?for-each:G_TAX_NAME?> <?end for-each?>
    which one i need to use
    Please help
    Thanks
    AT

  • Need help in parsing a VARCHAR2(4000 BYTES) field

    Hi Guys,
    Let me give the DB information first:
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE 10.2.0.4.0 Production
    TNS for Solaris: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    My problem is: The frontend of the application sends a large string into the VARCHAR2 (4000 BYTES) field. The string it sends is somewhat like this -
    <strong>Crit:</strong> Some text. <br><strong>Distinguished</strong> (points 3):Some comment text1. <blockquote> </blockquote><strong>Crit:</strong> Some other text.<br><strong>Distinguished</strong> (points 3):Some comment text2. <blockquote> </blockquote><strong>Crit:</strong> Some more text. <br><strong>Distinguished</strong> (points 3):Some comment text3. <blockquote> </blockquote><strong>Overall comments:</strong><br> Final text!!I want to parse the text and put into separate columns. Number of Crit: can be more than 3; its 3 up there. But the basic structure is same. What is the best possible way of parsing this in PL/SQL code? I want something like
    Table 1
    Crit                       Points           Comment
    Some text                3        Some comment text1.
    Some other text        3        Some comment text2.
    Some more text        3        Some comment text3.
    Table 2
    Overall comments
    Final text!!Please let me know, if you need further information.
    Thanks.
    Edited by: 794684 on Sep 14, 2010 4:15 AM
    Edited by: 794684 on Sep 14, 2010 4:38 AM
    Edited by: 794684 on Sep 14, 2010 4:53 AM
    Edited by: 794684 on Sep 14, 2010 6:42 AM

    Welcome to the forum.
    Looks like noformat tags are not working.Please use the {noformat}{noformat} tag if you want to post formatted examples/code.
    For example, when you type:
    {noformat}select *
    from dual;
    {noformat}
    it will appear as:select *
    from dual;
    when you post it on this forum...
    The FAQ will explain the other options you have: http://forums.oracle.com/forums/help.jspa                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Need help to parse a blob

    I'm trying to write an app to parse unified patch files. I've got a table to hold a set of patches from a single patch file and a table to hold each individual patch within the patch file (a single patch file can patch multiple source files). I'm currently holding the file contents in a blob field. I know how I would do this in python or other scripting languages, but I'm a complete pl/sql n00b, so I'm a bit clueless. Basically, I have the appropriate algorithm for parsing the file, but just not how to do it.
    Does anyone know of a tutorial that explains how to do this? Or maybe post some tips as to what pl/sql modules to look into?

    Kindly go through the following links ->
    http://www.oracle.com/technology/sample_code/tech/windows/odpnet/howto/anonyblock/index.html
    http://www.oracle.com/technology/sample_code/tech/java/jsp/samples/blob/blob.html
    http://www.psoug.org/reference/dbms_lob.html
    Might be helpful for you.
    Regards.
    Satyaki De.

  • Need Help with parsing text

    Hello all, I hope this is an easy question....
    I have a string similar to
    <li><span class="RandomInformation">the latest news on my site</span></li>
    I am currently geting a string where each new line is a new <li> from a pure http call. what I need to do is split this down into an array of strings (Yes this is my website, and no im not trying to rebrand other's work...:) ) delimeted on :
    - each line needs to be a separate element within a multidimensional array
    - Can't split on CrLf because further up and further down I have other entries I dont care about, so I need to use the <li></li> as indicators that they contain the information I want.
    - out of each line, I need to separate them into multiple 'columns' within the array
    - one for the contents of the span clas (in this case "RandomInformation"
    - one element for the contents of the link (in this case my url, http://www.w2gas.com, but will be sub pages later like http://www.w2gas.com/page2.html)
    - most importantly one element for the text between anchor tags (this case it is "the latest news on my site")
    I tried a Regex for stripping the HTML tags out, however all I was left with was the text between anchors. I know I could do it based on character by character looping (have done that) but its terrible slow. I know there must be a way to accomplish this, however Im just too new to figure it out. (maybe?)
    Thanks in advance
    Lee

    Would something like [this |http://htmlparser.sourceforge.net/] help?

  • NEED HELP:To Parse Conditional Operator Within An Expression.

    Hi there:
    I'm having some difficulties to parse some conditoional operator. My requirements is:
    Constants value: int a=1,b=2,c=3
    Input/Given value: 2
    conditional operator expression: d=a|b|c
    Expected result: d=true
    Summary: I like to receive a boolean from anys expressions defined, which check against Input/Given value.Note: The expression are various from time to time, based on user's setup, the method is smart enough to return boolean based on any expression.
    Let me know if you have any concerns.
    Thanks a million,
    selena

    here is a simple example.
    BNF changes
    EXPR ::= OPERATOR
    EXPR ::= OPERATION OPERANT EXPR
    This is as far as I can go, please use it as a template only
    because you need to take into account the precedence using ()
    the logic of the eval was simply right to left so I think it is not what you want
    Cheers
    public interface Expression
         String OR = "|";
         String AND = "&";
         public boolean eval(int value) throws Exception;
    public class ExpressionImpl implements Expression
         public String oper1;
         public String operant;
         public Expression tail;
         /* (non-Javadoc)
          * @see parser.Expression#eval()
         public boolean eval(int value) throws Exception
              int val1 = getValue(oper1);
              if (null == tail)
    System.out.println(val1 + ":" + value);               
                   return (val1 == value);
              else
                   if (OR.equals(operant))
                        return (val1 == value || tail.eval(value));
                   else if (AND.equals(operant))
                        return (val1 == value && tail.eval(value));
                   else
                        throw new Exception("unsupported operant " + operant);
         private int getValue(String operator) throws Exception
              Integer temp = ((Integer)Parser.symbol_table.get(operator));
              if (null == temp)
                   throw new Exception("symbol not found " + operator);
              return temp.intValue();
         public String toString()
              if (null == operant) return oper1;
              return oper1 + operant + tail.toString();
    public class Parser
         public static HashMap symbol_table = new HashMap();
          * recursive parsing
         public Expression parse(String s)
              ExpressionImpl e = new ExpressionImpl();
              e.oper1 = String.valueOf(s.charAt(0));
              if (s.length() == 1)
                   return e;
              else if (s.length() > 2)
                   e.operant = String.valueOf(s.charAt(1));
                   e.tail = parse(s.substring(2));
              else
                   throw new IllegalArgumentException("invalid input " + s);
              return e;
         public static void main(String[] args) throws Exception
              Parser p = new Parser();
              Parser.symbol_table.put("a", new Integer(1));
              Parser.symbol_table.put("b", new Integer(2));
              Parser.symbol_table.put("c", new Integer(3));
              Parser.symbol_table.put("d", new Integer(4));
              Expression e = p.parse("a|b|c&d");
              System.out.println("input " + e.toString());
              System.out.println(e.eval(2));
    }

  • Need Help to parse JAPANESE DateFormat

    Hi,
    fullPattern is yyyy'&#24180;'M'&#26376;'d'&#26085;' (EEEE) H'&#26178;'mm'&#20998;'ss'&#31186;' z. I changed the full pattern as
    String fullPattern = "yyyy\'\u5e74\'M\'\u6708\'d\'\u65e5\' (EEEE) H\'\u6642\'mm\'\u5206\'ss\'\u79d2\' z";
    full dateValue is 2010'&#24180;'09'&#26376;'12'&#26085;' (EEEE) 1'&#26178;'15'&#20998;'45'&#31186;' GMT
    String result = createBO("japanese full format",dateValue, fullPattern ,silkPageContext , false );
    In createBO method, I call some other method where I have to pass the pattern and value.
    When I pass fullPattern and dateValue as argument, It turns as
    2010'?'09'?'12'?' (EEEE) 1'?'15'?'45'?' GMT. Because of this, I am not able to parse this format. It gives parse Exception. I need to send this format as it is...
    Can I have some useful suggestion to do this.
    Thanks in Advance
    Suresh

    Break it into smaller pieces and try each one until you find the error.

  • Need help Loading parsed RSS text

    Hi, I have created an AS3 FLA where I am parsing and
    displaying RSS text. I have traced the parsed text and displayed
    the text into dynamic text boxes on the stage no problem.
    However the line breaks in the traced text show up on stage
    as well.
    How does one strip out the <p> or </r> tags from
    the text to make the text one nice long line that will wrap using
    the length of the text box as it's parameters?

    OK, I have found the answer, thanks all.
    var myvar:String = myDynamicText.text;
    myDynamicText.text = myvar.split("\r").join(" ");
    myDynamicText.text = myDynamicText.text.split("\n").join("

  • Need help with error: XML parser failed: Error An exception occurred! Type:......

    <p>Need help with the following error.....what does it mean....</p><p>28943 3086739136 XML-240304 3/7/07 7:13:23 PM |SessionNew_Job1<br /><font color="#ff0000">28943 3086739136 XML-240304 3/7/07 7:13:23 PM XML parser failed: Error <An exception occurred! Type:UnexpectedEOFException, Message:The end of input was not expected> at</font><br />28943 3086739136 XML-240304 3/7/07 7:13:23 PM line <7>, char <8> in <<?xml version="1.0" encoding="WINDOWS-1252" ?><br />28943 3086739136 XML-240304 3/7/07 7:13:23 PM <DSConfigurations><br />28943 3086739136 XML-240304 3/7/07 7:13:23 PM <DSConfiguration default="true" name="Configuration1"><br />28943 3086739136 XML-240304 3/7/07 7:13:23 PM <case_sensitive>no</case_sensitive><br />28943 3086739136 XML-240304 3/7/07 7:13:23 PM <database_type>Oracle</database_type><br />28943 3086739136 XML-240304 3/7/07 7:13:23 PM <db_alias_name1>ODS_OWNER</db_alias_name1><br />28943 3086739136 XML-240304 3/7/07 7:13:23 PM <db_ali>, file <>.<br />28943 3086739136 XML-240307 3/7/07 7:13:23 PM |SessionNew_Job1<br />28943 3086739136 XML-240307 3/7/07 7:13:23 PM XML parser failed: See previously displayed error message.</p><p>Any help would be greatly appreciated.  It&#39;s something to do with my datasource and possibly the codepage but I&#39;m really not sure.</p><p>-m<br /></p>

    please export your datastore as ATL and send it to support. Somehow the internal language around configurations got corrupted - never seen before.

  • Need help on xml parsing... no body replied at xml forum...plz help

    it 's 10g
    set serveroutput on
    set line 2000
    drop table emp;
    CREATE TABLE EMP (
      EMPNO     NUMBER(10),
      ENAME     VARCHAR2(10),
      JOB       VARCHAR2(9),
      MGR       NUMBER(4),
      HIREDATE  DATE,
      SAL       NUMBER(7, 2),
      COMM      NUMBER(7, 2),
      DEPTNO   NUMBER(2));
    DECLARE
      l_bfile   BFILE;
      l_clob    CLOB;
      l_parser  dbms_xmlparser.Parser;
      l_doc     dbms_xmldom.DOMDocument;
      l_nl      dbms_xmldom.DOMNodeList;
      l_n       dbms_xmldom.DOMNode;
      l_temp    VARCHAR2(1000);
      TYPE tab_type IS TABLE OF emp%ROWTYPE;
      t_tab  tab_type := tab_type();
    BEGIN
      l_bfile := BFileName('ADMIN1_DIR', 'emp.xml');
      dbms_lob.createtemporary(l_clob, cache=>FALSE);
      dbms_lob.open(l_bfile, dbms_lob.lob_readonly);
      dbms_lob.loadFromFile(dest_lob => l_clob,
                            src_lob  => l_bfile,
                            amount   => dbms_lob.getLength(l_bfile));
      dbms_lob.close(l_bfile);
      -- make sure implicit date conversions are performed correctly
      dbms_session.set_nls('NLS_DATE_FORMAT','''DD-MON-YYYY''');
      -- Create a parser.
      l_parser := dbms_xmlparser.newParser;
      -- Parse the document and create a new DOM document.
      dbms_xmlparser.parseClob(l_parser, l_clob);
      l_doc := dbms_xmlparser.getDocument(l_parser);
      -- Free resources associated with the CLOB and Parser now they are no longer needed.
      dbms_lob.freetemporary(l_clob);
      dbms_xmlparser.freeParser(l_parser);
      -- Get a list of all the EMP nodes in the document using the XPATH syntax.
      --l_nl := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),'/EMPLOYEES/EMP');
    l_nl := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),'/ipdrIPDR');
      -- Loop through the list and create a new record in a tble collection
      -- for each EMP record.
      FOR cur_emp IN 0 .. dbms_xmldom.getLength(l_nl) - 1 LOOP
        l_n := dbms_xmldom.item(l_nl, cur_emp);
        t_tab.extend;
        -- Use XPATH syntax to assign values to he elements of the collection.
    --    dbms_xslprocessor.valueOf(l_n,'recordId/text()',t_tab(t_tab.last).empno);
        dbms_xslprocessor.valueOf(l_n,'recordId/text()',t_tab(t_tab.last).ename);
        dbms_xslprocessor.valueOf(l_n,'JOB/text()',t_tab(t_tab.last).job);
        dbms_xslprocessor.valueOf(l_n,'MGR/text()',t_tab(t_tab.last).mgr);
        dbms_xslprocessor.valueOf(l_n,'HIREDATE/text()',t_tab(t_tab.last).hiredate);
        dbms_xslprocessor.valueOf(l_n,'SAL/text()',t_tab(t_tab.last).sal);
        dbms_xslprocessor.valueOf(l_n,'COMM/text()',t_tab(t_tab.last).comm);
        dbms_xslprocessor.valueOf(l_n,'DEPTNO/text()',t_tab(t_tab.last).deptno);
      END LOOP;
      -- Insert data into the real EMP table from the table collection.
      -- Form better performance multiple collections should be used to allow
      -- bulk binding using the FORALL construct but this would make the code
      -- too long-winded for this example.
      FOR cur_emp IN t_tab.first .. t_tab.last LOOP
        INSERT INTO emp
         ename
        VALUES
         t_tab(cur_emp).ename
      END LOOP;
      COMMIT;
      -- Free any resources associated with the document now it
      -- is no longer needed.
      dbms_xmldom.freeDocument(l_doc);
    EXCEPTION
      WHEN OTHERS THEN
        dbms_output.put_line('errrrrrrrr--->'||sqlerrm);
       dbms_lob.freetemporary(l_clob);
        dbms_xmlparser.freeParser(l_parser);
        dbms_xmldom.freeDocument(l_doc);
    END;
    /select * from emp;
    this file works fine
    <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
    <ipdrIPDR>
    <recordId>923622</recordId>
    </ipdrIPDR>
    but this is not . .. note my special charter in the tokens... i did change in the program too but does not work ...
    <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
    <ipdr:IPDR>
    <recordId>923622</recordId>
    </ipdr:IPDR>
    I get error
    errrrrrrrr--->ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00234: namespace prefix "ipdr" is not declared
    Error at line 2
    PL/SQL procedure successfully completed.

    Hi,
    Yes, I have tried the same method. will be ok.
    But I have got another some records on the same column as follows.
    I have tried with another one xmltable with outer join(+), still not getting the actual data (null record from the original(main) table) and extra records from the new xmltable.
    Is it possible to make one or union with xmltable also can we check the node either /Item or /section exists something like that
    <?xml version="1.0" encoding="WINDOWS-1252"?>
    <section>
      <sectionmetadata>
        <object_id>317832</object_id>
        <asitype>Section</asitype>
        <instructornotes/>
      </sectionmetadata>
      <selection_ordering>
        <selection seltype="All">
          <selection_number>1</selection_number>
          <or_selection>
            <selection_metadata mdoperator="EQ" mdname="questionid">_155451_1</selection_metadata>
          </or_selection>
        </selection>
        <selection seltype="All">
          <or_selection>
            <selection_param pname="singleLink">true</selection_param>
          </or_selection>
        </selection>
      </selection_ordering>
    </section>Thanks,

Maybe you are looking for

  • F.19 report showing wrong values (GR/IR)

    Hello, At my company, they run the MR11 to check for GR/IR variances and then clear these variances using the F.13 transaction. However, when the F.19 transaction is run to analyze the GR/IR clearing account, there are some old PO's belonging to year

  • Plz give the ans

    1)why we used tiff file in  scripts? 2) if we have a quality client 300 in this client is it works scripts? 3) what is difference 4.6 c and 4.7 EE version? 4) give me some idea about ecc 6.0  version? 5) what is the purpose of code inspector? 6) in L

  • Illustrator CS 5.1 freezing when selecting File Open

    Hi - Recently Illustrator CS 5.1 will not let me use File >> Open to open a document. It immediately hangs and I get the beach ball and have to force quit (on a Mac) and in the force quit menu the program name will turn to red and say not responding.

  • Windows 7 installed fine, now my mac side does not work!! PLEASE HELP

    Hello, i have installed windows 7 fine today on my Macbook pro, and it works perfect. Now when i want to use the mac side of the Laptop, is comes up with the apple in the center as usual, then the screen turns grey with writing (somthing about stuff

  • Url line disappeared!

    Hi, I tried to add a new top site in an opening window and dragged url line down. It crashed like if thrown in a bin and disappeared!!!! (I can't really open websites now, unless I go to history and google it.) Could you please help to move the url l