Examples of CEntity


Examples of org.allcolor.dtd.parser.CEntity

      return newText;
    } // end else if
    else if (node.getNodeType() == Node.ENTITY_NODE) {
      Entity oldText = (Entity) node;
      String text = getChildAsText(oldText);
      Entity newText = new CEntity("!ENTITY " + oldText.getNodeName()
          + " \"" + text + "\"", oldText.getNodeName(), oldText
          .getNotationName(), text, oldText.getPublicId(), oldText
          .getSystemId(), false, document);
      return newText;
    } // end else if
    else if (node.getNodeType() == Node.NOTATION_NODE) {
      Notation oldText = (Notation) node;
      if (oldText.getPublicId() != null) {
        Notation newText = new CNotation("!NOTATION "
            + oldText.getNodeName() + " PUBLIC \""
            + oldText.getPublicId() + "\" \""
            + oldText.getSystemId() + "\"", oldText.getNodeName(),
            oldText.getPublicId(), oldText.getSystemId(), document);
        return newText;
      } else {
        Notation newText = new CNotation("!NOTATION "
            + oldText.getNodeName() + " SYSTEM \""
            + oldText.getSystemId() + "\"", oldText.getNodeName(),
            oldText.getPublicId(), oldText.getSystemId(), document);
        return newText;
      }
    } // end else if
    else if (node.getNodeType() == Node.COMMENT_NODE) {
      Comment oldComment = (Comment) node;
      Comment newComment = new CComment(oldComment.getNodeValue(),
          document);
      newNode = newComment;
    } // end else if
    else if (node.getNodeType() == Node.CDATA_SECTION_NODE) {
      CDATASection newCData = new CCDATASection(node.getNodeValue(),
          document);
      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();
View Full Code Here

Examples of org.allcolor.dtd.parser.CEntity

      } // end if

      if (this.dtdHandler != null) {
        for (Iterator it = entities.entrySet().iterator(); it.hasNext();) {
          Map.Entry entry = (Map.Entry) it.next();
          CEntity ent = (CEntity) entry.getValue();
          this.dtdHandler
              .notationDecl(ent.getEntityName(), ((ent
                  .getPublicId() == null) && (ent
                  .getSystemId() == null)) ? ent.getValue()
                  : ent.getPublicId(), ent.getSystemId());
        } // end for
      } // end if
      else {
        if ((this.cHandler != null)
            && (this.cHandler instanceof DefaultHandler2)) {
          for (Iterator it = entities.entrySet().iterator(); it
              .hasNext();) {
            Map.Entry entry = (Map.Entry) it.next();
            CEntity ent = (CEntity) entry.getValue();
            ((DefaultHandler2) this.cHandler).notationDecl(ent
                .getEntityName(),
                ((ent.getPublicId() == null) && (ent
                    .getSystemId() == null)) ? ent
                    .getValue() : ent.getPublicId(), ent
                    .getSystemId());
          } // end for
        } // end if
      } // end else
View Full Code Here

Examples of org.allcolor.dtd.parser.CEntity

    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);
      }
      if (ent != null) {
        Document val = ent.getDOMValue();
        if (val != null) {
          NodeList child = val.getChildNodes();
          for (int i=0;i<child.getLength();i++) {
            appendChild(ownerDocument.importNode(child.item(i),true));
          }
        } else {
          CShaniDomParser parser = new CShaniDomParser();
          Document docValue = null;
          if (ent.getValue().equals("&"+ent.getNodeName()+";")) {
            representation     = "&" + name + ";";
            return;
          } else
          if ( ent.getValue().startsWith("http://") ||
               ent.getValue().startsWith("https://") ||
               ent.getValue().startsWith("ftp://")) {
            docValue = parser.parse(ent.getValue());
          } else {
            docValue = parser.parse(new StringReader(
                 ent.getValue()));
          }
          NodeList nl = docValue.getChildNodes();
          for (int i=0;i<nl.getLength();i++) {
            appendChild(ownerDocument.importNode(nl.item(i),true));
          }
View Full Code Here

Examples of org.caffinitas.mapper.annotations.CEntity

            c = c.getSuperclass();
            if (c == Object.class) {
                break;
            }

            CEntity superEntity = c.getAnnotation(CEntity.class);
            if (superEntity != null) {
                ParseEntity parseEntitySuper = addEntityInternal(c);
                parseEntity.mapSuperEntity(parseEntitySuper);
                break;
            }
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.