3 Replies Latest reply on Dec 1, 2007 5:21 AM by patrickinmtl

    Multilevel structure to XML


      I have a multilevel structure that looks like that :
      a = structNew()
      a.a.a.a = apple
      a.a.a.b = banana
      a.a.b.a = potato
      a.b = beef

      What would be the best way of converting that structure in an XML document that would look like the following attached code ?

      Any suggestion ? The structure isn't always 4-levels deep. Sometimes it can be 3, 4, 8, 2...

      I thought I would just loop recursively over my structure : calling a method that would check if the item is a struct and if so create a new XML node inside the XML node being processed or else just put the value in node currently being open, then return the result back to the calling method... and so on.

      Is there any sort of code snippet that may convert a multilevel structure to an XML document ? All examples I've found so far only deals with one level.

      Thanks in advance,