Liquid XML Data Binder 2020
Liquid XML Data Binder (C++, Java, VB6) / Using the Code / Changing the exported XML / Adding Processing Instructions
In This Topic
    Adding Processing Instructions
    In This Topic

    Adding Processing Instructions

    Problem

    It is sometimes necessary to add in custom Processing Instructions to the start of the XML file you are writing out. Common examples of this are the addition of style sheet directives.
    i.e.

    <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="simple.xsl"?> <breakfast_menu/>

    Resolution

    The SerializationContext object controls the details of how XML is read and written from the generated libraries.
    The ProcessingInstructions collection allows new processing instructions to be added to the output XML.

    Samples

      C++

    LtXmlLib18::CSerializationContext::GetDefaultContext().GetProcessingInstructions().push_back( _T("<?xml-stylesheet type=\"text/xsl\" href=\"simple.xsl\"?>"));

      C#

    using LiquidTechnologies.Runtime.Net40; ... SerializationContext.Default.ProcessingInstructions.Add( "<?xml-stylesheet type=\"text/xsl\" href=\"simple.xsl\"?>");

      Java

    import com.liquid_technologies.ltxmllib18; ... SerializationContext.Default.getProcessingInstructions.add( "<?xml-stylesheet type=\"text/xsl\" href=\"simple.xsl\"?>");

      Visual Basic

    DefaultXmlSerializationContext.ProcessingInstructions.Add _ "<?xml-stylesheet type="text/xsl" href="simple.xsl"?>"

    Sample Output

    <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="simple.xsl"?> <ElmDerivedType1 ...


    Notes

    Description Value
    Article Created 5/2/2006
    Applies to Liquid XML 2005 and greater
    Also See Controlling the Output XML
      Using the libraries in a multithreaded environment