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