Liquid XML Data Binder 2020
How Do I Add Root Level Attributes?
Liquid XML Data Binder (C++, Java, VB6) > Using the Code > Changing the exported XML > How Do I Add Root Level Attributes?

How Do I Add Root Level Attributes?


It is sometimes necessary to add additional attributes to the root element, a good example is the schemaLocation attribute which indicates where the schema that validates the document can be found.


The code below demonstrates how to insert the schemaLocation item into the root element

<?xml version="1.0"?> <purchaseReport xmlns=""                 xmlns:xsi=""                 xsi:schemaLocation="       ">         ... </purchaseReport>

Sample Code


CLtXmlLib18::CSerializationContext::GetDefaultContext() .GetAdditionalRootAttributes()->Add( _T("schemaLocation"), _T(""), _T(""));


using LiquidTechnologies.Runtime.Net40; ... SerializationContext.Default.AdditionalRootAttributes.Add( "schemaLocation", "", "");


import com.liquid_technologies.ltxmllib18; ... SerializationContext.Default.getAdditionalRootAttributes.add( "schemaLocation", "", "");

  Visual Basic

LtXmlComLib18.DefaultXmlSerializationContext.AdditionalRootAttributes.AddNewEx _ "schemaLocation", _ "", _ ""



Descrption Value
Article Created 7/2/2006
Versions Liquid XML 2005 (4.1.0) and greater
Also See Setting A Default Namespace
  Working In a multithreaded environment

Working With Multiple Schemas

  Hand Coded Blocks