Re: XML attribute value indirection
List for Users of Carlsbad Cubes' Technologies and Products <[email protected]> Fri, 21 Oct 2005 08:20:31 -0400
| Newsgroups | gmane.comp.embedded.carlsbad-cubes |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format.
--===============1122303967==
Content-Type: multipart/alternative;
boundary="------------090600060308080704080403"
This is a multi-part message in MIME format.
--------------090600060308080704080403
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Frank,
My apologies. After ranting (just a little) earlier, I took a different
tack - I wrote a tiny ResourceBundle, where handleGetObject
distinguishes between text="${foo}" and text=foo, as Babak needed. It
was then easy enough to do a swix.setResourceBundle(Bundle.Name). Your
approach is much more sophisticated, but I couldn't figure out to
overload ResoureBundle.getString any other way.
Do you have a (simple) workaround for Babak's Font=xxx problem? Again,
I'm a newbie, but I just don't understand why all fields can't be
exposed to indirection. By exposing "all", SwixML is giving the
developer a choice, but he/she doesn't have to take advantage of it, nor
is SwixML necessarily increasing complexity.
Steve
List for Users of Carlsbad Cubes' Technologies and Products wrote:
> 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
>>
>
>
>
> _______________________________________________
> Forum mailing list
> [email protected]
> http://carlsbadcubes.com/mailman/listinfo/forum_carlsbadcubes.com
>
>
>
--------------090600060308080704080403
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Frank,<br>
<br>
My apologies. After ranting (just a little) earlier, I took a different
tack - I wrote a tiny ResourceBundle, where handleGetObject <br>
distinguishes between text="${foo}" and text=foo, as Babak needed. It
was then easy enough to do a swix.setResourceBundle(Bundle.Name). Your
approach is much more sophisticated, but I couldn't figure out to
overload ResoureBundle.getString any other way.<br>
<br>
Do you have a (simple) workaround for Babak's Font=xxx problem? Again,
I'm a newbie, but I just don't understand why all fields can't be
exposed to indirection. By exposing "all", SwixML is giving the
developer a choice, but he/she doesn't have to take advantage of it,
nor is SwixML necessarily increasing complexity. <br>
<br>
Steve<br>
<br>
List for Users of Carlsbad Cubes' Technologies and Products wrote:
<blockquote cite="[email protected]" type="cite">
<pre wrap="">
List for Users of Carlsbad Cubes' Technologies and Products <a class="moz-txt-link-rfc2396E" href="mailto:[email protected]"><[email protected]></a> schrieb am 20.10.05 17:21:11:
</pre>
<blockquote type="cite">
<pre wrap="">... 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.
</pre>
</blockquote>
<pre wrap=""><!---->
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...
</pre>
<blockquote type="cite">
<pre wrap="">
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.
</pre>
</blockquote>
<pre wrap=""><!---->
Hm, IMHO this can be done through a change to StringConverter, just split
the text and call the localizer for each part...
Yours,
Frank
</pre>
<blockquote type="cite">
<pre wrap="">Steve
_______________________________________________
Forum mailing list
<a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a>
<a class="moz-txt-link-freetext" href="http://carlsbadcubes.com/mailman/listinfo/forum_carlsbadcubes.com">http://carlsbadcubes.com/mailman/listinfo/forum_carlsbadcubes.com</a>
</pre>
</blockquote>
<pre wrap=""><!---->
_______________________________________________
Forum mailing list
<a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a>
<a class="moz-txt-link-freetext" href="http://carlsbadcubes.com/mailman/listinfo/forum_carlsbadcubes.com">http://carlsbadcubes.com/mailman/listinfo/forum_carlsbadcubes.com</a>
</pre>
</blockquote>
</body>
</html>
--------------090600060308080704080403--
--===============1122303967==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Forum mailing list
[email protected]
http://carlsbadcubes.com/mailman/listinfo/forum_carlsbadcubes.com
--===============1122303967==--