Re: XML attribute value indirection

List for Users of Carlsbad Cubes' Technologies and Products <[email protected]> Fri, 21 Oct 2005 08:24:52 +0200
Newsgroups gmane.comp.embedded.carlsbad-cubes
Organization http://freemail.web.de/
Message-ID <[email protected]>

List for Users of Carlsbad Cubes' Technologies and Products <[email protected]> schrieb am 20.10.05 17:21:11:
> ... Further, to have the xml files directly exposed directly, 
> rather than bundled in a jar file is not acceptable (do you honestly 
> want to let uses to fool around with the xml files?) . I was successful 
> passing to swix.render a URL for the .xml from a jar file, but gave up 
> trying to pass a translation file via URL.

Steve, I do not understand: You could not put your translation files
into a jar? If this is your only problem and reason for indirection, there
is a cure for that. Of course neither the xml files nor the .properties files
are'nt exposed to "fool around with".

Here are snippets from (one of) my build.xml:

  <property name="build.dir" location="build"/>
  ...
  <target name="dist" depends="..." description="...">
    <jar jarfile="${build.dir}/ipd-${version}.jar">
    	<manifest>
    		<attribute name="main-class" value="..."/>
    		<attribute name="class-path" value="..."/>
    	</manifest>
      <fileset dir="${build.dir}">
				<include name="**/*.class"/>
                                ...
      </fileset>
      <fileset dir="${resource.dir}">
				<include name="**/*.properties"/>
				<include name="**/*.gif"/>
				<include name="**/*.png"/>
				<include name="**/*.xml"/>
				<include name="**/*.xsl"/>
				<include name="**/*.txt"/>
				<include name="**/*.dtd"/>
				<exclude name="**/*.bak"/>
				<exclude name="**/*~"/>
      </fileset>
    </jar>
  </target>

  <path id="classpath">
    <pathelement path="${build.dir}" />
    <pathelement path="${resource.dir}" />
    <fileset dir="${lib.dir}" includes="**/*.jar" />
  </path>

  <target name="run" depends="compile" description="runs">
    <java fork="true" classname="..." classpathref="classpath"/>
  </target>

The bundle attributes in my swixml files are in no way special like:
<frame size="990,700" title="..." bundle="i18n.messages" id="mainframe"    
    defaultCloseOperation="WindowConstants.DO_NOTHING_ON_CLOSE">

My resource files are located (as you may have guessed) in
 ${resource.dir}/i18n/messages*.properties

To summarize, I do not have any other files than jar files to distribute my app
with (ok, one: a dtd file I cannot get rid of, but this matter is not swixml's). 
The jar/distribution subject can be resolved entirely without indirection...

>         
> Now if you ever change you mind, I would suggest button text="${ok} /> 
> rather than button text="@ok" /> because it would allow for a more 
> sophistacted buttontext="${how}${now}${brown}${cow}". This is not my 
> idea, ini4j also allows "{@prop/key}" if coming from the properties file 
> and {@env/key} if coming from the environment. Very cool.

Hm, IMHO this can be done through a change to  StringConverter, just split
the text and call the localizer for each part...

Yours,

Frank
> 
> Steve
> 
> 
> _______________________________________________
> Forum mailing list
> [email protected]
> http://carlsbadcubes.com/mailman/listinfo/forum_carlsbadcubes.com