Translate XSD element names to English

Posted by Coov on Stack Overflow See other posts from Stack Overflow or by Coov
Published on 2010-03-24T02:42:24Z Indexed on 2010/03/24 2:43 UTC
Read the original article Hit count: 320

Filed under:
|
|
|

I have an XML Schema Definition file .XSD who's elements are in Spanish. I have an XML data file that is also in Spanish that matches the schema definition. I created a dataset from the xsd using xsd.exe and I'm loading the XML into the dataset.

I want to translate the element names to English. I can think of two options off the top of my head. Either scrape the XSD & XML files and translate the elements prior to generating the dataset with esd.exe, or iterate the dataset after I have loaded it with the xml, and translate my objects.

I do have a written document that provides the English names for every element name in Spanish. The problem is there are hundreds of elements and I was trying to avoid coding that manually. Getting precise translations is not that important, it just needs to be readable by an English speaking person.

Here is an example of what an element may look like "Apellidos":

<xs:element name="Apellidos" type="xs:string"/>

that I will translate to "SirName":

<xs:element name="SirName" type="xs:string"/>

I'm looking for ideas and or opinions on a quick way to do this. It's a one time deal so I'm not working about it scaling or being functional for things other than this single xml file.

I'll be taking this dataset and writing out a flat file for English speaking users to read.

© Stack Overflow or respective owner

Related posts about c#

Related posts about xml-schema