Exemple #1
0
 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;
         }
     }
 }
Exemple #2
0
 function define_field($tag, $content)
 {
     $field = new Field();
     $field->setTag($tag);
     $field->setContent($content);
     $this->registro->addField($field);
 }
Exemple #3
0
 function defineField($tag, $content)
 {
     $field = new Field();
     if ($content == "") {
         $content == "vazio";
     }
     $content = utf8_encode($content);
     $field->setTag($tag);
     $field->setContent($content);
     $this->registro->addField($field, false);
 }
Exemple #4
0
 function defineField($tag, $content)
 {
     $field = new Field();
     //$content = utf8_encode($content);
     $field->setTag($tag);
     $field->setContent($content);
     $this->registro->addField($field, true);
 }
Exemple #5
0
 function defineField($tag, $content)
 {
     if (isset($content) && $content != "") {
         $field = new Field();
         $content = utf8_encode($content);
         $field->setTag($tag);
         $field->setContent($content);
         $this->registro->addField($field, false);
     }
 }