Location: PHPKode > scripts > QXML > qxml/sample6.php
<?php

include("QXml.class.php");
include("JSON.class.php");
include("XMLJSON.class.php");

$caption = "Vacation";

$nodes = array(
  "@attributes" => array(
    "dateformat" => "yyyy-mm-dd",
    "dateformat" => "yyyy-mm-dd",
    "hoverCapBorderColor" => "2222ff",
    "hoverCapBgColor" => "e1f5ff",
    "ganttWidthPercent" => 60,
    "ganttLineAlpha" => 80,
    "canvasBorderColor" => "024455",
    "canvasBorderThickness" => 0,
    "gridBorderColor" => "4567aa",
    "gridBorderAlpha" => 20,
  ),
  "categories" => array(
    array(
      "@attributes" => array(
        "bgColor" => "4567aa"
      ),
      "category" => array(
        array(
          "@attributes" => array(
            "start" => "2008-01-01",
            "end" => "2008-12-31",
            "align" => "center",
            "fontColor" => "ffffff",
            "isBold" => 1,
            "fontSize" => 14,
            "name" => $caption,          
            )
        ),
        array(
          "@attributes" => array(
            "start" => "2008-01-01",
            "end" => "2008-12-31",
            "align" => "center",
            "font" => "Verdana",
            "fontColor" => "ffffff",
            "isBold" => 1,
            "fontSize" => 11,
            "name" => "Monate",          
            ),
        ),
        array(
          "@attributes" => array(
            "bgColor" => "4567aa",
            "fontColor" => "ff0000",
            ),
        ),
        
      )
    )
  )
);

$xml = new QXML;
$xml->toXML($nodes);
echo $xml->toJSONFromXML($xml->asXML());

?>
Return current item: QXML