By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,278 Members | 1,530 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,278 IT Pros & Developers. It's quick & easy.

Deleteing null tags in XML file with perl

P: 1
Hi,

We are trying to create a XML extract(with the help of another tool) and then send it to IBM WCC. I am not an expert in WCC, but the team developing the front end portal has expressed their inability in reading null tags in the XML file. How can i remove the null tags and the enter hierarchy from the xml file? I am giving an example of type of null tab we are getting:
<root>
<level1>
<level2>
</level2>
</level1>
<level1>
<level2>Value</level2>
</level1>
</root>

The output of the script would 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 through 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
Mar 9 '08 #1
Share this Question
Share on Google+
1 Reply


P: 3
Hi,

We are trying to create a XML extract(with the help of another tool) and then send it to IBM WCC. I am not an expert in WCC, but the team developing the front end portal has expressed their inability in reading null tags in the XML file. How can i remove the null tags and the enter hierarchy from the xml file? I am giving an example of type of null tab we are getting:
<root>
<level1>
<level2>
</level2>
</level1>
<level1>
<level2>Value</level2>
</level1>
</root>

The output of the script would 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 through 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
Can you please supply your current code and the input file? This would allow us to see what you are doing and possible help. Thanks.

Mark
Mar 12 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.