Created
February 15, 2012 19:05
-
-
Save johnrobertwilson/1838197 to your computer and use it in GitHub Desktop.
XML parsing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$file_path = drupal_get_path('module', 'cc_ingestion_engine') . '/xml/cbindicators_revised.xml'; | |
include($file_path . '/cc_ingestion_engine.module'); | |
$content = utf8_encode(file_get_contents($file_path)); | |
$xml = simplexml_load_string($content); | |
$areas_xml_object = $xml->areas; | |
$charts_xml_object = $xml->charts; | |
$chart_types = $xml->chart_types; | |
$definition_sources_xml_object = $xml->definitionsources; | |
$indicators_xml_object = $xml->indicators; | |
$measures_xml_object = $xml->measures; | |
$populations_xml_object = $xml->populations; | |
// Convert areas xml to PHP array | |
$areas = json_encode($areas_xml_object); | |
$areas = json_decode($areas, TRUE); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment