xurfer/api.md

793 B

api.parser.xml

local xml     = api.parser.xml.newParser()

local testXml = [[
  <testOne param="param1value">
    <testTwo paramTwo="param2value">
    <testThree>
      testThreeValue
    </testThree>
    <testThree duplicate="one" duplicate="two">
      testThreeValueTwo
    </testThree>
    <test_Four something="else">
      testFourValue
    </test_Four>
    <testFive>
      <testFiveDeep>
        <testFiveEvenDeeper>
          <testSix someParam="someValue"/>
        </testFiveEvenDeeper>
      </testFiveDeep>
    </testFive>
      testTwoValue
    </testTwo>
  </testOne>
]]


util.traverseXML( xml:ParseXmlText(testXml),  function(node,raw)
  print_r(node)
--   {
--     tag = "div",
--     prop = {
--       style = "color:red; display:none"
--     }
--   }
end)