function getPath($separator = ".", $with_name = false)
 {
     $path = $this->parent->getPath($separator, $with_name);
     if (self::$_get_path_full) {
         $path[] = $this->self_pos + 1;
     } else {
         $path[count($path) - 1] = $path[count($path) - 1] . "[" . ($this->self_pos + 1) . "]";
     }
     return $path;
 }
 /**
  * @see parent::parse
  */
 function parse($data)
 {
     parent::parse($data);
     $message = $this->getMessage();
     $fields = CHL7v2::split($message->fieldSeparator, $data);
     $this->name = array_shift($fields);
     $specs = $this->getSpecs();
     $this->description = $specs->queryTextNode("description");
     if ($this->name === $message->getHeaderSegmentName()) {
         array_unshift($fields, $message->fieldSeparator);
     }
     // Don't count empty fields on the right
     $count_fields = count($fields);
     for ($i = $count_fields - 1; $i >= 0; $i--) {
         if ($fields[$i] === "") {
             $count_fields--;
         } else {
             break;
         }
     }
     $_segment_specs = $specs->getItems();
     // Check the number of fields
     if ($count_fields > count($_segment_specs)) {
         $this->error(CHL7v2Exception::TOO_MANY_FIELDS, $data, $this, CHL7v2Error::E_WARNING);
     }
     foreach ($_segment_specs as $i => $_spec) {
         if (array_key_exists($i, $fields)) {
             $field = new CHL7v2Field($this, $_spec);
             $field->parse($fields[$i]);
             $this->fields[] = $field;
         } elseif ($_spec->isRequired()) {
             $field = new CHL7v2Field($this, $_spec);
             $this->error(CHL7v2Exception::FIELD_EMPTY, $field->getPathString(), $field);
         }
     }
 }
 /**
  * Parses an MB value
  * 
  * @param string      $value The MB value
  * @param CHL7v2Field $field The field containing the value
  * 
  * @return array A structure containing the elements of the value
  */
 protected function parseMB($value, CHL7v2Field $field)
 {
     if ($value === null || $value === "") {
         return array();
     }
     if (!preg_match($this->getRegExpMB(), $value, $matches)) {
         $field->error(CHL7v2Exception::INVALID_DATA_FORMAT, "'{$value}' ({$this->type})", $field);
         return false;
     }
     return $matches;
 }