Package org.allcolor.xml.parser.dom

Examples of org.allcolor.xml.parser.dom.ADocument


    if ((hasFeature(PARSER_HTML, "")) ||
        ((doctype != null) && (doctype.getPublicId() != null) &&
        ((doctype.getPublicId().indexOf("XHTML") != -1) ||
        ((doctype.getPublicId().indexOf("HTML") != -1) &&
        (doctype.getPublicId().indexOf("//W3C//DTD ") != -1))))) {
      ADocument doc = null;
      if ((hasRequestedFeature("HTML", "1.0")) ||
         (hasRequestedFeature("HTML", null))) {
        doc = new CDom1HTMLDocument(true, null);
      } else {
        doc = new CDom2HTMLDocument(true, null);
      }
      doc.setImplementation(this);
      if (doctype != null) {
        doc.appendChild(doctype);
      }
      return doc;
    } // end if

    ADocument doc = null;
    if ((hasRequestedFeature("HTML", "1.0")) ||
       (hasRequestedFeature("HTML", null))) {
      doc = new CDom1HTMLDocument(true, null);
    } else {
      doc = new CDom2HTMLDocument();
    }
    doc.setImplementation(this);
    if (doctype != null) {
      doc.appendChild(doctype);
    }
    return doc;
  } // end createNewDocument()
View Full Code Here


        accept_language);
        }

        in = connection.getInputStream();

        ADocument doc = null;

        if (encoding != null) {
      doc = (ADocument)p.parse(new InputStreamReader(in, encoding));
        } // end if
        else {
      doc = (ADocument)p.parse(in);
        } // end else

        if (xpointer == null) {
          currentElement.appendChild(doc.getDocumentElement());
        } // end if
        else {
        // HANDLE XPOINTER (as XPATH with JAXEN)
          XPath xpath = new DOMXPath(xpointer);
          for (Iterator it = doc.getNamespaceList().iterator();it.hasNext();) {
            CNamespace ns = (CNamespace)it.next();
            xpath.addNamespace(ns.getPrefix() == null ? "" : ns.getPrefix(), ns.getNamespaceURI());
          }
          List result = xpath.selectNodes(doc.getDocumentElement());
          for (final Iterator it = result.iterator();it.hasNext();) {
            final Node node = (Node)it.next();
            currentElement.appendChild(node);
          }
        } // end else
View Full Code Here

    if ((doctype != null) && (doctype.getOwnerDocument() != null)) {
      throw new DOMException(DOMException.WRONG_DOCUMENT_ERR,
        "Doctype already used.");
    } // end if

    ADocument doc = createNewDocument(doctype);

    if (doctype != null) {
      ((ANode) doctype).setOwnerDocument(doc);
    }

    if (qualifiedName != null) {
      if (namespaceURI != null) {
        doc.appendChild(doc.createElementNS(namespaceURI,
            qualifiedName));
        doc.hasNS = true;
      } // end if
      else {
        doc.appendChild(doc.createElement(qualifiedName));
        doc.hasNS = true;
      } // end else
    } // end if

    doc.setDocumentType(doctype);
    doc.setBuildStageDone();
    return doc;
  } // end createDocument()
View Full Code Here

          ((ADocument) mydoc).setDocumentURI(urlForBase);
        }
        final NodeList nl = mydoc.getElementsByTagName("base");

        if (nl.getLength() == 0) {
          final ADocument doc = (ADocument) mydoc;
          final Element base = doc.createElement("base");
          base.setAttribute("href", urlForBase);

          if (head.getFirstChild() != null) {
            head.insertBefore(base, head.getFirstChild());
          } // end if
View Full Code Here

                accept_language);
          }

          in = connection.getInputStream();

          ADocument doc = null;

          if (encoding != null) {
            doc = (ADocument)p.parse(new InputStreamReader(in, encoding));
          } // end if
          else {
            doc = (ADocument)p.parse(in);
          } // end else

          if (xpointer == null) {
            CDOM2SAX converter = new CDOM2SAX(doc
                .getDocumentElement());
            converter
                .setProperty(
                    "http://xml.org/sax/properties/lexical-handler",
                    this.lHandler);
            converter.setContentHandler(this.cHandler);
            converter.setDocumentHandler(this.dHandler);
            converter.setDTDHandler(this.dtdHandler);
            converter.serialize();
          } // end if
          else {
            // HANDLE XPOINTER (as XPATH with JAXEN)
              XPath xpath = new DOMXPath(xpointer);
              for (Iterator it = doc.getNamespaceList().iterator();it.hasNext();) {
                CNamespace ns = (CNamespace)it.next();
                xpath.addNamespace(ns.getPrefix() == null ? "" : ns.getPrefix(), ns.getNamespaceURI());
              }
              List result = xpath.selectNodes(doc.getDocumentElement());
              for (final Iterator it = result.iterator();it.hasNext();) {
                final Node node = (Node)it.next();
              CDOM2SAX converter = new CDOM2SAX(node);
              converter
                  .setProperty(
View Full Code Here

TOP

Related Classes of org.allcolor.xml.parser.dom.ADocument

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.