title: Using python-docx, how can I associate an XML namespace prefix?
body: <p>I am currently trying to add a checkbox to a word document using the python-docx library. I've narrowed down the checkbox XML to two possible options, the first from evaluating the word/document.xml file from an existing doc and the second from the XML Schema. When trying to insert the XML element into a simple document I receive the error; "lxml.etree.XMLSyntaxError: Namespace prefix xsd on complexType is not defined".</p>
  
  <p>This is what I'm currently trying (using XML from the Schema):</p>
  
  <pre><code>def word_docs(emails):
      cbox = parse_xml('&lt;xsd:complexType name="CT_FFCheckBox"&gt;&lt;xsd:sequence&gt;  \
                  &lt;xsd:choice&gt;&lt;xsd:element name="size"type="CT_HpsMeasure"/&gt;  \
                  &lt;xsd:element name="sizeAuto" type="CT_OnOff"/&gt;&lt;/xsd:choice&gt; \
                  &lt;xsd:element name="default" type="CT_OnOff" minOccurs="0"/&gt; \
                  &lt;xsd:element name="checked" type="CT_OnOff" minOccurs="0"/&gt; \
                  &lt;/xsd:sequence&gt;&lt;/xsd:complexType&gt;')
  
      doc = Document()
      title = doc.add_heading("Document", 0)
      table = doc.add_table(rows = 1, cols = 4)
      table.style = 'TableGrid'
  
      row = table.rows[0]
      row.cells[0].text = "Test"
  
      merged = (row.cells[1].merge(row.cells[2]))
      merged._tc._add_p()
      ....
  </code></pre>
  
  <p>The following is the XML pulled from an existing document:</p>
  
  <pre><code>&lt;w:tc&gt;
  &lt;w:tcPr&gt;
      &lt;w:tcW w:w="4788" w:type="dxa"/&gt;
  &lt;/w:tcPr&gt;
  &lt;w:p wsp:rsidR="00834643" wsp:rsidRPr="00834643" wsp:rsidRDefault="00F12FD5" wsp:rsidP="00834643"&gt;
      &lt;w:pPr&gt;
          &lt;w:spacing w:after="0" w:line="240" w:line-rule="auto"/&gt;
      &lt;/w:pPr&gt;
      &lt;w:r&gt;
          &lt;w:fldChar w:fldCharType="begin"&gt;
              &lt;w:fldData xml:space="preserve"&gt;/////2UAAAAUAAYAQwBoAGUAYwBrADEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA&lt;/w:fldData&gt;
          &lt;/w:fldChar&gt;
      &lt;/w:r&gt;
      &lt;aml:annotation aml:id="1" w:type="Word.Bookmark.Start" w:name="Check2"/&gt;
          &lt;w:r&gt;
              &lt;w:instrText&gt; FORMCHECKBOX &lt;/w:instrText&gt;
          &lt;/w:r&gt;
          &lt;w:r&gt;
              &lt;w:fldChar w:fldCharType="end"/&gt;
          &lt;/w:r&gt;
      &lt;aml:annotation aml:id="1" w:type="Word.Bookmark.End"/&gt;
  &lt;/w:p&gt;
  </code></pre>
  
  <p></p>
  
  <p>I've been able to manually add the namespace <code>xmlns:xsd="http://www.w3.org/2001/XMLSchema"</code> manually to a document and it seems to open correctly, I am just unsure of how to do this in a pythonic way to automate the process.
  The XML object manipulation through python-docx may be incorrect, but it is what makes sense to me after comparing the XML format and the python-docx objects and the way they are handled - I haven't been able to test it with this error.</p>
  
  <p>Any help is appreciated!
  Thanks!</p>