Package com.google.gwt.dom.client

Examples of com.google.gwt.dom.client.Document


     */
    public HTMLNodeWrapper wrap(Node node) {
        if (node == this.node) {
            return this;
        }
        Document doc = node.getOwnerDocument();
        if (doc == this.node) {
            return makeWrapper(node, this);
        } else {
            throw new IllegalArgumentException(
                "XMLDocumentWrapper#wrap: supplied node does not belong to the wrapped DOM document");
View Full Code Here


    public NodeInfo selectID(String id) {
      Node el;
      // IE does not support getElementById for XML documents
      // but it does support it for XHTML if its the host page
      Document doc = ((Document)node);

      if (!isHttpRequested) {
          el = (doc).getElementById(id);
          if (el == null) {
              return null;
View Full Code Here

    }
   
    public Node transformToDocument(JavaScriptObject sourceDoc) {
    localController.setTargetNode(XMLDOM.createDocument(localController.getBaseOutputURI()));
    localController.setApiCommand(APIcommand.TRANSFORM_TO_DOCUMENT);
      Document targetDoc = XMLDOM.createDocument(localController.getBaseOutputURI());
      return renderXML(sourceDoc, importedStylesheet, targetDoc);
    }
View Full Code Here

      Document targetDoc = XMLDOM.createDocument(localController.getBaseOutputURI());
      return renderXML(sourceDoc, importedStylesheet, targetDoc);
    }
   
    public Node transformToFragment(JavaScriptObject sourceDoc, Document ownerDocument) {
      Document owner = (ownerDocument == null)? XMLDOM.createDocument(localController.getBaseOutputURI()) : ownerDocument;
    Node targetDocumentFragment = HTMLDocumentWrapper.createDocumentFragment(owner);
    // Set the owner document for result document output fragments:
    localController.setTargetNode(owner);
    localController.setApiCommand(APIcommand.TRANSFORM_TO_FRAGMENT);
      return renderXML(sourceDoc, importedStylesheet, targetDocumentFragment);
View Full Code Here

              int nodeType = (Node.is(inSourceDoc))? ((Node)inSourceDoc).getNodeType() : 0;

              if (nodeType > 0 && nodeType != Node.DOCUMENT_NODE) {
                // add a document node wrapper
                Node sourceNode = (Node)inSourceDoc;
                Document sourceDoc = sourceNode.getOwnerDocument();
                  HTMLDocumentWrapper htmlDoc = new HTMLDocumentWrapper(sourceDoc, sourceDoc.getURL(), config, DocType.UNKNOWN);
                  fetchedSourceDoc = htmlDoc.wrap(sourceNode);
              } else {
                fetchedSourceDoc = SaxonceApi.getDocSynchronously(inSourceDoc, config);
              }
            }
View Full Code Here

   * @return a DocumentInfo object
   */
  public static DocumentInfo getDocSynchronously(JavaScriptObject obj,
      Configuration config) throws XPathException {
    String absSourceURI = getAsyncUri(obj);
    Document doc;
    try {
      if (absSourceURI != null) {
        try {
          String xml = XMLDOM.makeHTTPRequest(absSourceURI);
          doc = (Document) XMLDOM.parseXML(xml);
        } catch (Exception e) {
          throw new XPathException(
              "Synchronous HTTP GET failed for: " + absSourceURI);
        }
      } else {
        doc = (Document) obj;
      }
      // check there's a document element
      if (doc.getDocumentElement() == null) {
        throw new XPathException("no document element");
      }
    } catch (Exception e) {
      throw new XPathException("Error resolving document: "
          + e.getMessage());
View Full Code Here

    }
   
    public DocumentInfo getHostPage(){
      // attempt to initialise this only once - in the Configuration constructor led
      // to NamePool exception
        Document page = Document.get();
        return new HTMLDocumentWrapper(page, page.getURL(), this, DocType.UNKNOWN);
    }
View Full Code Here

        try {
            xml = XMLDOM.makeHTTPRequest(url);
        } catch (Exception err) {
            throw new XPathException("HTTPRequest error: " + err.getMessage());
        }
        Document jsDoc;
        try {
          jsDoc = (Document)XMLDOM.parseXML(xml);
          if (jsDoc.getDocumentElement() == null) {
            throw new XPathException("null returned for " + url);
          }
        } catch (Exception ec) {
          throw new XPathException("XML parser error: " + ec.getMessage());
        }
View Full Code Here

     * Creates a new resource loader. You should generally not create you own
     * resource loader, but instead use {@link ResourceLoader#get()} to get an
     * instance.
     */
    protected ResourceLoader() {
        Document document = Document.get();
        head = document.getElementsByTagName("head").getItem(0);

        // detect already loaded scripts and stylesheets
        NodeList<Element> scripts = document.getElementsByTagName("script");
        for (int i = 0; i < scripts.getLength(); i++) {
            ScriptElement element = ScriptElement.as(scripts.getItem(i));
            String src = element.getSrc();
            if (src != null && src.length() != 0) {
                loadedResources.add(src);
            }
        }

        NodeList<Element> links = document.getElementsByTagName("link");
        for (int i = 0; i < links.getLength(); i++) {
            LinkElement linkElement = LinkElement.as(links.getItem(i));
            String rel = linkElement.getRel();
            String href = linkElement.getHref();
            if ("stylesheet".equalsIgnoreCase(rel) && href != null
View Full Code Here

  }
  String src = asyncPath.replace("<token>", this.token).replace("<id>", this.id) + "response.js?r=" + (new Date()).getTime();
  if (link != null) {
    link.removeFromParent();
  }
    Document doc = Document.get();
    link = doc.createScriptElement();
    link.setSrc(src);
    link.setType("text/javascript");
    doc.getBody().appendChild(link);
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.dom.client.Document

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.