/** */ public Element createCommentElement(Document document, String data, boolean isJSPTag) { if (document == null || data == null || data.length() == 0) return null; return createMetaElement(document, data, isJSPTag); }
private static boolean isValidChild(CMElementDeclaration parent, CMElementDeclaration child) { if (parent == null || child == null) return false; CMContent content = parent.getContent(); if (content == null) return false; return isChild(content, child); }
return true; if (shouldTerminateAt(myDec, childDec) && !isValidChild(myDec, childDec)) { return false; IDOMElement parentElement = (IDOMElement) parent; if (!parentElement.hasStartTag() && !parentElement.hasEndTag()) { if (!canContain(parentElement, child)) return false;
/** */ private static boolean isChild(CMContent content, CMElementDeclaration target) { switch (content.getNodeType()) { case CMNode.ELEMENT_DECLARATION : return isSameDeclaration((CMElementDeclaration) content, target); case CMNode.GROUP : CMNodeList children = ((CMGroup) content).getChildNodes(); for (int i = 0; i < children.getLength(); i++) { CMNode child = children.item(i); switch (child.getNodeType()) { case CMNode.ELEMENT_DECLARATION : if (isSameDeclaration((CMElementDeclaration) child, target)) return true; continue; // Go next child. case CMNode.GROUP : if (isChild((CMContent) child, target)) return true; continue; // Go next child. default : continue; // Go next child. } } } return false; }
/** * Method that returns the adapter associated with the given object. It * may be a singleton or not ... depending on the needs of the * INodeAdapter ... but in general it is recommended for an adapter to be * stateless, so the efficiencies of a singleton can be gained. * * The implementation of this method should call addAdapter on the adapted * object with the correct instance of the adapter. */ public INodeAdapter adapt(INodeNotifier notifier) { INodeAdapter adapter = null; if (notifier != null) { if (notifier instanceof IDOMDocument) { adapter = notifier.getExistingAdapter(ModelParserAdapter.class); if (adapter == null) { adapter = new HTMLModelParserAdapter(); notifier.addAdapter(adapter); } } } return adapter; }