I'm setting up an xml file with DOMDocument like this :
$document = new DOMDocument('1.0', 'utf-8');
$document->xmlStandalone = true;
$provider = $document->createElement( "provider" );
$j = $document->createElement( $PARAM );
$j->setAttribute( 'value', "$VALUE" );
$provider->appendChild( $j );
This works very well untill... I hit a $PARAM with square brackets in it, like :
dirProvider[0].NumberAttributes
I have tried using preg_quote()
, but does not work.
I have tried using htmlspecialchars()
, but does not work.
I have tried using createTextNode()
:
$j = $document->createTextNode( $PARAM );
$j->setAttribute( 'value', "$VALUE" );
$provider->appendChild( $j );
but does not work.
An idea on how I can get these 'special' element names right ?