Examples of DocumentType


Examples of org.w3c.dom.DocumentType

                    Document owner = a.getOwnerDocument();
                    Entity ent = null;
                    //search for the entity in the docType
                    //of the attribute's ownerDocument
                    if (owner != null) {
                        DocumentType docType = owner.getDoctype();
                        if (docType != null) {
                            NamedNodeMap entities = docType.getEntities();
                            ent = (Entity) entities.getNamedItemNS(
                                    "*",
                                    child.getNodeName());
                        }
                    }
View Full Code Here

Examples of org.w3c.dom.DocumentType

    public boolean isRootName(String name) {
        return rootElement.getNodeName().equals(name);
    }

    public String getDoctype() {
        DocumentType doctype = xmlDocument.getDoctype();
        if (null != doctype) {
            return doctype.getName();
        }
        return null;
    }
View Full Code Here

Examples of org.w3c.dom.DocumentType

        }
        return null;
    }

    public String getPiblicId() {
        DocumentType doctype = xmlDocument.getDoctype();
        if (null != doctype) {
            return doctype.getPublicId();
        }
        return null;
    }
View Full Code Here

Examples of org.w3c.dom.DocumentType

   */
  private List getAvailableRootChildren(Document document, int childIndex) {
    List list = null;

    // extract the valid 'root' node name from the DocumentType Node
    DocumentType docType = document.getDoctype();
    String rootName = null;
    if (docType != null) {
      rootName = docType.getNodeName();
    }
    if (rootName == null) {
      return new ArrayList(0);
    }

    for (Node child = document.getFirstChild(); child != null; child = child.getNextSibling()) {
      // make sure the "root" Element isn't already present
      // is it required to be an Element?
      if ((child.getNodeType() == Node.ELEMENT_NODE) && child.getNodeName().equalsIgnoreCase(rootName)) {
        // if the node is missing either the start or end tag, don't
        // count it as present
        if ((child instanceof IDOMNode) && ((((IDOMNode) child).getStartStructuredDocumentRegion() == null) || (((IDOMNode) child).getEndStructuredDocumentRegion() == null))) {
          continue;
        }
        if (Debug.displayInfo) {
          System.out.println(rootName + " already present!"); //$NON-NLS-1$
        }
        setErrorMessage(NLS.bind(XMLUIMessages.The_document_element__, (new Object[]{rootName})));
        return new ArrayList(0);
      }
    }

    list = new ArrayList(1);
    ModelQuery modelQuery = ModelQueryUtil.getModelQuery(document);
    if (modelQuery != null) {
      CMDocument cmdoc = modelQuery.getCorrespondingCMDocument(document);
      if (cmdoc != null) {
        if (rootName != null) {
          CMElementDeclaration rootDecl = (CMElementDeclaration) cmdoc.getElements().getNamedItem(rootName);
          if (rootDecl != null) {
            list.add(rootDecl);
          }
          else {
            // supply the given document name anyway, even if it
            // is an error
            list.add(new SimpleCMElementDeclaration(rootName));

            String location = "" + (docType.getPublicId() != null ? docType.getPublicId() + "/" : "") + (docType.getSystemId() != null ? docType.getSystemId() : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
            if (location.length() > 0) {
              setErrorMessage(NLS.bind(
                  XMLUIMessages.No_definition_for_in,
                  (new Object[]{rootName, location})));
            }
            else {
              setErrorMessage(NLS.bind(
                  XMLUIMessages.No_definition_for,
                  (new Object[]{rootName})));
            }
          }
        }
      }
      else {
        String location = "" + (docType.getPublicId() != null ? docType.getPublicId() + "/" : "") + (docType.getSystemId() != null ? docType.getSystemId() : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
        if (location.length() > 0) {
          setErrorMessage(NLS.bind(
              XMLUIMessages.No_content_model_for,
              (new Object[]{location})));
        }
View Full Code Here

Examples of org.w3c.dom.DocumentType

      if (child.getNodeType() == DOCUMENT_TYPE_NODE && child instanceof DocumentType) {
        return (DocumentType) child;
      }
      else if (child.getNodeType() == ELEMENT_NODE && ((IDOMElement) child).isCommentTag()) {
        // search DOCTYPE inside of generic comment element
        DocumentType docType = findDoctype(child);
        if (docType != null) {
          return docType;
        }
      }
    }
View Full Code Here

Examples of org.w3c.dom.DocumentType

   *         document, of course, the result is the same, but not
   *         necessarily the same in an ill-formed document.
   */
  public Element getDocumentElement() {
    String name = null;
    DocumentType docType = getDocumentType();
    if (docType != null) {
      name = docType.getName();
    }

    Element first[] = new Element[1];
    Element docElement = findDocumentElement(name, this, first, noMaxSearch);
    if (docElement == null) {
View Full Code Here

Examples of org.w3c.dom.DocumentType

    return adapter.getDocumentType();
  }


  public String getDocumentTypeId() {
    DocumentType docType = getDocumentType();
    if (docType == null)
      return null;
    String id = docType.getPublicId();
    if (id == null)
      id = docType.getSystemId();
    return id;
  }
View Full Code Here

Examples of org.w3c.dom.DocumentType

        if(value != null){
          doctype_pubid = value;
        }
        //Don't inject DOCTYPE if QName is null
        if(doctype_qname != null){
          DocumentType docTypeNode = document.getImplementation()
              .createDocumentType(doctype_qname, doctype_pubid, doctype_sysid);
          if(document.getDoctype() != null){
            document.removeChild(document.getDoctype());
          }
          document.insertBefore(docTypeNode, document.getFirstChild());
View Full Code Here

Examples of org.w3c.dom.DocumentType

     * Returns the document type public identifier
     * specified for this document, or null.
     */
    public static String whichDoctypePublic( Document doc )
    {
        DocumentType doctype;

           /*  DOM Level 2 was introduced into the code base*/
           doctype = doc.getDoctype();
           if ( doctype != null ) {
           // Note on catch: DOM Level 1 does not specify this method
           // and the code will throw a NoSuchMethodError
           try {
           return doctype.getPublicId();
           } catch ( Error except ) {  }
           }
       
        if ( doc instanceof HTMLDocument )
            return DTD.XHTMLPublicId;
View Full Code Here

Examples of org.w3c.dom.DocumentType

     * Returns the document type system identifier
     * specified for this document, or null.
     */
    public static String whichDoctypeSystem( Document doc )
    {
        DocumentType doctype;

        /* DOM Level 2 was introduced into the code base*/
           doctype = doc.getDoctype();
           if ( doctype != null ) {
           // Note on catch: DOM Level 1 does not specify this method
           // and the code will throw a NoSuchMethodError
           try {
           return doctype.getSystemId();
           } catch ( Error except ) { }
           }
       
        if ( doc instanceof HTMLDocument )
            return DTD.XHTMLSystemId;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.