protected function toXmlTag($tag, $attrs, $content = null)
    {
        $xml = "<$tag ";
        if ($attrs) {
            $attrStrs = array();
            foreach ($attrs as $attrName => $attrVal) {
                $attrStrs[] = "$attrName='$attrVal'";
            }
            $xml .= $attrStrs ? implode(' ', $attrStrs) : '';
        }
        $xml .= $content ? ">$content</$tag>" : '/>';
        return $xml;
    }