NOP Design Home Page
Documentation
TOC/Index
Search
Downloads



SplitXml

Splits a XML content in string to an associative array

Sample Source

<SIML WalkChildren REQUIRES MyArray For Input, strDepth For Input>

   ForEach Key As Value In MyArray
      If (IsArray Value) Then
         Say "\n" + strDepth + "<" + Key + ">"

         Call "WalkChildren" With Value, (strDepth + "   ")

         Say "\n</" + Key + ">"
      Else
         Say "\n" + strDepth + "<" + Key + ">"
         Say Value
         Say "</" + Key + ">"
      EndIf
   Loop

   Return 0
</SIML>


xmlString := "<?xml version=\"1.0\" standalone=\"no\" ?>
<sample1>
        <subsample1>Sample Text 1</subsample1>
        <subsample2>Sample Text 2a</subsample2>
        <subsample2>Sample Text 2b</subsample2>
</sample1>
<sample2>Other!</sample2>
"


MyArray := SplitXml xmlString

Say "\n"
Call "WalkChildren" With MyArray, ""
Say "\n"

Related Function(s):
   Split;

Minimum version: 4.8, build 20050913