1

I want to automatically generate an xml file for every record found in an xml column in a table.

Is there a script using a cursor or another method to do that?

1 Answer 1

0

You should be able to do this with xmlstarlet and a little scripting. I don't have a good xml file to run this against but this should do it, more or less. Should output all matching elements to tempfile.txt and then splits out the elements into output1.xml and counts up until all elements have been saved into their own xml files.

sourceFile=$1 xmlstarlet sel -t -c "/your/element" $sourceFile -n -o "splithere" > tempfile.txt fileNumber=0 cat tempfile.txt | while read line; do if [[ $line == splithere ]] then let fileNumber++ break fi echo $line >> output$fileNumber.xml done rm -f tempfile.txt 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.