0

I've perused this forum and various blogs and tutorial sites trying to get a better understanding of what is good vs. bad schema structures in XML. I recently inherited an kml file where the xml tree structure is like so:

(directory)
    (folder)
        (name)roadway(/name)
             (folder)
                 (name)roadway(/name)
                      (folder)
                          (name)roadway(/name)
                                (folder)
                                    (name)roadway(/name)
                                          (folder)
                                                (name)random(/name)
                                                (point)4.333(/point)
                                          (/folder)
                                (/folder)
                       (/folder)
              (/folder)
     (/folder)
     (folder)
          (name)roadway(/name)
           .......
     (/folder)
     ......
(/directory)

I only have a basic understanding of XML structures...my two questions are:

1) when would it ever be necessary to have multiple levels of children all with the same name, (such as the element "roadway" in the example above)

2) am I right in thinking that this is inefficient and poorly structured? Or is there something I'm missing regarding tree structures?

I do realize that there are times when you can have child elements that share the same name as a parent (or grandparent) element. However, for this particular xml file there are no attributes and no other elements in the tree until you reach the bottom (where there is gps coordinates and other information relevant to that point). I can't think of a reason why it would need to be set up this way, but with my limited knowledge I wanted to get other people's opinions.

If there is a relevant question posted with the answer, please let me know and I will delete this one.

geo_coder
  • 713
  • 3
  • 7
  • 17
  • 1
    If there is no distinction between roadway at the various nesting then your example is overly nested. Nesting is typically used to group large numbers of features into smaller and smaller logical groups. – CodeMonkey Jun 03 '16 at 12:15
  • That's what I was thinking. I acknowledge that recursive hierarchies aren't wrong - the xml would and does pass an evaluation for schema errors, but it seems illogical to have no distinction between various levels of nesting. I'm just going to have to restructure it and get rid of all the meaningless nesting. – geo_coder Jun 03 '16 at 21:49

1 Answers1

0

Recursive hierarchies are very common: sections in a document are nested, parts in a manufacturing assembly are nested, administrative areas in a country are nested, departments in a company are nested, folders in computer filestore are nested, categories in a taxonomy are nested. Nothing wrong with it at all.

Michael Kay
  • 156,231
  • 11
  • 92
  • 164