Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8846451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:59:20+00:00 2026-06-14T11:59:20+00:00

I’m trying to parse an XML file that is generated from our system where

  • 0

I’m trying to parse an XML file that is generated from our system where there are multiple child elements generated, but are “together” since they have a subchild element that is the same.

To make sense of the partial xml code I pasted below…

Each record is identified by it’s order # and then it contains info for that shipment and at the end lists an individual item that’s for that order with it’s specs.

<forward_agent>
    <record>
      <order>562490</order>
      <mfg._del_date>11-19-2008</mfg._del_date>
      <forw.agent>263</forw.agent>
      <customer>120</customer>
      <name>BLUEBERRY AUBURN HILLS</name>
      <item>&apos;28.1461.00</item>
      <ordered>1.0000</ordered>
      <warehouse>001</warehouse>
      <desitnation_city_state>AUBURN HILLS  MI</desitnation_city_state>
      <weight>60.1201</weight>
      <size>9.70</size>
</record>
<record>
      <order>562490</order>
      <mfg._del_date>11-19-2008</mfg._del_date>
      <forw.agent>263</forw.agent>
      <customer>120</customer>
      <name>BLUEBERRY AUBURN HILLS</name>
      <item>&apos;545</item>
      <ordered>1.0000</ordered>
      <warehouse>002</warehouse>
      <desitnation_city_state>AUBURN HILLS  MI</desitnation_city_state>
      <weight>82.0120</weight>
      <size>12.86</size>
</record>
<record>
      <order>&#160;</order>
      <mfg._del_date>&#160;</mfg._del_date>
      <forw.agent>&#160;</forw.agent>
      <customer>&#160;</customer>
      <name>&#160;</name>
      <item>&apos;</item>
      <ordered>&#160;</ordered>
      <warehouse>&#160;</warehouse>
      <desitnation_city_state>Total Lbs:</desitnation_city_state>
      <weight>1658.1342</weight>
      <size>199.36</size>
</record>
    <record>
      <order>562136</order>
      <mfg._del_date>11-19-2008</mfg._del_date>
      <forw.agent>263</forw.agent>
      <customer>133</customer>
      <name>BLUEBERRY ALBUQUERQUE</name>
      <item>&apos;4635</item>
      <ordered>2.0000</ordered>
      <warehouse>002</warehouse>
      <desitnation_city_state>EL PASO  TX</desitnation_city_state>
      <weight>23.9863</weight>
      <size>4.00</size>
</record>
<record>
      <order>562136</order>
      <mfg._del_date>11-19-2008</mfg._del_date>
      <forw.agent>263</forw.agent>
      <customer>133</customer>
      <name>BLUEBERRY ALBUQUERQUE</name>
      <item>&apos;5590</item>
      <ordered>1.0000</ordered>
      <warehouse>002</warehouse>
      <desitnation_city_state>EL PASO  TX</desitnation_city_state>
      <weight>0.0000</weight>
      <size>0.00</size>
</record>
<record>
      <order>562136</order>
      <mfg._del_date>11-19-2008</mfg._del_date>
      <forw.agent>263</forw.agent>
      <customer>133</customer>
      <name>BLUEBERRY ALBUQUERQUE</name>
      <item>&apos;5591</item>
      <ordered>1.0000</ordered>
      <warehouse>002</warehouse>
      <desitnation_city_state>EL PASO  TX</desitnation_city_state>
      <weight>436.0082</weight>
      <size>96.67</size>
</record>
<record>
      <order>&#160;</order>
      <mfg._del_date>&#160;</mfg._del_date>
      <forw.agent>&#160;</forw.agent>
      <customer>&#160;</customer>
      <name>&#160;</name>
      <item>&apos;</item>
      <ordered>&#160;</ordered>
      <warehouse>&#160;</warehouse>
      <desitnation_city_state>Total Lbs:</desitnation_city_state>
      <weight>5093.0928</weight>
      <size>613.88</size>
</record>

I’d like the output to be grouped by Order # and look something similar to this:

Item         Ordered    Weight          Size
1221         1          320.6734        31.36
1601         1          34.0724         11.42
2122         1          86.0023         12.79
5543.SP      1          1075.254        121.23
28.1461.00       1          60.1201         9.7
545              1          82.012          12.86
            Total Lbs:  1658.1342       199.36

Ultimately this is so that I can sort out orders based on total weight and size or a particular item.

—EDIT—

Shows input boxes now, but they aren’t getting filled with anything.

Current js code

$(document).ready(function()
{
  $.ajax({
    type: "GET",
    url: "b2.xml",
    dataType: "xml",
    success: function(response) { parseXML(response); }
  });
});

var recordList =[];

function parseXML(xml) {
$(xml).find('record').each(function () {
    var entry = new Object();
    entry.order= $(this).find('order').text();
    entry.delDate= $(this).find('mfg._del_date').text();
    entry.forw = $(this).find('forw.agent').text();
    entry.customer= $(this).find('customer').text();
    //
    //

    recordList.push(entry);

});
send(); // handles xml after parsed
}

function send(){
     // for each row of a table
     for(var i = 0; i < $("#table tr").size(); i++){
         $('#orderNum' + i).val(recordList[i].order);
         $('#delDate' + i).val(recordList[i].delDate);
         $('#forw' + i).val(recordList[i].forw);
         $('#customer' + i).val(recordList[i].customer);
     }
 }

Current html code

    <html>
<head>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
    <script type="text/javascript" src="parser.js"></script>
