|
-
Dec 14th, 2011, 05:38 PM
#1
[RESOLVED] Getting rid of the empty sections of the XML
I have an XML file and some of the sections in the file do not contain any data. Before I send this XML to a webservice, I would like to know if there's any way to get rid of the empty sections.
For example:
PHP Code:
<Root>
<MainContainer>
<SectionOne>
<Collection/>
</SectionOne>
<SectionTwo>
<Collection>
<ItemOne>Has Value</ItemOne>
</Collection>
</SectionTwo>
</MainContainer>
</Root>
In the example above, I would want SectionOne to completely disappear and then the XML cleaned up will look like the one below.
PHP Code:
<Root>
<MainContainer>
<SectionTwo>
<Collection>
<ItemOne>Has Value</ItemOne>
</Collection>
</SectionTwo>
</MainContainer>
</Root>
How can I do this ? This is an example. There are several sections in the XML file and they are not named with the word section in there.
I need to do this on more than 100 K files to shrink their size.
DeanMc used to have an XAML formatter online. Anybody know what happened to it?
Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
save a blobFileStreamDataTable To Text Filemy blog
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|