PHP code example of krzysztofzylka / xml-view-generator

1. Go to this page and download the library: Download krzysztofzylka/xml-view-generator 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/ */

    

krzysztofzylka / xml-view-generator example snippets


$xml = new \Krzysztofzylka\XmlViewGenerator\XmlViewGenerator();
$xml->loadXmlData('
<Data xmlns="http://test.pl/">
  <Naglowek>
    <Kod wersjaSchemy="1">Test</Kod>
    <WariantFormularza>1</WariantFormularza>
    <DataWytworzenia>2023-08-22T14:29:03</DataWytworzenia> 
  </Naglowek>
  <Dane>
    <A1>Test</A1>
  </Dane>
</Data>
');
$xml->setNodeDescriptions([
    'A1' => 'Testowy komentarz'
]);

echo $xml->render();

$xml->loadXmlData('string');

$xml->loadXmlFile('file_path');

$xml->setNodeDescriptions(['node_name' => 'description', ...]);

$xml->loadNodeDescriptionsFromXSD('file_path');

echo $xml->render();