Package com.gargoylesoftware.htmlunit.javascript.host.xml

Examples of com.gargoylesoftware.htmlunit.javascript.host.xml.XMLDocument


     * Builds XMLDocument.
     * @param enclosingWindow the window
     * @return the document
     */
    public static XMLDocument buildXMLDocument(final WebWindow enclosingWindow) {
        final XMLDocument document = new XMLDocument(enclosingWindow);

        // the properties
        addProperty(document, "async", true, true);
        addProperty(document, "parseError", true, false);
        addProperty(document, "preserveWhiteSpace", true, true);
View Full Code Here


     * @return the newly created {@link XMLDocument}
     */
    //TODO: change doctype type to "DocType"
    public XMLDocument jsxFunction_createDocument(final String namespaceURI, final String qualifiedName,
            final Object doctype) {
        final XMLDocument document = new XMLDocument(getWindow().getWebWindow());
        document.setParentScope(getParentScope());
        document.setPrototype(getPrototype(document.getClass()));
        if (qualifiedName != null && qualifiedName.length() != 0) {
            final XmlPage page = document.getDomNodeOrDie();
            page.appendChild(page.createXmlElementNS(namespaceURI, qualifiedName));
        }
        return document;
    }
View Full Code Here

                result = new WindowProxy(webWindow);
            }
            else if (result instanceof HTMLUnknownElement && getBrowserVersion().isIE()) {
                final HtmlElement unknownElement = ((HTMLUnknownElement) result).getDomNodeOrDie();
                if (unknownElement.getNodeName().equals("xml")) {
                    final XMLDocument document = ActiveXObject.buildXMLDocument(getWebWindow());
                    document.setParentScope(this);
                    final Iterator<HtmlElement> children = unknownElement.getHtmlElementDescendants().iterator();
                    if (children.hasNext()) {
                        final HtmlElement root = children.next();
                        document.jsxFunction_loadXML(root.asXml().trim());
                    }
                    result = document;
                }
            }
        }
View Full Code Here

     * @param source the node to be transformed
     * @return the result of the transformation
     */
    public XMLDocument jsxFunction_transformToDocument(
            final Node source) {
        final XMLDocument doc = new XMLDocument();
        doc.setPrototype(getPrototype(doc.getClass()));
        doc.setParentScope(getParentScope());

        final Object transformResult = transform(source);
        final org.w3c.dom.Node node;
        if (transformResult instanceof org.w3c.dom.Node) {
            final org.w3c.dom.Node transformedDoc = (org.w3c.dom.Node) transformResult;
            node = transformedDoc.getFirstChild();
        }
        else {
            node = null;
        }
        final XmlPage page = new XmlPage(node, getWindow().getWebWindow());
        doc.setDomNode(page);
        return doc;
    }
View Full Code Here

     * @param contentType the content type of the string -
     *        either <tt>text/xml</tt>, <tt>application/xml</tt>, or <tt>application/xhtml+xml</tt>. Must not be NULL.
     * @return the generated document
     */
    public XMLDocument jsxFunction_parseFromString(final String str, final String contentType) {
        final XMLDocument document = new XMLDocument();
        document.setParentScope(getParentScope());
        document.setPrototype(getPrototype(XMLDocument.class));
        document.jsxFunction_loadXML(str);
        return document;
    }
View Full Code Here

TOP

Related Classes of com.gargoylesoftware.htmlunit.javascript.host.xml.XMLDocument

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.