
aditya83
New User
Mar 9, 2008, 3:58 AM
Post #1 of 1
(242 views)
|
|
Removing null tags from XML file in perl
|
Can't Post
|
|
Hi, We are trying to create a XML extract(with the help of another tool) and then send it to a portal. How can i remove the null tags and the entire null hierarchy from the xml file? I am giving an example of type of null tabs we are getting: <root> <level1> <level2> </level2> </level1> <level1> <level2>Value</level2> </level1> </root> The output of the script should be <root> <level1> <level2>Value</level2> </level1> </root> I have tried several approaches but the problems i faced were that i was able to traverse to the leaf node ( for valid tags), but was after that there was no way to know whether the immediate parent had a valid value. The output that i got every time was <root> <level1> <level2>Value</level2> After this i was expecting the closing tags also to come. Is there a way out to solve this problem(of removing the null hierarchies)? Thanks Aditya
|