PHP XML Remove Spaces: Trim spaces from XML tag values

Recommend this page to a friend!
  Info   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 183 All time: 8,490 This week: 238Up
Version License PHP version Categories
nospace 1.0.0MIT/X Consortium ...5XML, PHP 5, Text processing
Description Author

This is a very simple class that can remove spaces from XML tag values.

It takes a XML document as a SimpleXMLElement returned for instance by simplexml_load_file and traverses all the document tags.

The class trims the spaces around XML tag values and saves them back to the document.

Innovation Award
PHP Programming Innovation award nominee
November 2015
Number 13
Sometimes you need to process XML files that contain undesired spaces around the tag values.

This class can cleanup a XML document by trimming spaces around XML tag values.

Manuel Lemos
Picture of Thiago Augustus Oliveira
  Performance   Level  
Name: Thiago Augustus Oliveira <contact>
Classes: 1 package by
Country: Brazil Brazil
Age: 37
All time rank: 4100337 in Brazil Brazil
Week rank: 652 Up53 in Brazil Brazil Up
Innovation award
Innovation award
Nominee: 1x

Details

php-xml-nospace

Scrutinizer Code Quality Build Status Code Climate Build Status

Innovation Award

Remove both side spaces between words in a .xml file

Example

$xml = simplexml_load_file( $xml_file );
var_dump( '<pre>', NoXMLSpace::noSpace($xml) );
  Files folder image Files  
File Role Description
Accessible without login Plain text file LICENSE Data Auxiliary data
Plain text file NoXMLSpace.class.php Class Class source
Accessible without login Plain text file README.md Data Auxiliary data

 Version Control Unique User Downloads Download Rankings  
 100%
Total:183
This week:0
All time:8,490
This week:238Up

For more information send a message to info at phpclasses dot org.