42 lines
793 B
Markdown
42 lines
793 B
Markdown
|
|
|
|
## api.parser.xml
|
|
|
|
```lua
|
|
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)
|
|
```
|