function unserializeFromString($rawxml) { $xml_parser = xml_parser_create(); xml_parse_into_struct($xml_parser, $rawxml, $vector, $indice); xml_parser_free($xml_parser); $buffer = ""; for ($i = 0; $i < sizeof($vector); $i++) { if ($vector[$i]["tag"] == "RECORD" && $vector[$i]["type"] == "open") { $this->setMfn($vector[$i][attributes]["MFN"]); } if ($vector[$i]["tag"] == "FIELD" && $vector[$i]["type"] == "complete") { $campo = new Field(); if ($vector[$i][attributes]["TAG"] != "") { $campo->setTag($vector[$i][attributes]["TAG"]); $campo->setContent($vector[$i]["value"]); $this->addField($campo); } //echo "<field tag=\"". $vector[$i][attributes]["TAG"]."\"><occ>".$vector[$i]["value"]."</occ></field>\n"; } if ($vector[$i]["tag"] == "FIELD" && $vector[$i]["type"] == "open") { $campo = new Field(); if ($vector[$i][attributes]["TAG"] != "") { $campo->setTag($vector[$i][attributes]["TAG"]); $campo->setContent(str_replace("\r", "", str_replace("\n", "", trim($vector[$i]["value"])))); } //$buffer="<field tag=\"". $vector[$i][attributes]["TAG"]."\"><occ>".; } if ($vector[$i]["tag"] == "SUBFIELD" && $vector[$i]["type"] == "complete") { $subcampo = new Subfield(); $subcampo->setLetra($vector[$i][attributes]["ID"]); $subcampo->setContent($vector[$i]["value"]); $campo->addSubField($subcampo); //$buffer.="^".$vector[$i][attributes]["ID"].trim(trim($vector[$i]["value"],"\r"),"\n"); } if ($vector[$i]["tag"] == "FIELD" && $vector[$i]["type"] == "close") { $this->addField($campo); //$buffer .= "</occ></field>\n"; //echo $buffer; } } }
function defineSubfield($letter, $content) { if ($content == "") { $content == "vazio"; } $content = utf8_encode($content); $subfield = new Subfield(); $subfield->setLetra($letter); $subfield->setContent($content); return $subfield; }
function defineSubfield($letter, $content) { //$content = utf8_encode($content); $subfield = new Subfield(); $subfield->setLetra($letter); $subfield->setContent($content); return $subfield; }