Liquid XML Data Binder (C++, Java, VB6) / Using the Code / How do I control the exported XML?
In This Topic
    How do I control the exported XML?
    In This Topic

    Problem

    There are a number of things that you may want to tweak the exported XML.
    This is a summary id what can be done, and where you can find more information about it.

    <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="simple.xsl"?> <!--Created by Liquid XML Data Binding Libraries (www.liquid-technologies.com) for Liquid Technologies Limited--> <cg:ElmMixedNamespace2 xmlns:s-o="http://www.someother.com" xmlns:cg="http://www.code-generator.com/nstest" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.code-generator.com/nstest ElmNamespace.xsd"> <cg:Thing1>LocalThing1Value</cg:Thing1> <cg:Thing2>LocalThing2Value</cg:Thing2> <s-o:BasicElement> <s-o:StringElm>ImportedBasicElementValue</s-o:StringElm> </s-o:BasicElement> <cg:RefComplexType> <s-o:StringElm>ImportedBasicComplexTypeValue</s-o:StringElm> </cg:RefComplexType> </cg:ElmMixedNamespace2>

    Language Encoding

    The language Encoding can be changed via the ToXml Method - (C++, C#, Java, Visual Basic 6)

    Removing the comments

    The comments line <!--Created by Liquid XML Data Binding Libraries (www.liquid-technologies.com) for Liquid Technologies Limited--> can be removed from the output.
    See Removing the Comments from the exported XML

    Removing optional attribute default values

    Optional attribute default values are automatically added to the output XML document, the behaviour can be changed.
    See Removing Optional Attribute Default values from the exported XML

    Processing Instructions

    Processing instructions can be added to the XML using the SerializationContext Object (C++, C#, Java, Visual Basic 6).
    In the sample above this is the style <?xml-stylesheet type="text/xsl" href="simple.xsl"?>
    See Adding Processing Instructions

    Changing the Namespace Aliases

    In the above example if you wanted to alias the namespace http://www.someother.com using something other than s-o, then you can change this setting by using the SerializationContext Object (C++, C#, Java, Visual Basic 6).
    See Changing namespace aliases

    Providing a default namespace

    In the above example you could make http://www.code-generator.com/nstest the default namespace. This would mean that you would not have to qualify all the elements (loose the cg: prefix on all the elements). This can be accomplished using the SerializationContext Object (C++, C#, Java, Visual Basic 6).
    See Creating a Default Namespace.

    Removing a namespace Alias

    Sometimes you don't want the namespace aliases defined in the root element. In this example the namespace http://www.w3.org/2001/XMLSchema-instance is aliases as xs. In the example it is not used (an thus not required). This can be removed via the SerializationContext Object (C++, C#, Java, Visual Basic 6).
    See Removing a namespace alias

    Notes

    Description Value
    Article Created 8/2/2006
    Versions Liquid XML 2005 (4.1.0) and greater
    Also See Multithreaded Application, Controlling Validation