protected CMDocument getCorrespondingCMDocument(Node node, boolean getDocumentFromCMNode) {
    CMDocument result = null;
    try {
      Document document =
          node.getNodeType() == Node.DOCUMENT_NODE ? (Document) node : node.getOwnerDocument();

      String[] doctypeInfo = getDoctypeInfo(document);

      if (doctypeInfo != null) {
        result = getCMDocument(doctypeInfo[0], doctypeInfo[1], "DTD"); // $NON-NLS-1$
      }
      // defect 211236 ... in some cases calling this method can result in a cycle
      // we use the getDocumentFromCMNode as a flag to avoid this
      // TODO... see if there is a way to re-organize to avoid the need for this flag
      else if (getDocumentFromCMNode) {
        CMNode cmNode = getCMNode(node);
        if (cmNode != null) {
          // todo... add a getCMDocument() methods to CMNode
          // for now use the getProperty interface
          result = (CMDocument) cmNode.getProperty("CMDocument"); // $NON-NLS-1$
        }
      }
    } catch (Exception e) {
      Logger.logException("exception locating CMDocument for " + node, e); // $NON-NLS-1$
    }
    return result;
  }
 public String getValue() {
   switch (kind) {
     case KIND_ATTR_TEXT:
     case KIND_ELEMENT_ATTR:
       {
         // note intentional fall-thru!!
         return attribute.getNodeValue();
       }
     case KIND_ELEMENT_CMATTRIBUTE:
       {
         // CS : one would think that we'd just need to return "" here
         // but after editing a item of this kind and giving it value
         // the list of item's doesn't get recomputed.. so we need to trick
         // one of these items to behave like the KIND_ELEMENT_ATTR case
         //
         String value = parent.getAttribute(cmNode.getNodeName());
         return (value != null) ? value : "";
       }
     case KIND_ELEMENT_TEXT:
       {
         return new TreeContentHelper().getElementTextValue(parent);
       }
   }
   return "";
 }
 public String getRequiredName(Node ownerNode, CMNode cmnode) {
   String name = super.getRequiredName(ownerNode, cmnode);
   // don't change the case unless we're certain it is meaningless
   if (shouldIgnoreCase(cmnode)) {
     int caseVal = -1;
     if (cmnode.getNodeType() == CMNode.ELEMENT_DECLARATION) caseVal = fTagCase;
     else if (cmnode.getNodeType() == CMNode.ATTRIBUTE_DECLARATION) caseVal = fAttrCase;
     switch (caseVal) {
       case HTMLCorePreferenceNames.LOWER:
         {
           name = name.toLowerCase();
         }
         break;
       case HTMLCorePreferenceNames.UPPER:
         {
           name = name.toUpperCase();
         }
         break;
     }
   }
   return name;
 }
 private boolean shouldIgnoreCase(CMNode cmnode) {
   if (!cmnode.supports(HTMLCMProperties.SHOULD_IGNORE_CASE)) return false;
   return ((Boolean) cmnode.getProperty(HTMLCMProperties.SHOULD_IGNORE_CASE)).booleanValue();
 }