XML file transformation


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting XML file transformation
# 1  
Old 05-20-2010
MySQL XML file transformation

Hi all, I have to transform a XML file like this:

Code:
<?xml version="1.0"?>
<vocabulary>
  <voc_id>102</voc_id>
  <name>Vocabulary Name</name>
  <description>Voc description</description>
  <relations>3</relations>
  <hierarchy>5</hierarchy>
  <word>
    <word_id>1</word_id>
    <voc_id>102</voc_id>
    <name>foo1</name>
    <description>word description</description>
    <parent>0</parent>
    <synonyms>
      syn1
      syn2
      syn3
    </synonyms>
  </word>
  <word>
    <word_id>2</word_id>
    <voc_id>102</voc_id>
    <name>foo2</name>
    <description></description>
    <parent>1</parent>
  </word>
</vocabulary>

in order to have a word structure like this:

Code:
<skos:Concept rdf:about="http://www.example.com/concepts#word_id">
      <skos:prefLabel>name</skos:prefLabel>
      <skos:altLabel>syn name1</skos:altLabel>
      <skos:altLabel>syn name2</skos:altLabel>
      <skos:broader rdf:resource="http://www.example.com/concepts#parent1"/>
      <skos:broader rdf:resource="http://www.example.com/concepts#parent2"/>
      <skos:definition>description</skos:definition>
   </skos:Concept>


How can I write a script for my goal?

Thank you in advance!
# 2  
Old 05-21-2010
Try to be more descriptive in your problem
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to pull multiple XML tags from the same XML file in Shell.?

I'm searching for the names of a TV show in the XML file I've attached at the end of this post. What I'm trying to do now is pull out/list the data from each of the <SeriesName> tags throughout the document. Currently, I'm only able to get data the first instance of that XML field using the... (9 Replies)
Discussion started by: hungryd
9 Replies

2. Shell Programming and Scripting

Splitting a single xml file into multiple xml files

Hi, I'm having a xml file with multiple xml header. so i want to split the file into multiple files. Sample.xml consists multiple headers so how can we split these multiple headers into multiple files in unix. eg : <?xml version="1.0" encoding="UTF-8"?> <ml:individual... (3 Replies)
Discussion started by: Narendra921631
3 Replies

3. Shell Programming and Scripting

Comparing delta values of one xml file in other xml file

Hi All, I have two xml files. One is having below input <NameValuePair> <name>Daemon</name> <value>tcp:7474</value> </NameValuePair> <NameValuePair> <name>Network</name> <value></value> </NameValuePair> ... (2 Replies)
Discussion started by: sharsour
2 Replies

4. Shell Programming and Scripting

Help required in Splitting a xml file into multiple and appending it in another .xml file

HI All, I have to split a xml file into multiple xml files and append it in another .xml file. for example below is a sample xml and using shell script i have to split it into three xml files and append all the three xmls in a .xml file. Can some one help plz. eg: <?xml version="1.0"?>... (4 Replies)
Discussion started by: ganesan kulasek
4 Replies

5. Shell Programming and Scripting

How to add the multiple lines of xml tags before a particular xml tag in a file

Hi All, I'm stuck with adding multiple lines(irrespective of line number) to a file before a particular xml tag. Please help me. <A>testing_Location</A> <value>LA</value> <zone>US</zone> <B>Region</B> <value>Russia</value> <zone>Washington</zone> <C>Country</C>... (0 Replies)
Discussion started by: mjavalkar
0 Replies

6. UNIX for Dummies Questions & Answers

file transformation using fixed width file

Hi Gurus! I need to make some file transformations. Please help. This is my input file. It has four columns with fixed width. 1 aaa bbbb cccc 2 eee dddd jjjj 3 fff gggg jjjj 4 hhh iiii cccc 5 kkk llll cccc 6 mmm nnnn oooo 7 ppp qqqq xxxx 8 rrr ... (1 Reply)
Discussion started by: kokoro
1 Replies

7. Shell Programming and Scripting

File transformation - what is most efficient method

I've done quite a bit of searching on this but cannot seem to find exactly what I'm looking for. Say I have a | delimited input file with 6 columns and I need to change the value of a few columns and create an output file. With my limited knowledge I can do this with many lines of code but want... (5 Replies)
Discussion started by: 1superdork
5 Replies

8. Shell Programming and Scripting

XML to csv transformation

Hi, I want to write a perl script. Which should accept the xml file, one xsl file and the loaction. The perl script should process the xml file using the xsl file and puts the out put in specified location. For example: My.perl is perls cript. my.xml is like this <?xml version="1.0"... (2 Replies)
Discussion started by: siba.s.nayak
2 Replies

9. Shell Programming and Scripting

How to remove xml namespace from xml file using shell script?

I have an xml file: <AutoData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Table1> <Data1 10 </Data1> <Data2 20 </Data2> <Data3 40 </Data3> <Table1> </AutoData> and I have to remove the portion xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" only. I tried using sed... (10 Replies)
Discussion started by: Gary1978
10 Replies

10. Shell Programming and Scripting

file name transformation

I've got a multitude of text data files that carry exactly the same kind of data. Unfortunately some of them have a different filename format some are: 'category'_'month'-'year'_act.txt an example being: daf_Apr-1961_act.txt and some are: 'category'_ 'year'-'month'_act.txt an... (16 Replies)
Discussion started by: vrms
16 Replies
Login or Register to Ask a Question