Welcome Guest, Not a member yet? Register   Sign In
How to combine DOMIT and Codeigniter
#1

[eluser]yagie[/eluser]
Hi All..

I'm creating a web for reading an XML file.., I'm using domit for achieving it.
For now, it is still native and I want to change it to codeigniter.
Is it possible to do that?
How can I turn it to codeigniter code?

Here is my native code :
Code:
// include domit libraries
        require_once('domit/xml_domit_include.php');

        //set debug variable
        define("DEBUG", true);
        
        //instant of new domit class
        $VimsData =& new DOMIT_Document();
        $VimsData->resolveErrors(true);

        //load vims.xml file
        $success = $VimsData->loadXML("Vims2.xml", false);
        if ($success) {
            if ($VimsData->documentElement->hasChildNodes()) {  //get a reference to the childNodes collection of the document element  
                $childOfTable = & $VimsData->documentElement->childNodes[3]->childNodes[0]->childNodes;
                $childOfTableCount = $VimsData->documentElement->childNodes[3]->childNodes[0]->childCount;
                
                //looping for Table xml tag (<Table> until </Table>)
                for ($i = 1; $i < $childOfTableCount; $i++) {        
                    $currentNode = & $childOfTable[$i];    //Current node as child of table tag
                    $childOfRow = $currentNode->childNodes; //childOfRow object
                    $childOfRowCount = $currentNode->childCount; //number of childOfRow element

                    for($j=1; $j < $childOfRowCount; $j++){
                        if($j == 0)
                            $category = $childOfRow[$j]->childNodes[0]->childNodes[0]->nodeValue; // set category variable
                        if($j == 1)
                            $ID = $childOfRow[$j]->childNodes[0]->childNodes[0]->nodeValue; //set ID variable
                        if($j == 2)
                            $serialNumber = $childOfRow[$j]->childNodes[0]->childNodes[0]->nodeValue; //set serialNumber variable
                        if($j == 3)
                            $vimsTime = $childOfRow[$j]->childNodes[0]->childNodes[0]->nodeValue; //set VimsTime variable
                        
                        if($j == 4)
                            $dataValue = $childOfRow[$j]->childNodes[0]->childNodes[0]->nodeValue; //set dataValue variable
                        if($j == 5)
                            $description =  $childOfRow[$j]->childNodes[0]->childNodes[0]->nodeValue; // set description variable
                    }
                    if(DEBUG)
                    echo "category : $category; id: $ID; serial: $serialNumber; vimsTime: ". xmlDateToMysql($vimsTime) .";  value: $dataValue; desciption : $description \n<br />\n<br />";
                
                }
                
            }
        }

Thanks in Advance
#2

[eluser]Stenna[/eluser]
Your answer very good. so keep it up.


Thanks

------------------------




Theme © iAndrew 2016 - Forum software by © MyBB