LoadXMLSettings - load settings from an XML file
Syntax
Loading from xml file:
.net/java: Object.LoadXMLSettings(file)
com/ocx: Object.LoadXMLSettings(file, silent)
dll: mtLoadXMLSettings(hbarcode, file, silent)
Loading from string:
.net/java: Object.LoadXMLSettings(string)
com/ocx: Object.LoadXMLSettings(string, silent)
dll: mtLoadXMLSettings(hbarcode, string, silent)
Parameters
hBarcode Handle to an instance of the barcode toolkit (dll only).
file Path to the xml file to be loaded.
string String holding the xml property values.
silent Integer or boolean value. 1/True will suppress error messages.
Return Value
1/True on success and 0/False on failure.
Remarks
Load settings from the specified XML file or string. This method can also be used to define sets of properties to be applied sequentially to an image until a barcode is located. It’s also possible to specify properties that only apply to particular pages of an image. The silent parameter controls whether message message boxes will be displayed if there is a parsing error.
Note that when loading from a string the XML data can be in the abbreviated form:
“<PropertyName>Value</PropertyName>”
For the com object, use the XMLRetval property to obtain the return value for the function.
The simplest format for the xml is as follows:
<xml>
<SoftekBarcode>
<Properties>
<PropertyName>PropertyValue</PropertyName>
</Properties>
</SoftekBarcode>
</xml>
Example:
Set MedianFilter to 1 (True) and set ReadCode25 to 0 (False).
<xml>
<SoftekBarcode>
<Properties>
<MedianFilter>1</MedianFilter>
<ReadCode25>0</ReadCode25>
</Properties>
</SoftekBarcode>
</xml>
The xml file can also be used to apply sets of properties sequentially to an image until a barcode is found:
This example first applies default values to an image. If no barcode is found then a MedianFilter is applied.
<xml>
<SoftekBarcode>
<Properties>
</Properties>
<Properties>
<MedianFilter>1</MedianFilter>
</Properties>
</SoftekBarcode>
</xml>
This example restricts the search to the first 3 pages of an image, until a barcode is located:
<xml>
<SoftekBarcode>
<Properties>
<PageNo>1</PageNo>
</Properties>
<Properties>
<PageNo>2</PageNo>
</Properties>
<Properties>
<PageNo>3</PageNo>
</Properties>
</SoftekBarcode>
</xml>
The default set of properties can be found in the manual page for ExportXMLSettings.
Win32 dll declarations:
VB.Net:
Private Declare Function mtLoadXMLSettings Lib “SoftekBarcode” (ByVal hBarcode As System.IntPtr, ByVal strFile As String, ByVal silent As Boolean) As Short
Visual C++:
extern “C” {
int __stdcall mtLoadXMLSettings(HANDLE hBarcode, LPCSTR filePath, unsigned char silent) ;
}