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 7053107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:27:53+00:00 2026-05-28T03:27:53+00:00

I’m parsing an xml to append() to a table and the problem is that

  • 0

I’m parsing an xml to append() to a table and the problem is that the xml come in with diferent columns depending on the product. So if it’s product: A, give me 4 columns, Product: B gives me 3 columns, product: C gives 2 columns…and so on. Also, the column header are in the product node.

Is there a way to set how many columns come in, set column headers and iterate through?

<rates>
<response_code>0</response_code>
<countryID>36</countryID>
<country_name>Brazil</country_name>
<destination_area_code>55</destination_area_code>
<destination_description>Brazil</destination_description>
<destination_currency>USD</destination_currency>
<currency_symbol>$</currency_symbol>
<product columns="4">
    <destination_rate_1>0.05920</destination_rate_1>
    <product_name_1>Global Landline</product_name_1>
    <destination_rate_2>0.14080</destination_rate_2>
    <product_name_2>National Landline</product_name_2>
    <destination_rate_3>0.06920</destination_rate_3>
    <product_name_3>Local Landline</product_name_3>
    <destination_rate_4>0.06920</destination_rate_4>
    <product_name_4>Global LD</product_name_4>
</product>
</rates>

<rates>
<response_code>0</response_code>
<countryID>23</countryID>
<country_name>Dubai</country_name>
<destination_area_code>39</destination_area_code>
<destination_description>Dubai</destination_description>
<destination_currency>USD</destination_currency>
<currency_symbol>$</currency_symbol>
<product columns="4">
    <destination_rate_1>0.06950</destination_rate_1>
    <product_name_1>Global Landline</product_name_1>
    <destination_rate_2>0.13820</destination_rate_2>
    <product_name_2>National Landline</product_name_2>
    <destination_rate_3>0.04520</destination_rate_3>
    <product_name_3>Local Landline</product_name_3>
    <destination_rate_4>0.05830</destination_rate_4>
    <product_name_4>Global LD</product_name_4>
</product>
</rates>

The table end result

This is the result table for this product. The xml brings in 4 columns. If I select a different product, the xml would bring in 2 or 3..

http://jsfiddle.net/HQwT8/

  • 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-05-28T03:27:53+00:00Added an answer on May 28, 2026 at 3:27 am

    So what you really need to do is destroy the entire table and create a new one, but reuse the same styles.

    As for how many columns there are, you have that as an attribute in your XML already. Just parseInt that attribute, or use $(node).children().length to count them explicitly.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm parsing an XML file, the creators of it stuck in a bunch social
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I used javascript for loading a picture on my website depending on which small
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from

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.