</head>
<body>
<table>
    <tr>
        <td>Order #</td>
        <td>Delete Date</td>
        <td>Forward</td>
        <td>Customer</td>
    </tr>
    <tr>
        <td><input id="orderNum0" type="text" /></td>
        <td><input id="delDate0" type="text" /></td>
        <td><input id="forw0" type="text" /></td>
        <td><input id="customer0" type="text" /></td>
    </tr>
</table>
</body>
</html>

Here’s a screenshot:

http://s16.postimage.org/rd1uahm4j/localhost_ftl_parser_html.png

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T11:59:21+00:00Added an answer on June 14, 2026 at 11:59 am

    Record.js

    $(document).ready(function(){
    
    $.ajax({
    type: "GET",
    url: "record.xml", 
    dataType: "xml",
    success: function(xml){
        parseXML(xml); 
    },
    error: function(response, textStatus, errorThrown){ 
        console.log(textStatus, errorThrown);}
       });
    });
    
    var recordList =[];
    
    function parseXML(xml) {
    $(xml).find('record').each(function () {
    var entry = new Object();
    entry.order= $(this).find('order').text();
    entry.delDate= $(this).find('mfg').text();
    entry.forw = $(this).find('forw').text();
    entry.customer = $(this).find('customer').text();
    entry.name = $(this).find('name').text();
    entry.item = $(this).find('item').text();
    entry.ordered = $(this).find('ordered').text();
    entry.warehouse = $(this).find('warehouse').text();
    entry.destination = $(this).find('desitnation_city_state').text();
    entry.weight = $(this).find('weight').text();
    entry.size = $(this).find('size').text();
    
    recordList.push(entry);
    });
    send(); // handles xml after parsed
    }
    
    function send(){
     // for each row of a table
     addRows();
     for(var i = 0; i < recordList.length; i++){
         $('#orderNum' + i).val(recordList[i].order);
         $('#delDate' + i).val(recordList[i].delDate);
         $('#forw' + i).val(recordList[i].forw);
         $('#customer' + i).val(recordList[i].customer);
         $('#name'+i).val(recordList[i].name);
         $('#item'+i).val(recordList[i].item);
         $('#ordered'+i).val(recordList[i].ordered);
         $('#warehouse'+i).val(recordList[i].warehouse);
         $('#destination'+i).val(recordList[i].destination);
         $('#weight'+i).val(recordList[i].weight);
         $('#size'+i).val(recordList[i].size);
    
         }
      }
    
     function addRows(){
          for(var i = 1; i < recordList.length; i++){
             var newField = "<tr><td><input id=\"orderNum"+i+"\" size=\"10\" type=\"text\"    </td>"+
                            "<td><input id=\"delDate"+i+"\" size=\"10\" type=\"text\"</td>"+
         "<td><input id=\"forw"+i+"\" size=\"10\" type=\"text\"</td>"+
         "<td><input id=\"customer"+i+"\" size=\"10\" type=\"text\"</td>"+
         "<td><input id=\"name"+i+"\" size=\"10\" type=\"text\"</td>"+
         "<td><input id=\"item"+i+"\" size=\"10\" type=\"text\"</td>"+
         "<td><input id=\"ordered"+i+"\" size=\"10\" type=\"text\"</td>"+
         "<td><input id=\"warehouse"+i+"\" size=\"10\" type=\"text\"</td>"+
         "<td><input id=\"destination"+i+"\" type=\"text\"</td>"+
         "<td><input id=\"weight"+i+"\" size=\"10\" type=\"text\"</td>"+
         "<td><input id=\"size"+i+"\" size=\"10\" type=\"text\"</td></tr>"
    
         $('#tableId').append(newField);
            }
       }   
    

    Record.html

          <html>
         <head>
         <meta http-equiv="content-type" content="text/html; charset=UTF-8">
          <script type="text/javascript"   src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
          <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
           <script type="text/javascript" src="records.js"></script>
       </head>
    <body>
    <table id="tableId">
        <tr>
            <td>Order #</td>
            <td>Delete Date</td>
            <td>Forward</td>
            <td>Customer</td>
        <td>Name</td>
        <td>Item</td>
        <td>Ordered</td>
        <td>Warehouse</td>
        <td>Destination</td>
        <td>Weight</td>
        <td>Size</td>
    </tr>
    <tr>
        <td><input id="orderNum0" size="10" type="text" /></td>
        <td><input id="delDate0" size="10" type="text" /></td>
        <td><input id="forw0" size="10" type="text" /></td>
        <td><input id="customer0" size="10" type="text" /></td>
    <td><input id="name0" size="10" type="text" /></td>
    <td><input id="item0" size="10" type="text" /></td>
    <td><input id="ordered0" size="10" type="text" /></td>
    <td><input id="warehouse0"size="10"  type="text" /></td>
    <td><input id="destination0" type="text" /></td>
    <td><input id="weight0"size="10"  type="text" /></td>
    <td><input id="size0" size="10" type="text" /></td>
    </tr>
    </table>
    </body>
    </html>
    

    There is only one issue and that is with your xml entries with the name of forw.agent and mfg.del_date.. you’ll have to escape some of those characters but this adds rows and adds values to those tables.. this is a rough page thrown together and you have liberties to change things as you please.. especially the input box’s you can change those to labels or what have you.. but this parses and displays.. as per requested

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I am trying to render a haml file in a javascript response like so:
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to select an H1 element which is the second-child in its group
I know there's a lot of other questions out there that deal with this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.