XML Parser: adding attribute name to ID

Hello all,

 

I wrote an xml parser to handle a new set of xml files we will be localizing. The xml structure looks something like this:

 <Value Id="EnterNewPhoneNumber" Text="Enter Phone Number" Text2="Enter Mobile Number" ToolTip="Enter Phone Number" Link="Enter Phone Number here">
    <Validation>
      <MaxSize target="Text" max="36" />
    </Validation>
  </Value>

In order to prevent a bunch of duplicate keys, and for context, I want the attribute name (ie. Text, Text2, ToolTip, Link) to be part of the string ID, for example something like this: EnterNewPhoneNumber.Text, EnterNewPhoneNumber.ToolTip etc.

I have not been able to find a way to do that. Does anyone know if it is possible, and how to do that?

Thanks!

Penny

Parents
  • The file can be processed but according to Yves Savourel's XML Internationalization and Localization the structure is not really best practice as translatable content is stored in attributes. If all the translatable text would be stored in elements like

    <Value Id="EnterNewPhoneNumber">
       <Text MaxSize="36">Enter Phone Number</Text>
       <Text2>Enter Mobile Number</Text2>
       <ToolTip>Enter Phone Number</ToolTip>
       <Link>Enter Phone Number here</Link>>
    </Value>

    it would perfectly work to add the element names to the Id as "EnterNewPhoneNumber.Text" etc.

Reply
  • The file can be processed but according to Yves Savourel's XML Internationalization and Localization the structure is not really best practice as translatable content is stored in attributes. If all the translatable text would be stored in elements like

    <Value Id="EnterNewPhoneNumber">
       <Text MaxSize="36">Enter Phone Number</Text>
       <Text2>Enter Mobile Number</Text2>
       <ToolTip>Enter Phone Number</ToolTip>
       <Link>Enter Phone Number here</Link>>
    </Value>

    it would perfectly work to add the element names to the Id as "EnterNewPhoneNumber.Text" etc.

Children
No Data