private DataserviceTagElement getCurrentDataserviceElement(
     ContentAssistRequest contentAssistRequest) {
   List<String> path = new ArrayList<String>();
   Node currentNode = getCurrentNode(contentAssistRequest);
   while (currentNode != null) {
     if (!(currentNode instanceof Text) && currentNode.getOwnerDocument() != null) {
       path.add(currentNode.getNodeName());
     }
     currentNode = currentNode.getParentNode();
   }
   DataserviceTagElement rootElement = DataserviceTemplate.getRootElement();
   DataserviceTagElement currentElement = null;
   if (rootElement.getName().equals(path.get(path.size() - 1))) {
     currentElement = rootElement;
   } else {
     return null;
   }
   for (int i = path.size() - 2; i >= 0; i--) {
     String s = path.get(i);
     DataserviceTagElement subElement = currentElement.getSubElement(s);
     if (subElement == null) {
       return null;
     } else {
       currentElement = subElement;
     }
   }
   return currentElement;
 }
  protected void addAttributeNameProposals(ContentAssistRequest contentAssistRequest) {
    DataserviceTagElement currentDataserviceElement =
        getCurrentDataserviceElement(contentAssistRequest);
    if (currentDataserviceElement != null) {
      List<DataserviceAttributeElement> attributes = currentDataserviceElement.getAttributes();
      Node currentNode = getCurrentNode(contentAssistRequest);
      for (DataserviceAttributeElement element : attributes) {
        if (!isAttributePresent(currentNode, element.getName())) {
          contentAssistRequest.addProposal(getAttributeNameProposal(element));
        }
      }

    } else {
      super.addAttributeNameProposals(contentAssistRequest);
    }
  }
 @SuppressWarnings("restriction")
 protected void addTagInsertionProposals(
     ContentAssistRequest contentAssistRequest, int childPosition) {
   DataserviceTagElement currentDataserviceElement =
       getCurrentDataserviceElement(contentAssistRequest);
   if (currentDataserviceElement != null) {
     List<DataserviceTagElement> subElements = currentDataserviceElement.getSubElements();
     Node currentNode = getCurrentNode(contentAssistRequest);
     for (DataserviceTagElement element : subElements) {
       if (element.isUpperLimitUnbound()
           || getChildNodeCount(currentNode, element.getName()) < element.getMaxOccurances()) {
         contentAssistRequest.addProposal(getTagProposal(element));
       }
     }
   } else {
     super.addTagInsertionProposals(contentAssistRequest, childPosition);
   }
 }