• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

An interview Question about XML

 
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys,

Recently, I got an interview about xml. I am not so sure about XML since I never used it to represent data.

How to use xml to represent several the same data just like the loop in Java?

It is possible? I check the xml's syntax, and I think it is impossible. It all depends on the client who uses XML data.

Am I right?

Please give me an answer.

Thank you in advance.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

How to use xml to represent several the same data just like the loop in Java?



That statement seems to mix up data representation with program structure

If you mean can XML represent repeating elements such as an array then the answer is yes.

Bill
[ November 15, 2007: Message edited by: William Brogden ]
 
Sam Sunamin
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you mean can XML represent repeating elements such as an array then the answer is yes.

How do you do this? I tried to find from w3c but I cannot find it.

Thank you in advance.
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Suppose we are going to represent an array of integers:

<values>
<val n="0">100</val>
<val n="1">220</val>
<val n="2">456</val>
</values>

Here the <values> element contains repeating elements - each one has an attribute giving an index (not really necessary, just to demo) and a text node content string value.

Don't get discouraged, it takes a while to get your head wrapped around the possibilities of XML.

Bill
 
reply
    Bookmark Topic Watch Topic
  • New Topic