Xml manipulation
Monkey Forums/Monkey Programming/Xml manipulation
| ||
I might be missing something here, but does Monkey support loading, querying and saving xml documents? Thanks |
| ||
Not out of the box. You can use the xml parser in diddy however. |
| ||
<?xml version="1.0 ?> <hello> <world foo="bar" /> <world foo="baz">woot</world> </hello> [monkeycode]Local parser:XMLParser = New XMLParser Local doc:XMLDocument = parser.ParseFile("somefile.xml") Print doc.Root.Name For Local node:XMLElement = EachIn doc.Root.Children Print node.GetAttribute("foo") Print node.Value Next[/monkeycode] hello bar baz woot It basically builds a tree of XMLElement instances, where doc.Root is the root node. GetAttribute takes an optional default value, and you can use HasAttribute to check if it's there. Name is the node name, Value is the contents (raw text). |