Examples of IDOMDocumentType


Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocumentType

  }

  /**
   */
  private IDOMDocumentType findDocumentType(IDOMDocument document) {
    IDOMDocumentType documentType = (IDOMDocumentType) document.getDoctype();
    if (documentType != null && documentType.getExistingAdapter(DocumentTypeAdapter.class) == null) {
      // watch future changes
      documentType.addAdapter(this);
    }
    return documentType;
  }
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocumentType

        if (target != null && target.equals("xml")) { //$NON-NLS-1$
          pi = (ProcessingInstruction) child;
          child = child.getNextSibling();
        }
      }
      IDOMDocumentType docType = (IDOMDocumentType) document.getDoctype();

      if (declaration != null) {
        if (pi != null) {
          pi.setData(declaration);
        }
        else {
          pi = document.createProcessingInstruction("xml", declaration); //$NON-NLS-1$
          document.insertBefore(pi, child);
          insertBreak(model, child);
        }
      }

      if (publicId != null) {
        HTMLDocumentTypeEntry entry = HTMLDocumentTypeRegistry.getInstance().getEntry(publicId);
        String name = (entry != null ? entry.getName() : null);
        if (name == null || name.length() == 0)
          name = "HTML"; // default //$NON-NLS-1$
        if (docType != null) {
          if (!name.equals(docType.getName())) { // replace
            Node parent = docType.getParentNode();
            child = docType;
            docType = (IDOMDocumentType) document.createDoctype(name);
            parent.insertBefore(docType, child);
            parent.removeChild(child);
          }
        }
        else {
          docType = (IDOMDocumentType) document.createDoctype(name);
          document.insertBefore(docType, child);
          insertBreak(model, child);
        }
        docType.setPublicId(publicId);
        if (entry != null) {
          String systemId = entry.getSystemId();
          if (systemId != null)
            docType.setSystemId(systemId);
          String namespaceURI = entry.getNamespaceURI();
          if (namespaceURI != null) {
            Element element = document.getDocumentElement();
            if (element != null) {
              element.setAttribute("xmlns", namespaceURI); //$NON-NLS-1$
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocumentType

  }

  /**
   */
  private IDOMDocumentType findDocumentType(IDOMDocument document) {
    IDOMDocumentType documentType = (IDOMDocumentType) document.getDoctype();
    if (documentType != null && documentType.getExistingAdapter(DocumentTypeAdapter.class) == null) {
      // watch future changes
      documentType.addAdapter(this);
    }
    return documentType;
  }
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocumentType

  protected DocumentType createDoctype(EditDoctypeDialog dialog, Document document) {
    DocumentType result = null;
    if (document instanceof DocumentImpl) {
      IDOMDocument documentImpl = (IDOMDocument) document;
      IDOMDocumentType doctypeImpl = (IDOMDocumentType) documentImpl.createDoctype(dialog.getName());
      doctypeImpl.setPublicId(dialog.getPublicId());
      doctypeImpl.setSystemId(dialog.getSystemId());
      result = doctypeImpl;
    }
    return result;
  }
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocumentType

  }


  protected void updateDoctype(EditDoctypeDialog dialog, DocumentType doctype) {
    if (doctype instanceof IDOMDocumentType) {
      IDOMDocumentType doctypeImpl = (IDOMDocumentType) doctype;
      if (doctypeImpl.getName().equals(dialog.getName())) {
        doctypeImpl.setPublicId(dialog.getPublicId());
        doctypeImpl.setSystemId(dialog.getSystemId());
      }
      else {
        // we need to create a new one and remove the old
        //                 
        Document document = doctype.getOwnerDocument();
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.