0

I have an xml message in which i need to parse and find a particular tag. On that tag data I need to check if all the mandatory data elements are present or not. If a data element is missing i need to add the missing data to the tag. Once enriched i need to resubmit for further processing. Can some one give a few guidelines as to how this can be done using linux scripting. Could the awk command be used to find the tag in the xml message.

  • awk is more so used for processing textual table data. Using something like Perl might make your life easier - it has many libraries to deal with XML. – Ryan Feb 16 '12 at 22:05

2 Answers2

0

Processing XML using text processing tools like awk will not scale. Multiple lline data, encoded data etc will make it difficult to handle even small data. Use XML processing library - perl has many. All other languages too.

SO questions Best XML parser for Java

Community
  • 1
  • 1
Jayan
  • 18,003
  • 15
  • 89
  • 143
0

I'd recommend XSLT. See also the Wikipedia article about XSLT, there are some samples. I think XSLT is great for the job you describe.

Johannes Weiss
  • 52,533
  • 16
  • 102
  • 136