Three simple class extensions of XmlNode allow you to write more readable XML creation code.
Note: By readable i mean both more readable in the RB source code and the output XML file. These extensions work for most general uses, as they hide complexity of the XML API. There maybe occasions where they limit you - you should use then the generic Realbasic methods.
Download class and sample project
PrettyXML works with REALBasic 5.5 or later. It is self-contained. It should work on Windows, but it hasn't been tested for.
Creates a new XmlNode and appends it to the parent.
child = parent.appendnewchild("child")
Creates a new XmlNode and appends it to the parent and adds a textnode with value. Accepted value types are string, integer, double and boolean. The node is not returned, as this is a terminal node.
parent.appendsimplechild "child", value
Adds textnodes to create a pretty textfile. You only have to call this method for the root, the children will be called recursively.
© Belle Nuit Montage / Matthias Bürcher April 2004. All rights reserved. Written in Switzerland.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Comments please to firstname.lastname@example.org
The latest version is available at http//www.belle-nuit.com/
8.4.4 Release 1.0