src/AnyDataset.php
private function createFrom($filepath)
    {
        if (file_exists($filepath)) {
            $anyDataSet = XmlUtil::createXmlDocumentFromFile($filepath);
            $this->collection = array();

            $rows = $anyDataSet->getElementsByTagName("row");
            foreach ($rows as $row) {
                $sr = new Row();
                $fields = $row->getElementsByTagName("field");
                foreach ($fields as $field) {
                    $attr = $field->attributes->getNamedItem("name");
                    if (is_null($attr)) {
                        throw new \InvalidArgumentException('Malformed anydataset file ' . basename($filepath));
                    }

                    $sr->addField($attr->nodeValue, $field->nodeValue);
                }
                $sr->acceptChanges();
                $this->collection[] = $sr;
            }
            $this->currentRow = count($this->collection) - 1;
        }
    }
private function createFrom($filepath)
    {
        if (file_exists($filepath)) {
            $anyDataSet = XmlUtil::createXmlDocumentFromFile($filepath);
            $this->collection = array();

            $rows = $anyDataSet->getElementsByTagName("row");
            foreach ($rows as $row) {
                $sr = new Row();
                $fields = $row->getElementsByTagName("field");
                foreach ($fields as $field) {
                    $attr = $field->attributes->getNamedItem("name");
                    if (is_null($attr)) {
                        throw new \InvalidArgumentException('Malformed anydataset file ' . basename($filepath));
                    }

                    $sr->addField($attr->nodeValue, $field->nodeValue);
                }
                $sr->acceptChanges();
                $this->collection[] = $sr;
            }
            $this->currentRow = count($this->collection) - 1;
        }
    }
private function createFrom ( $ filepath ) { if ( file_exists ( $ filepath ) ) { $ anyDataSet = XmlUtil :: createXmlDocumentFromFile ( $ filepath ) ; $ this -> collection = array ( ) ; $ rows = $ anyDataSet -> getElementsByTagName ( "row" ) ; foreach ( $ rows as $ row ) { $ sr = new Row ( ) ; $ fields = $ row -> getElementsByTagName ( "field" ) ; foreach ( $ fields as $ field ) { $ attr = $ field -> attributes -> getNamedItem ( "name" ) ; if ( is_null ( $ attr ) ) { throw new \ InvalidArgumentException ( 'Malformed anydataset file ' . basename ( $ filepath ) ) ; } $ sr -> addField ( $ attr -> nodeValue , $ field -> nodeValue ) ; } $ sr -> acceptChanges ( ) ; $ this -> collection [ ] = $ sr ; } $ this -> currentRow = count ( $ this -> collection ) - 1 ; } }
Private method used to read and populate anydataset class from specified file

@param string $filepath Path and Filename to be read
@throws \ByJG\Serializer\Exception\InvalidArgumentException
@throws \ByJG\Util\Exception\XmlUtilException
Private method used to read and populate anydataset class from specified file