code: @Override
      public long insertNamespace(final QName pQName) throws TTException {
          checkState(!mDelegate.isClosed(), "Transaction is already closed.");
          checkNotNull(pQName);
          checkState(mDelegate.getCurrentNode() instanceof ElementNode,
              "Insert is not allowed if current node is not an ElementNode, but was %s", mDelegate
                  .getCurrentNode());
  
          final int uriKey = insertName(pQName.getNamespaceURI());
          final int prefixKey = insertName(pQName.getPrefix());
          final long elementKey = mDelegate.getCurrentNode().getDataKey();
  
          final NodeDelegate nodeDel = new NodeDelegate(getPtx().incrementDataKey(), elementKey, 0);
          final NameNodeDelegate nameDel = new NameNodeDelegate(nodeDel, prefixKey, uriKey);
  
          final NamespaceNode node = new NamespaceNode(nodeDel, nameDel);
          getPtx().setData(node);
  
          final ITreeData parentNode = (org.treetank.data.interfaces.ITreeData)getPtx().getData(node.getParentKey());
          ((ElementNode)parentNode).insertNamespace(node.getDataKey());
          getPtx().setData(parentNode);
  
          mDelegate.setCurrentNode(node);
          adaptForInsert(node, false);
          adaptHashesWithAdd();
          return node.getDataKey();
      }
docs: {@inheritDoc}