code: @Override
      public void setNamespaceContext(NamespaceContext ctxt)
          throws XMLStreamException
      {
          // This is only allowed before root element output:
          if (mState != STATE_PROLOG) {
              throwOutputError("Called setNamespaceContext() after having already output root element.");
          }
  
          mRootNsContext = ctxt;
          mCurrElem.setRootNsContext(ctxt);
      }
docs: <p>
  Note: Root namespace context works best if automatic prefix
  creation ("namespace/prefix repairing" in StAX lingo) is enabled.