This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JQuery XML parsing and HTML construction

 
Tarik Ansari
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am in need of a technical expertise inorder to format XML and render in below html format. i have been using JQuery XML parser and i need help in constructing the html portion alone.

Data.xml


JQuery function



Below is the HTML output required


Since i am new to JQuery could you please help me in looping and rendering?

Any leads also much appreciated.

Thanks
Tarik
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What isn't working? You said you need help but you don't tell us about what specifically.
 
Tarik Ansari
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Below are my elaborations:

I need to generate the below HTML from the JQuery function.


I need your help in the looping/building part which groups and adds sub-categories to the HTML from XML:
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you said you need help. Tell us what specifically isn't working and what is happening instead. If you're not getting the desired output, what are you getting? Does it throw any errors? If so, what errors? TellTheDetails.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you really have a <bd> tag in your html that you are referencing with $('bd')?

Eric
 
Tarik Ansari
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Making it more clearer:
In the below XML i have the Category "Sales" 2 times and "Products" 4 times. I need to group those Categories as single "Sales" and "Products" and the corresponding number of URLMenu should come under those single categories.

Data.xml

JQuery Function

Expected Result:

Also note that "Products" has subcategory "International" in XML and it also needs to be listed.

Could you please help me in re-writing the JQuery function to support the expected result?

As of now i am getting all the XML "category" with the number of times the "Products" and "Sales" are present.

I am new to JQuery and have been breaking my heads for days. Your help will be highly appreciated.

Thanks
Tarik
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic