Adding/reading additional attributes to/from Resource files .resx



Hi,

I'm working with .resx files for a multilanguage application and so far it
has worked
perfectly. However, now I want to add more attributes to the xml schema and
read
them at running time. ie: I want to programatically generate forms and
validate
their input fields according to the data stored on a resource file. Here is an
example:

NUM_ATTRS: value="4"
ATTR_1: value="Name", required="yes"
ATTR_2: value="Description", required="no"
ATTR_3: value="Price", required="yes"
ATTR_4: value="Reference", required="yes"

If you see, I need an extra attribute called "required". I modified the xml
source of
my resource file and add the following line to the "data" section:

<xsd:attribute name="required" type="xsd:string" />

Now, I see the extra column when editing the resx file on visual studio .net
and
can set a value to it, but I don't know how to read it. I saw the
documentation of
ResourceManager and there are only two methods to get data from the resource
file: GetString and GetObject; however, they only get the value attribute
and if the
object is an image, then it gets the bitmap itself. I also looked for a
solution in
google, but most of the messages I found doesn't give a solution.

The only way I found was to add an extra string called "ATTR_REQUIRED_n",
where n is a number, and set it to "yes" or "no", but I thing the xml
attributes look
cleaner and more natural. Is possible to do solve this problem with custom xml
attributes? How? Is there perhaps another approach?

Thanks in advanced,
Josef
.



Relevant Pages

  • Re: Resource file vs. regular Xml file
    ... One concern i never asked was caching. ... currently i am caching my custom xml ... programmatically load resource keys from resource file or resx file. ... xml solution, you'll need to define your own xml file format and use raw ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Lokalisierung mit VS2005
    ... dann ist die Technik mit den Dlls immer noch ... Wie Du erwähnt hast gibt es jetzt auch resx Files, welche mit XML übersetzt ...
    (microsoft.public.de.vc)
  • Re: Resource file vs. regular Xml file
    ... do you know of the actual benefits of resource file instead of regular xml ... i get by using a resource file instead of a custom xml solution? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Resource file question
    ... Evian Spring wrote: ... convert that resource file to a flat text file. ... I am not aware of a "XML to text" tool, but to write one is quite easy, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Where to store schemas and stylesheets?
    ... What is the best, or better RECOMMENDED, way of containing any schema or ... stylesheet that is needed by an application, ... So far I've put all the XML within a resource file but I see that you ...
    (microsoft.public.dotnet.xml)

Loading