XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
XmlQueryParser.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 
7 if(!defined('__XE_LOADED_XML_CLASS__'))
8 {
9  define('__XE_LOADED_XML_CLASS__', 1);
10 }
11 
21 {
22 
27  function __construct()
28  {
29 
30  }
31 
37  function &getInstance()
38  {
39  static $theInstance = NULL;
40  if(!isset($theInstance))
41  {
42  $theInstance = new XmlQueryParser();
43  }
44  return $theInstance;
45  }
46 
60  function &parse_xml_query($query_id, $xml_file, $cache_file)
61  {
62  // Read xml file
63  $xml_obj = $this->getXmlFileContent($xml_file);
64 
65  // insert, update, delete, select action
66  $action = strtolower($xml_obj->query->attrs->action);
67  if(!$action)
68  {
69  return;
70  }
71 
72  // Write query cache file
73  $parser = new QueryParser($xml_obj->query);
74  FileHandler::writeFile($cache_file, $parser->toString());
75 
76  return $parser;
77  }
78 
88  function parse($query_id = NULL, $xml_file = NULL, $cache_file = NULL)
89  {
90  $this->parse_xml_query($query_id, $xml_file, $cache_file);
91  }
92 
100  function getXmlFileContent($xml_file)
101  {
102  $buff = FileHandler::readFile($xml_file);
103  $xml_obj = parent::parse($buff);
104  if(!$xml_obj)
105  {
106  return;
107  }
108  unset($buff);
109  return $xml_obj;
110  }
111 
112 }
113 /* End of file XmlQueryParser.class.php */
114 /* Location: ./classes/xml/XmlQueryParser.class.php */
writeFile($filename, $buff, $mode="w")
& parse_xml_query($query_id, $xml_file, $cache_file)
getXmlFileContent($xml_file)
parse($query_id=NULL, $xml_file=NULL, $cache_file=NULL)
readFile($filename)