PHP code example of fawno / simple-xml-extended

1. Go to this page and download the library: Download fawno/simple-xml-extended library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

fawno / simple-xml-extended example snippets


  use Fawno\SimpleXMLExtended\SimpleXMLExtended;

  // Get a SimpleXMLExtended object from a DOM node
  $xml = simplexml_import_dom($dom, SimpleXMLExtended::class);

  // Interprets an XML file into an SimpleXMLExtended object
  $xml = simplexml_load_file($xml_file, SimpleXMLExtended::class);

  // Interprets a string of XML into an SimpleXMLExtended object
  $xml = simplexml_load_string($xml_string, SimpleXMLExtended::class);

  // Creates a new SimpleXMLExtended object
  $xml = new SimpleXMLExtended($xml_string);

  // Adds a child element to the XML node as cdata
  $xml->addChildCData('node_cdata', 'data as cdata');

  // Return a well-formed and nice formated XML string based on SimpleXMLExtended element
  $xml->formatXML()

    use Fawno\SimpleXMLExtended\SimpleXMLExtended;

  $root = new SimpleXMLExtended('<?xml version="1.0" encoding="UTF-8"