private static function getAttributes(SgmlOpenTag $tag)
 {
     $attributes = array();
     foreach ($tag->getAttributesList() as $name => $value) {
         if ($value === null) {
             $quotedValue = null;
         } else {
             // FIXME: is multibyte safe?
             $quotedValue = '="' . str_replace('"', '"', $value) . '"';
         }
         $attributes[] = $name . $quotedValue;
     }
     return implode(' ', $attributes);
 }
 /**
  * @return SgmlOpenTag
  **/
 private function createOpenTag()
 {
     if (!self::isValidId($this->tagId)) {
         $this->error("tag id '{$this->tagId}' is invalid");
     } elseif ($this->lowercaseTags) {
         $this->tagId = strtolower($this->tagId);
     }
     return $this->setupTag(SgmlOpenTag::create());
 }