XML can sometimes be a bit confusing, so here are some tips to help you work with XML files.
First, you need to make sure your XML is really XML.
Comments closedBlog about the Xojo programming language and IDE
XML can sometimes be a bit confusing, so here are some tips to help you work with XML files.
First, you need to make sure your XML is really XML.
Comments closedAlthough Xojo does not have a built-in method to format XML text, you can use XSLT to do this for you. XSLT stands for eXtensible Stylesheet Language. This XSLT can be used to format XML:
<?xml version="1.0" encoding="UTF-8"?> <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="yes" /> <xsl:template match="/"> <xsl:copy-of select="/" /> </xsl:template> </xsl:transform>
To use this with Xojo, add a module to your project (name it XMLExtensions), add a String constant to the module (call it kXSLTFormat) and copy the above XSLT into the constant.
Comments closedI recently had a customer ask about how to adjust XML structure and whether one format is better than another.
They had XML in this format:
<?xml version="1.0" encoding="UTF-8"?> <xmldata> <row username="Mary" message="Welcome!" disable="NO"/> </xmldata>
That XML was generated using code like this:
Comments closed