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
![]() ![]() |
---|
LtXmlLib20::CSerializationContext::GetDefaultContext().GetProcessingInstructions().push_back( _T("<?xml-stylesheet type=\"text/xsl\" href=\"simple.xsl\"?>")); |
![]() ![]() |
---|
using LiquidTechnologies.Runtime.Net40; ... SerializationContext.Default.ProcessingInstructions.Add( "<?xml-stylesheet type=\"text/xsl\" href=\"simple.xsl\"?>"); |
![]() ![]() |
---|
import com.liquid_technologies.ltxmllib20; ... SerializationContext.Default.getProcessingInstructions.add( "<?xml-stylesheet type=\"text/xsl\" href=\"simple.xsl\"?>"); |
![]() ![]() |
---|
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 ...
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 |