Thank you so much, I have to learning fast and example are usefull for me, since I'm not expert in syntax.
Anyway, i tried to apply your example to a xml download from wikipedia and it don't work, probably i did some error:
- String xml_url = "http://en.wikipedia.org/wiki/Special:Export/Bauhaus";
- XML xml_0 = loadXML( xml_url );
- String s = xml_0.getChild("page/revision/text").getContent()
- .replaceAll("\\[", "")
- .replaceAll("\\]", "")
- .replaceAll("\\{", "")
- .replaceAll("\\}", "");
- XML xml = XML.parse("<x>" + s + "</x>"); // Real XML must have a root node
-
- XML[] tags = xml.getChildren("ref");
-
- for (XML ref : tags)
- {
- xml.removeChild(ref);
- }
- println(xml);
I also have to say that I found on the forum another example posted by you that work directly on the generated string:
It seems to work for me, I would be grateful if you could explain where I'm wrong alsoin XML, because I want to learn how to work on the tree structure.