Search results 1-6 of 6 for "savexml".
) by something which will be considered as normal text by the parser (let's say '[AMP]' by ex) in the input document before the transformation. After the transformation, you can get these entitites back in the output document by reversing the previous operation. <?php $xml = $input_dom > saveXML (); $xml = str_replace ( '&' , '[AMP]' , $xml ); $input_dom > loadXML ( $xml ); $xml = $xsl > transformToXML ( $input_dom ); $xml = str_replace ( '[AMP]' , '&' , $xml ); $output_dom > loadXML ( $xml ); ?...
. Parameter Liste node The SimpleXMLElement node. Rückgabewerte The DOMElement node added or FALSE if any errors occur. Beispiele Beispiel #1 Import SimpleXML into DOM with dom_import_simplexml() <?php $sxe = simplexml_load_string ( 'blah' ); if ( $sxe === false ) { echo 'Error while parsing the document' ; exit; } $dom_sxe = dom_import_simplexml ( $sxe ); if (! $dom_sxe ) { echo 'Error while converting XML' ; exit; } $dom = new DOMDocument ( '1.0' ); $dom_sxe = $dom > importNode ( $dom_sxe , tr...
:06 Something that surprised me, any changes made to the SimpleXML object obtained from the imported DOMDocument also change the original DOMDocument. e.g. <?php $string = 'abc' ; $domxml = DOMDocument :: loadXML ( $string ); $simplexml = simplexml_import_dom ( $domxml ); $simplexml > foo = "xyz" ; $simplexml > bar = "123" ; echo $domxml > saveXML (); ?> Outputs: START <?xml version = "1.0" ?> xyz123 spam AT media MINUS soma DOT de 26 Jul 2006 04
:09 This is a very simple way to get the innerHTML of a node: <?php function getNodeInnerHTML ( $elem ) { return simplexml_import_dom ( $elem ) > asXML (); } ?> I had trouble making other suggestions works, but this works perfectly for me. adam dot clements at gmail dot com 26 Apr 2010 06:29 I spent ages figuring out how to get a string representation of a DOMElement (that wasn't the entire DOMDocument), finally I came across this snippet: <?php $string = $domDocument > saveXML ( $node ); ?> whe...
Document ( void ) bool registerNodeClass ( string $baseclass , string $extendedclass ) bool relaxNGValidate ( string $filename ) bool relaxNGValidateSource ( string $source ) int save ( string $filename [, int $options ] ) string saveHTML ( void ) int saveHTMLFile ( string $filename ) string saveXML ([ DOMNode $node [, int $options ]] ) bool schemaValidate ( string $filename ) bool schemaValidateSource ( string $source ) bool validate ( void ) int xinclude ([ int $options ] ) /* Geerbte Methoden...
CDATASection ( 'new cdata content' ); $node > appendChild ( $newText ); echo "Content withCDATA: " . $doc > saveXML ( $node ). "\n" ; ?> Steve K 03 Nov 2009 07:47 This class apparently also has a getElementsByTagName method. I was able to confirm this by evaluating the output from DOMNodeList >item() against various tests with the is_a() function. marc at ermshaus dot org 05 May 2009 03:36 It took me forever to find a mapping for the XML_*_NODE constants