473,472 Members | 1,761 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Deleteing null tags in XML file with perl

1 New Member
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
1 1350
SeniorSE
3 New Member
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

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

Similar topics

7
by: Phil Powell | last post by:
I am having to use an existing FormValidator class to check form elements, and one of the things I must check is to see if someone entered tags in the string <>; if so, it must flag for that. ...
2
by: jeff | last post by:
Hiya, I had a go at this in perl and to be fairly honest perl scared me, i didnt like the language one bit, ive used python before and find it a "clean" language to use. Basically what i want...
3
by: jjliu | last post by:
Could someone tell me how to parse the inside of html tags by perl, such as <meta> </meta> <head> </head> <title> </title> ......... Thanks
18
by: Shannon Jacobs | last post by:
Trying to solve this with a regex approach rather than the programmatic approach of counting up and down the levels. I have a fairly complicated HTML page that I want to simplify. I've been able to...
163
by: Shiperton Henethe | last post by:
Hi Know any good utilities to help me strip out the tags that Microsoft Excel 2002 leaved behind when you try and export an HTML format file? This is driving me NUTS. And really makes me...
16
by: bill | last post by:
How can I insert a record with a null value in one of the fields? I need to use the update method from a data adapter. The data is in a XML file.
3
by: iStrain | last post by:
Hiya. I'm _sure_ this is an FAQ, but Googling hasn't produced the answer in a way I can make sense out of. I know I should get this, but so far no way... I'm creating tables and doing queries in...
7
by: tom harrison | last post by:
i'm so glad i found this forum! i have to have some coursework done by the end of the week and i really need it explaining to me. i'm not really that big on stuff like this but it's a part of my web...
6
by: imlight211 | last post by:
Hi, I am also facing a problem while delteing the file. The file name and the path is correct. if (unlink($entry) == 0) { print "File $entry deleted successfully.\n"; else { print "File...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.