When using the XMLWriter with Linx, one can create really well-formed XML documents. However, there are different standards of XML documents used in the industry today. For that you need to transform a document to fit into your required form.
Feel free to contact email@example.com and we'll assist.
Please note the terms ‘Process’ and ‘Custom Type’ have been depreciated and have been replaced with ‘Function’ and ‘Type’ respectively. More details here.
As a recent example shows, an XML document was needed for a structure of a document. The structure was created by using Custom Types in Linx:
This structure was loaded with some data and fed into an XMLWriter.
The resultant XML was well-formed, however, the required structure needed that the list of Document Info tags (DocInf) be shown an separate DocInf objects, not Item objects, and also no empty tags were allowed. The plain XML looked like this:
Now, its here where Linx provides a very nice ability, to use XSLT (Extensible Stylesheet Language Transformations) to change your XML in any way possible. For this example we’ve set up an XSLT script that removed the overarching “DocInf” tag, changed the “Item” tags to “DocInf” tags and removed all empty tags:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output omit-xml-declaration="no" method="xml" indent="yes" encoding="UTF-8"/> <xsl:strip-space elements="*"/> <xsl:template match="node()[not(self::DocInf)]|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> <xsl:template match="DocInf/Item"> <DocInf><xsl:apply-templates select="@*|node()" /></DocInf> </xsl:template> <xsl:template match= "*[not(@*|*|comment()|processing-instruction()) and normalize-space()='' ]"/> </xsl:stylesheet>
This XSLT template then changed the XML to adhere to the required form: