1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<HTML>
3<HEAD>
4<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
5<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 7.0.0.0 for Windows">
6<META http-equiv="Content-Style-Type" content="text/css">
7<TITLE>xml2env</TITLE>
8<LINK rel="stylesheet" href="../css/nitro.css" type="text/css">
9<STYLE type="text/css">
10<!--
11.sample_source{
12  background-color : #e8e8e8;
13}
14H3{
15  color : teal;
16}
17.command_list{
18  margin-bottom : 16pt;
19}
20.command_desc{
21  }
22.command_item{
23  margin-top : 16pt;
24  background-color : #e8e8e8;
25}
26.blockquoted_table {
27  border : 1px;
28  width : 80%;
29}
30TD,TH{
31  border-color	: #c0d8d8;
32  padding       : 1pt 4pt 1pt 4pt;
33  border-width  : 1px;
34  border-style  : solid;
35}
36-->
37</STYLE>
38</HEAD>
39<BODY>
40<H1 align="left">xml2env <IMG src="../image/NTR.gif" align="middle"><IMG src="../image/TWL.gif" align="middle"></H1>
41<H2>Description</H2>
42<P><CODE>xml2env</CODE> is a tool to convert the resource data for the ENV library written in XML format to the source file format in C.</P>
43<H2>Using the Tool</H2>
44<H3>Start Command</H3>
45<PRE><CODE>% perl init2env.pl RESOURCE_FILE
46                  [-o OUTPUT_FILE]</CODE></PRE>
47<P>The resource data written in the INIT format specified by <CODE>RESOURCE_FILE</CODE> is changed to the C source file format and is output with the name <CODE>RESOURCE_FILE.result.c</CODE>.<br>However, it is necessary to put in the absolute path of files you want to change in <CODE>RESOURCE_FILE</CODE>.</P>
48<P>With the <CODE>-o</CODE> option, the output file name can be changed from <CODE>RESOURCE_FILE.result.c</CODE> to <CODE>OUTPUT_FILE</CODE>.</P>
49<P><B>Note:</B> If in an environment where XML::Parser cannot be used, it is necessary to include the latest version of perl and the expat library in the cygwin setup.</P>
50
51<BR>
52<P><B>Example of the resource data for the ENV library in XML format</B></P>
53<BR>
54<P>XML formatted resource data before being changed.</P>
55<BLOCKQUOTE><CODE>&lt;envlist&gt;<BR> &lt;resource name=&quot;environment1&quot;&gt;<BR> &lt;class name=&quot;myClass11&quot;&gt;<BR> &lt;string name=&quot;str1&quot;&gt;mario&lt;/string&gt;<BR> &lt;hexbinary name=&quot;bin1&quot;&gt;12345678&lt;/hexbinary&gt;<BR> &lt;/class&gt;<BR> &lt;/resource&gt;<BR> &lt;resource name=&quot;environment2&quot;&gt;<BR> &lt;class name=&quot;myClass21&quot;&gt;<BR> &lt;string name=&quot;str1&quot;&gt;mario&lt;/string&gt;<BR> &lt;hexbinary name=&quot;bin1&quot;&gt;abcd123&lt;/hexbinary&gt;<BR> &lt;hexbinary name=&quot;bin2&quot; src=&quot;../test/test.txt&quot;/&gt;<BR> &lt;/class&gt;<BR> &lt;class name=&quot;myClass22&quot;&gt;<BR> &lt;s32 name=&quot;data1&quot;&gt;-500&lt;/s32&gt;<BR> &lt;u16 name=&quot;data2&quot;&gt;0x8000&lt;/u16&gt;<BR> &lt;/class&gt;<BR> &lt;/resource&gt;<BR> &lt;/envlist&gt;</CODE></BLOCKQUOTE>
56<BR>
57<P>C Source File formatted Resource Data after being changed.</P>
58<BLOCKQUOTE><CODE>ENVResource myResource1[] = {<BR> &quot;myClass11.str1&quot;,    ENV_STRING( &quot;mario&quot; ),<BR> &quot;myClass11.bin1&quot;,    ENV_BINARY( &quot;\x31\x32\x33\x34\x35\x36\x37\x38&quot; ),<BR> ENV_RESOURCE_END<BR> };<BR> <BR> ENVResource myResource2[] = {<BR> &quot;myClass21.str1&quot;,    ENV_STRING( &quot;mario&quot; ),<BR> &quot;myClass21.bin1&quot;,    ENV_BINARY( &quot;file contents&quot; ),<BR> &quot;myClass21.bin2&quot;,    ENV_BINARY( &quot;test.txt file contents&quot; ),<BR> &quot;myClass22.data1&quot;,   ENV_S32( -500 ),<BR> &quot;myClass22.data2&quot;,   ENV_U16( 0x8000 ),<BR> ENV_RESOURCE_END<BR> };<BR> <BR> ENVResource* resourceArray[]={ myResource1, myResource2, NULL };</CODE></BLOCKQUOTE>
59
60<P>When the resource type is BINARY, it is possible to make the file contents into element data automatically by surrounding the relative file path within the src attribute inside the element with<CODE> &quot;&quot; </CODE>.</P>
61
62<P>Resource data can be used as is by compiling the generated C source file and the program using ENV together.</P><BR>
63<H2>Location</H2>
64<P><CODE>$TwlSDK/tools/bin/xml2env.pl</CODE></P>
65<H2>See Also</H2>
66<P><CODE><A href="../env/about_env.html">ENV</A></CODE></P>
67<H2>Revision History</H2>
68<P>2005/10/20 Initial version.</P>
69<hr><p>CONFIDENTIAL</p></body>
70</HTML>