<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % BOOK_ENTITIES SYSTEM "../../Reference_Guide.ent">
%BOOK_ENTITIES;
]>
<section id="sect-Reference_Guide-XML_Resources_Bundles">
	<title>XML Resources Bundles</title>
   
	<para xml:id="sect-Reference_Guide-XML_Resources_Bundles-Motivation">
		<citetitle><emphasis role="bold">Motivation</emphasis></citetitle>
    </para>
		<para>
			Resource bundles are usually stored in property files. However, as property files are plain files, issues with the encoding of the file may arise. The XML resource bundle format has been developed to provide an alternative to property files.
		</para>
		<itemizedlist>
			<listitem>
				<para>
					The XML format declares the encoding of the file. This avoids use of the native2ascii program which can interfere with encoding.
				</para>
			</listitem>
			<listitem>
				<para>
					Property files generally use the ISO 8859-1 character encoding which does not cover the full unicode charset. As a result, languages, such as Arabic, would not be natively supported.
				</para>
			</listitem>
			<listitem>
				<para>
					Tooling for XML files is better supported than the tooling for Java property files; thus, the XML editor copes well with the file encoding.
				</para>
			</listitem>
		</itemizedlist>

	<para id="sect-Reference_Guide-XML_Resources_Bundles-XML_format">
		<citetitle><emphasis role="bold">XML format</emphasis></citetitle>
    </para>
		<para>
			The XML format is very simple and has been developed based on the <emphasis>DRY</emphasis> (Don&#39;t Repeat Yourself) principle. The resource bundle keys are hierarchically defined and we can leverage the hierarchic nature of the XML for that purpose. Here is an example of turning a property file into an XML resource bundle file:
		</para>
		
<programlisting>UIAccountForm.tab.label.AccountInputSet = ...
UIAccountForm.tab.label.UIUserProfileInputSet = ...
UIAccountForm.label.Profile = ...
UIAccountForm.label.HomeInfo= ...
UIAccountForm.label.BusinessInfo= ...
UIAccountForm.label.password= ...
UIAccountForm.label.Confirmpassword= ...
UIAccountForm.label.email= ...
UIAccountForm.action.Reset= ...
</programlisting>
		
<programlisting language="xml">&#60;?xml version=&#34;1.0&#34; encoding=&#34;UTF-8&#34;?&#62;
&#60;bundle&#62;
  &#60;UIAccountForm&#62;
    &#60;tab&#62;
      &#60;label&#62;
        &#60;AccountInputSet&#62;...&#60;/AccountInputSet&#62;
        &#60;UIUserProfileInputSet&#62;...&#60;/UIUserProfileInputSet&#62;
      &#60;/label&#62;
    &#60;/tab&#62;
    &#60;label&#62;
      &#60;Profile&#62;...&#60;/Profile&#62;
      &#60;HomeInfo&#62;...&#60;/HomeInfo&#62;
      &#60;BusinessInfo&#62;...&#60;/BusinessInfo&#62;
      &#60;password&#62;...&#60;/password&#62;
      &#60;Confirmpassword&#62;...&#60;/Confirmpassword&#62;
      &#60;email&#62;...&#60;/email&#62;
    &#60;/label&#62;
    &#60;action&#62;
      &#60;Reset&#62;...&#60;/Reset&#62;
    &#60;/action&#62;
  &#60;/UIAccountForm&#62;
&#60;/bundle&#62;
</programlisting>
	
	<para id="sect-Reference_Guide-XML_Resources_Bundles-Portal_support">
		<citetitle><emphasis role="bold">Portal support</emphasis></citetitle>
    </para>
		<para>
			To be loaded by the portal at runtime (actually the resource bundle service), the name of the file must be the same as a property file and it must use the <filename>.xml</filename> suffix.
		</para>
		<para>
			For example, for the Account Portlet to be displayed in Arabic, the resource bundle would be <filename> AccountPortlet_ar.xml</filename> rather than <filename>AccountPortlet_ar.properties</filename>.
		</para>
<para>
	<prompt>
		<emphasis role="bold">See also</emphasis>
	</prompt>
</para>

		<itemizedlist>
           <listitem>
               <para><link linkend="sect-Reference_Guide-Portal_Lifecycle">Portal Lifecycle</link></para>
           </listitem>
           <listitem>
               <para><link linkend="sect-Reference_Guide-Data_Import_Strategy">Data Import Strategy</link></para>
           </listitem>
           <listitem>
               <para><link linkend="sect-Reference_Guide-RTL_Right_To_Left_Framework">RTL (Right To Left) Framework</link></para>
           </listitem>
		   <listitem>
               <para><link linkend="sect-Reference_Guide-Navigation_Controller">Navigation Controller</link></para>
           </listitem>
       </itemizedlist>
</section>