{"id":1355,"date":"2009-10-26T11:13:36","date_gmt":"2009-10-26T11:13:36","guid":{"rendered":"http:\/\/www.bardecode.com\/en1\/?p=1355"},"modified":"2013-02-12T11:14:09","modified_gmt":"2013-02-12T11:14:09","slug":"loadxmlsettings-load-settings-from-an-xml-file","status":"publish","type":"post","link":"https:\/\/www.bardecode.com\/en1\/loadxmlsettings-load-settings-from-an-xml-file\/","title":{"rendered":"LoadXMLSettings &#8211; load settings from an XML file"},"content":{"rendered":"<p><strong><strong>Syntax<\/strong><\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Loading from xml file:<\/strong><\/p>\n<p><strong>.net\/java:\u00a0Object.<strong>LoadXMLSettings<\/strong>(file)<br \/>\ncom\/ocx:\u00a0Object.<strong>LoadXMLSettings<\/strong>(file, silent)<br \/>\ndll:\u00a0<strong>mtLoadXMLSettings<\/strong>(hbarcode, file, silent)<\/strong><\/p>\n<p><strong>Loading from string:<\/strong><\/p>\n<p><strong>.net\/java:\u00a0Object.<strong>LoadXMLSettings<\/strong>(string)<br \/>\ncom\/ocx:\u00a0Object.<strong>LoadXMLSettings<\/strong>(string, silent)<br \/>\ndll:\u00a0<strong>mtLoadXMLSettings<\/strong>(hbarcode, string, silent)<\/strong><\/p>\n<p><strong><strong>Parameters<\/strong><\/strong><\/p>\n<p><strong>hBarcode\u00a0Handle to an instance of the barcode toolkit (dll only).<br \/>\nfile\u00a0Path to the xml file to be loaded.<br \/>\nstring\u00a0String holding the xml property values.<br \/>\nsilent\u00a0Integer or boolean value. 1\/True will suppress error messages.<\/strong><\/p>\n<p><strong><strong>Return Value<\/strong><strong><\/strong><\/strong><\/p>\n<p><strong>1\/True on success and 0\/False on failure.<\/strong><\/p>\n<p><strong><strong>Remarks<\/strong><\/strong><\/p>\n<p><strong>Load\u00a0settings from the\u00a0specified 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&#8217;s also possible to specify properties that only apply to particular pages\u00a0of an image. The silent parameter controls whether message message boxes will be displayed if there is a parsing error.<\/strong><\/p>\n<p><strong>Note that when loading from a string the XML data can be in the abbreviated form:<\/strong><\/p>\n<p><strong>\u201c&lt;<em>PropertyName<\/em>&gt;<em>Value<\/em>&lt;\/<em>PropertyName<\/em>&gt;\u201d<\/strong><\/p>\n<p><strong>For the com object, use the XMLRetval property to obtain the return value for the function.<\/strong><\/p>\n<p><strong>The simplest format for the xml is as follows:<\/strong><\/p>\n<p><strong>&lt;xml&gt;<br \/>\n&lt;SoftekBarcode&gt;<br \/>\n&lt;Properties&gt;<br \/>\n&lt;<em>PropertyName<\/em>&gt;<em>PropertyValue<\/em>&lt;\/<em>PropertyName<\/em>&gt;<br \/>\n&lt;\/Properties&gt;<br \/>\n&lt;\/SoftekBarcode&gt;<br \/>\n&lt;\/xml&gt;<\/strong><\/p>\n<p><strong>Example:<\/strong><\/p>\n<p><strong>Set MedianFilter to 1 (True) and set ReadCode25 to 0 (False).<\/strong><\/p>\n<p><strong>&lt;xml&gt;<br \/>\n&lt;SoftekBarcode&gt;<br \/>\n&lt;Properties&gt;<br \/>\n&lt;MedianFilter&gt;1&lt;\/MedianFilter&gt;<br \/>\n&lt;ReadCode25&gt;0&lt;\/ReadCode25&gt;<br \/>\n&lt;\/Properties&gt;<br \/>\n&lt;\/SoftekBarcode&gt;<br \/>\n&lt;\/xml&gt;<\/strong><\/p>\n<p><strong>The xml file can also be used to apply sets of properties sequentially to an image until a barcode is found:<\/strong><\/p>\n<p><strong>This example first applies default values to an image. If no barcode is found then a MedianFilter is applied.<\/strong><\/p>\n<p><strong>&lt;xml&gt;<br \/>\n&lt;SoftekBarcode&gt;<br \/>\n&lt;Properties&gt;<br \/>\n&lt;\/Properties&gt;<br \/>\n&lt;Properties&gt;<br \/>\n&lt;MedianFilter&gt;1&lt;\/MedianFilter&gt;<br \/>\n&lt;\/Properties&gt;<br \/>\n&lt;\/SoftekBarcode&gt;<br \/>\n&lt;\/xml&gt;<\/strong><\/p>\n<p><strong>This example restricts the search to the first 3 pages of an image, until a barcode is located:<\/strong><\/p>\n<p><strong>&lt;xml&gt;<br \/>\n&lt;SoftekBarcode&gt;<br \/>\n&lt;Properties&gt;<br \/>\n&lt;PageNo&gt;1&lt;\/PageNo&gt;<br \/>\n&lt;\/Properties&gt;<br \/>\n&lt;Properties&gt;<br \/>\n&lt;PageNo&gt;2&lt;\/PageNo&gt;<br \/>\n&lt;\/Properties&gt;<br \/>\n&lt;Properties&gt;<br \/>\n&lt;PageNo&gt;3&lt;\/PageNo&gt;<br \/>\n&lt;\/Properties&gt;<br \/>\n&lt;\/SoftekBarcode&gt;<br \/>\n&lt;\/xml&gt;<\/strong><\/p>\n<p><strong>The default set of properties can be found in the manual page for\u00a0ExportXMLSettings.<\/strong><\/p>\n<p><strong><strong>Win32 dll declarations:<\/strong><\/strong><\/p>\n<p><strong><strong>VB.Net:<\/strong><\/strong><\/p>\n<p><strong>Private Declare Function mtLoadXMLSettings Lib &#8220;SoftekBarcode&#8221; (ByVal hBarcode As System.IntPtr, ByVal strFile As String, ByVal silent As Boolean) As Short<\/strong><\/p>\n<p><strong><br \/>\n<strong>Visual C++:<\/strong><\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><strong>extern &#8220;C&#8221; {<br \/>\nint __stdcall mtLoadXMLSettings(HANDLE hBarcode, LPCSTR filePath, unsigned char silent) ;<\/strong><\/p>\n<p><strong>}<\/strong><\/p>\n<div><strong><br \/>\n<\/strong><\/div>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Syntax &nbsp; Loading from xml file: .net\/java:\u00a0Object.LoadXMLSettings(file) com\/ocx:\u00a0Object.LoadXMLSettings(file, silent) dll:\u00a0mtLoadXMLSettings(hbarcode, file, silent) Loading from string: .net\/java:\u00a0Object.LoadXMLSettings(string) com\/ocx:\u00a0Object.LoadXMLSettings(string, silent) dll:\u00a0mtLoadXMLSettings(hbarcode, string, silent) Parameters hBarcode\u00a0Handle to an instance of the barcode toolkit (dll only). file\u00a0Path to the xml file to be loaded. string\u00a0String holding the xml property values. silent\u00a0Integer or boolean value. 1\/True will suppress error messages.<\/p>\n<p><a href=\"https:\/\/www.bardecode.com\/en1\/loadxmlsettings-load-settings-from-an-xml-file\/\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[236,18],"tags":[],"class_list":["post-1355","post","type-post","status-publish","format-standard","hentry","category-documentation-for-our-toolkits-and-applications","category-knowledge-base"],"_links":{"self":[{"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/posts\/1355"}],"collection":[{"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/comments?post=1355"}],"version-history":[{"count":1,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/posts\/1355\/revisions"}],"predecessor-version":[{"id":1356,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/posts\/1355\/revisions\/1356"}],"wp:attachment":[{"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/media?parent=1355"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/categories?post=1355"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/tags?post=1355"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}