On 20/10/2010 12:55, Jyoti wrote:
Can anyone tell me how to use string handlers in perl (join function). I
tried it to get a list of words.
But i actually want to combine all the similar tags from one file and get it
one below the other in a new file.
For example : My file looks like this now: (Combines 2-3 files)
<message name>
</message name>
<message name>
</message name>
<binding>
</binding>
<message name>
</message name>
<portType>
</portType>
<binding>
</binding>
<message name>
</message name>
<portType>
</portType>
<binding>
</binding>
Now i want all the similar tags to be one below the other like :
<message name>
</message name>
<message name>
</message name>
<portType>
</portType>
<portType>
</portType>
<binding>
</binding>
<binding>
</binding>
I have to store one tag in array and display its contents.
Hope its clear what I mean.
Are you dealing with well-formed XML?
Unless there you have a very good reason to avoid it, it is always best
to process XML using a standard library. Indeed, if the rest of your
system did that, there would probably be no reason to sort the elements
by tag name.
If you don't take advantage of the rules of XML, formatting data as
pseudo-XML and then try to process it as a simple text file just adds to
the awkwardness of managing it.
It sounds like you have a number of well-formed XML files that you
simply need to merge into one: if so then the task is trivial. If the
object files aren't well-formed then you should go and sit with your
manager and threaten to resign.
Rob
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/