PrettyXML

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
http://www.belle-nuit.com/download/prettyxml.sit.hqx

PrettyXML works with REALBasic 5.5 or later. It is self-contained. It should work on Windows, but it hasn't been tested for.

Methods

AppendNewChild(extends parent as XmlNode, key as string) as XmlNode

Creates a new XmlNode and appends it to the parent.

child = parent.appendnewchild("child")

AppendSimpleChild(extends parent as XmlNode, key as string, value as variant)

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

Indent(extends parent as XmlNode, level as integer)

Adds textnodes to create a pretty textfile. You only have to call this method for the root, the children will be called recursively.

root.indent(0)

Terms of use / Disclaimer

© 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 matti@belle-nuit.com

The latest version is available at http//www.belle-nuit.com/

History

8.4.4 Release 1.0


Mastodon