PHP Classes

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: 198 This week: 1All time: 8,496 This week: 560Up
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: 40
All time rank: 4143339 in Brazil Brazil
Week rank: 411 Up35 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:198
This week:1
All time:8,496
This week:560Up