XML Parsing helper

Permalink
I am writing a package that does a lot of parsing of XML received from a third party REST API. I am currently using DOMDocument, DOMElement, DOMXPath and a few others to help me do this.

Is there something in C5 such as a helper or some kind of XML parsing class that can help me with this.

Thanks,

Warren Bell

warish
 
WillemAnchor replied on at Permalink Reply
WillemAnchor
Have a look at Concrete\Core\Database\Schema;
Here is a snippet:

$yourXMLfile = 'yourfile.xml';
   $db = \Database::connection();
   $db->beginTransaction();
   $schema = Schema::loadFromXMLFile($yourXMLfile, $db);
   $platform = $db->getDatabasePlatform();
   $queries = $schema->toSql($platform);
   foreach ($queries as $query) {
      $db->query($query);
      $res .= $query . '<br>';
   }
   $db->commit();
   unset($schema);
   unset($platform);