Package org.allcolor.dtd.parser

Examples of org.allcolor.dtd.parser.CDocType


         *                DOCUMENT ME!
         */
    public void parseDoctype(final String content) {
  try {
    if (isIgnoreDTD()) return;
      CDocType docType = CDTDParser.parseDoctype(content, documentURI,
        document);
      docType.setOwnerDocument(document);
      docType.setNodeValue(content);
      document.appendChildInternal(docType);
      document.setDocumentType(docType);

      document
        .setEntityCodec(new CEntityCoDec(docType.getKnownEntities()));
      if ((docType.getPublicId() != null)
        && (docType.getPublicId().indexOf("HTML") != -1)
        && (docType.getPublicId().indexOf("//W3C//DTD ") != -1)) {
    document.setHTMLDocument(true);
      } // end if
      return;
  } // end try
  catch (final Exception ignore) {
View Full Code Here


    document.setHTMLDocument(true);
      } // end if
      firstTag = false;
      document.loadXSD(elem);
      if (isAutodoctype() && document.getDoctype() == null) {
    CDocType dt = (CDocType) CXmlParser.dtTr.cloneNode(true);
    document.appendChildInternal(dt);
    document.setDocumentType(dt);
      }
  } // end if
View Full Code Here

    document.setHTMLDocument(true);
      } // end if
      firstTag = false;
      document.loadXSD(elem);
      if (isAutodoctype() && document.getDoctype() == null) {
    CDocType dt = (CDocType) CXmlParser.dtTr.cloneNode(true);
    document.appendChildInternal(dt);
    document.setDocumentType(dt);
      }
  } // end if
View Full Code Here

            "Invalid char : " + array[i]);
        }
      } // end for
    } // end else if

    return new CDocType("!DOCTYPE " + qualifiedName + " " +
      ((publicId != null)
      ? ("PUBLIC \"" + publicId + "\" ")
      : "") +
      ((systemId != null)
      ? ("SYSTEM \"" + systemId + "\"")
View Full Code Here

      newNode = newCData;
    } // end else if
    else if (node.getNodeType() == Node.DOCUMENT_TYPE_NODE) {
      if (node.getClass() == CDocType.class) {
        try {
          CDocType o2 = (CDocType) ((CDocType) node).clone();
          o2.setOwnerDocument(document);
          o2.setParent(null);
          newNode = o2;
        } catch (CloneNotSupportedException e) {
        }
      } else {
        DocumentType old = (DocumentType) node;
        String pi = old.getPublicId();
        String si = old.getSystemId();
        String is = old.getInternalSubset();
        StringBuffer content = new StringBuffer();
        content.append("!DOCTYPE ");
        content.append(old.getName());
        if (pi != null) {
          content.append(" PUBLIC \"");
          content.append(pi);
          content.append("\" ");
          if (si != null) {
            content.append("\"");
            content.append(si);
            content.append("\" ");
          }
        } else if (si != null) {
          content.append(" SYSTEM \"");
          content.append(si);
          content.append("\" ");
        }
        if (is != null) {
          content.append("[\n");
          content.append(is);
          content.append("]");
        }
        CDocType dt = new CDocType(content.toString(), old.getName(),
            old.getPublicId(), old.getSystemId(), document);
        dt.isReadOnly = false;
        CNamedNodeMap dtent = (CNamedNodeMap) dt.getEntities();
        dtent.setFreeze(false);
        NamedNodeMap nnm = old.getEntities();
        for (int i = 0; i < nnm.getLength(); i++) {
          CEntity ent = (CEntity) _CloneNode(document, nnm.item(i),
              deep, importNotSpecified);
          dtent.setNamedItem(ent);
        }
        dtent.setFreeze(true);
        CNamedNodeMap dnot = (CNamedNodeMap) dt.getNotations();
        dnot.setFreeze(false);
        nnm = old.getNotations();
        for (int i = 0; i < nnm.getLength(); i++) {
          CNotation not = (CNotation) _CloneNode(document, nnm
              .item(i), deep, importNotSpecified);
View Full Code Here

   */
  public static CDocType loadDTD(final String name) {
    try {
      final ObjectInputStream in = new ObjectInputStream(CXmlParser.class
          .getResourceAsStream(name));
      final CDocType dt = (CDocType) in.readObject();
      in.close();

      return dt;
    } // end try
    catch (final Throwable e) {
View Full Code Here

  }

  public final Object clone() throws CloneNotSupportedException {
    ADocument doc = (ADocument) super.clone();
    doc.resetOwner(doc);
    CDocType docType = (CDocType) doc.getDoctype();
    if (docType != null) {
      NodeList nl = doc.getChildNodes();
      for (int i = 0; i < nl.getLength(); i++) {
        Node n = nl.item(i);
        if (n.getNodeType() == Node.DOCUMENT_TYPE_NODE) {
          doc.doctype = (DocumentType) n;
          break;
        }
      }
      doc.setEntityCodec(new CEntityCoDec(docType.getKnownEntities()));
    }
    return doc;
  }
View Full Code Here

    prefix = null;
    localName = null;
    nameSpace = "  ";
    isDom1 = true;
    if (ownerDocument != null) {
      CDocType dt = (CDocType)ownerDocument.doctype;
      CEntity ent = dt != null ? (CEntity)dt.getEntities().getNamedItem(name) : null;
      if (ent == null) {
        ent = (CEntity)CDTDParser.getInternalEntities().get(name);
      }
      if (ent == null) {
        ent = (CEntity)CXmlParser.dtTr.getEntities().getNamedItem(name);
View Full Code Here

          int lsize = list.size();
          int len = this.list == null ? lsize : (lsize > this.list.length ? lsize : this.list.length);
          this.list = (ANode[]) list.toArray(new ANode[len]);
          count--;
          if (owner != null && owner.getOwnerDocument() != null) {
            CDocType dt = (CDocType)owner.getOwnerDocument().getDoctype();
            if (dt != null) {
              org.allcolor.dtd.parser.CElement elem =
                (org.allcolor.dtd.parser.CElement)dt.getKnownElements().get(owner.getNodeName());
              if (elem != null) {
                Map attr = elem.getAttributes();
                if (attr != null) {
                  for (Iterator it = attr.entrySet().iterator();it.hasNext();) {
                    Map.Entry entry = (Map.Entry)it.next();
View Full Code Here

      list.remove(node);
      int lsize = list.size();
      int len = this.list == null ? lsize : (lsize > this.list.length ? lsize : this.list.length);
      this.list = (ANode[]) list.toArray(new ANode[len]);
      count--;
      CDocType dt = (CDocType)owner.getOwnerDocument().getDoctype();
      if (dt != null) {
        org.allcolor.dtd.parser.CElement elem =
          (org.allcolor.dtd.parser.CElement)dt.getKnownElements().get(owner.getNodeName());
        if (elem != null) {
          Map attr = elem.getAttributes();
          if (attr != null) {
            for (Iterator it = attr.entrySet().iterator();it.hasNext();) {
              Map.Entry entry = (Map.Entry)it.next();
View Full Code Here

TOP

Related Classes of org.allcolor.dtd.parser.CDocType

Copyright © 2018 www.massapicom. 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.