当前位置: 首页>>代码示例>>Java>>正文


Java HTMLDocumentImpl类代码示例

本文整理汇总了Java中org.apache.html.dom.HTMLDocumentImpl的典型用法代码示例。如果您正苦于以下问题:Java HTMLDocumentImpl类的具体用法?Java HTMLDocumentImpl怎么用?Java HTMLDocumentImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


HTMLDocumentImpl类属于org.apache.html.dom包,在下文中一共展示了HTMLDocumentImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseDocument

import org.apache.html.dom.HTMLDocumentImpl; //导入依赖的package包/类
private HTMLDocumentImpl parseDocument(String htmlData) throws DiscoveryException
{
    OpenID4JavaDOMParser parser = new OpenID4JavaDOMParser();
    try
    {
        parser.parse(OpenID4JavaDOMParser.createInputSource(htmlData));
    }
    catch (Exception e)
    {
        throw new DiscoveryException("Error parsing HTML message",
        		OpenIDException.DISCOVERY_HTML_PARSE_ERROR, e);
    }

    if (parser.isIgnoredHeadStartElement())
    {
        throw new DiscoveryException(
                "HTML response must have exactly one HEAD element.",
                OpenIDException.DISCOVERY_HTML_PARSE_ERROR);
    }

    return (HTMLDocumentImpl) parser.getDocument();
}
 
开发者ID:jbufu,项目名称:openid4java,代码行数:23,代码来源:CyberNekoDOMHtmlParser.java

示例2: parseDocument

import org.apache.html.dom.HTMLDocumentImpl; //导入依赖的package包/类
private HTMLDocumentImpl parseDocument(String htmlData) throws YadisException
{
    OpenID4JavaDOMParser parser = new OpenID4JavaDOMParser();
    try
    {
        parser.parse(OpenID4JavaDOMParser.createInputSource(htmlData));
    }
    catch (Exception e)
    {
        throw new YadisException("Error parsing HTML message",
                OpenIDException.YADIS_HTMLMETA_INVALID_RESPONSE, e);
    }

    if (parser.isIgnoredHeadStartElement())
    {
            throw new YadisException("HTML response must have exactly one HEAD element.",
                            OpenIDException.YADIS_HTMLMETA_INVALID_RESPONSE);
    }

    return (HTMLDocumentImpl) parser.getDocument();
}
 
开发者ID:jbufu,项目名称:openid4java,代码行数:22,代码来源:CyberNekoDOMYadisHtmlParser.java

示例3: parseHTML

import org.apache.html.dom.HTMLDocumentImpl; //导入依赖的package包/类
/**
 * 从指定流解析HTML
 * 
 * @param in
 *            输入流
 * @param charSet
 *            字符集,为null时自动检测
 * @return 解析后的DocumentFragment对象
 * @throws SAXException
 *             XML语法异常时抛出
 * @throws IOException
 *             IO操作错误时抛出
 */
public static DocumentFragment parseHTML(InputStream in, String charSet) throws SAXException, IOException {
	if (parser == null)
		throw new UnsupportedOperationException(
				"HTML parser module not loaded, to activate this feature, you must add JEF common-ioc.jar to classpath");
	InputSource source;
	if (charSet != null) {
		source = new InputSource(new XmlFixedReader(new InputStreamReader(in, charSet)));
		source.setEncoding(charSet);
	} else {
		source = new InputSource(in);
	}
	synchronized (parser) {
		HTMLDocument document = new HTMLDocumentImpl();
		DocumentFragment fragment = document.createDocumentFragment();
		parser.parse(source, fragment);
		return fragment;
	}
}
 
开发者ID:GeeQuery,项目名称:ef-orm,代码行数:32,代码来源:XMLUtils.java

示例4: Html5ScriptElementImpl

import org.apache.html.dom.HTMLDocumentImpl; //导入依赖的package包/类
/**
 * Constructs new script element.
 * 
 * @param owner Document which owns this element.
 * @param name Name of the element.
 */
public Html5ScriptElementImpl(HTMLDocumentImpl document, String name) {
	super(document, name);
	
	_fetchRegistry = FetchRegistry.getInstance();
	
	_browserScriptEngineManager = BrowserScriptEngineManager.getInstance();
	_alreadyStarted = false;
	_parserInserted = false;
	_wasParserInserted = false;
	_forceAsync = true;
	_readyToBeParserExecuted = false;
	
	_creatorDocument = (document instanceof Html5DocumentImpl)? (Html5DocumentImpl)document : null;
	_creatorParser = (document instanceof Html5DocumentImpl)? ((Html5DocumentImpl)document).getParser() : null;
	_parserInserted = _creatorParser.isParserTask(); //
}
 
开发者ID:ITman1,项目名称:ScriptBox,代码行数:23,代码来源:Html5ScriptElementImpl.java

示例5: parseHtml

import org.apache.html.dom.HTMLDocumentImpl; //导入依赖的package包/类
public void parseHtml(String htmlData, HtmlResult result)
        throws DiscoveryException
{
    if (DEBUG)
        _log.debug("Parsing HTML data:\n" + htmlData);

    HTMLDocumentImpl doc = this.parseDocument(htmlData);

    NodeList heads = doc.getElementsByTagName("head");
    if (heads.getLength() != 1)
        throw new DiscoveryException(
                "HTML response must have exactly one HEAD element, "
                        + "found " + heads.getLength() + " : "
                        + heads.toString(),
                OpenIDException.DISCOVERY_HTML_PARSE_ERROR);

    HTMLHeadElement head = (HTMLHeadElement) doc.getHead();
    NodeList linkElements = head.getElementsByTagName("LINK");
    for (int i = 0, len = linkElements.getLength(); i < len; i++)
    {
        HTMLLinkElement linkElement = (HTMLLinkElement) linkElements.item(i);
        setResult(linkElement.getRel(), linkElement.getHref(), result);
    }

    if (DEBUG)
        _log.debug("HTML discovery result:\n" + result);
}
 
开发者ID:jbufu,项目名称:openid4java,代码行数:28,代码来源:CyberNekoDOMHtmlParser.java

示例6: parseTagSoup

import org.apache.html.dom.HTMLDocumentImpl; //导入依赖的package包/类
private DocumentFragment parseTagSoup(InputSource input) throws Exception {
	HTMLDocumentImpl doc = new HTMLDocumentImpl();
	DocumentFragment frag = doc.createDocumentFragment();
	DOMBuilder builder = new DOMBuilder(doc, frag);
	org.ccil.cowan.tagsoup.Parser reader = new org.ccil.cowan.tagsoup.Parser();
	reader.setContentHandler(builder);
	reader.setFeature(org.ccil.cowan.tagsoup.Parser.ignoreBogonsFeature, true);
	reader.setFeature(org.ccil.cowan.tagsoup.Parser.bogonsEmptyFeature, false);
	reader.setProperty("http://xml.org/sax/properties/lexical-handler", builder);
	reader.parse(input);
	return frag;
}
 
开发者ID:yahoo,项目名称:anthelion,代码行数:13,代码来源:WdcParser.java

示例7: jsoup2HTML

import org.apache.html.dom.HTMLDocumentImpl; //导入依赖的package包/类
public static DocumentFragment jsoup2HTML(org.jsoup.nodes.Document jsoupDocument) {
    HTMLDocumentImpl htmlDoc = new HTMLDocumentImpl();
    htmlDoc.setErrorChecking(false);
    DocumentFragment fragment = htmlDoc.createDocumentFragment();
    createDOM(jsoupDocument, fragment, htmlDoc, new HashMap<String, String>());
    return fragment;
}
 
开发者ID:zaizi,项目名称:alfresco-apache-storm-demo,代码行数:8,代码来源:JSoupDOMBuilder.java

示例8: parse

import org.apache.html.dom.HTMLDocumentImpl; //导入依赖的package包/类
public static Node parse(String content) throws SAXException, IOException {
  DOMFragmentParser parser = new DOMFragmentParser();
  HTMLDocument document = new HTMLDocumentImpl();
  DocumentFragment fragment = document.createDocumentFragment();

  InputSource is = new InputSource(new StringReader(content));
  parser.parse(is, fragment);
  return fragment;
}
 
开发者ID:bsspirit,项目名称:kettle-4.4.0-stable,代码行数:10,代码来源:CarteTest.java

示例9: jsoup2HTML

import org.apache.html.dom.HTMLDocumentImpl; //导入依赖的package包/类
public static DocumentFragment jsoup2HTML(
        org.jsoup.nodes.Document jsoupDocument) {
    HTMLDocumentImpl htmlDoc = new HTMLDocumentImpl();
    htmlDoc.setErrorChecking(false);
    DocumentFragment fragment = htmlDoc.createDocumentFragment();
    createDOM(jsoupDocument, fragment, htmlDoc,
            new HashMap<String, String>());
    return fragment;
}
 
开发者ID:DigitalPebble,项目名称:storm-crawler,代码行数:10,代码来源:JSoupDOMBuilder.java

示例10: parse

import org.apache.html.dom.HTMLDocumentImpl; //导入依赖的package包/类
public static Node parse( String content ) throws SAXException, IOException {
  DOMFragmentParser parser = new DOMFragmentParser();
  HTMLDocument document = new HTMLDocumentImpl();
  DocumentFragment fragment = document.createDocumentFragment();

  InputSource is = new InputSource( new StringReader( content ) );
  parser.parse( is, fragment );
  return fragment;
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:10,代码来源:CarteIT.java

示例11: getHtmlMeta

import org.apache.html.dom.HTMLDocumentImpl; //导入依赖的package包/类
public String getHtmlMeta(String input) throws YadisException
{
    String xrdsLocation = null;

    HTMLDocumentImpl doc = this.parseDocument(input);
    if (DEBUG)
    {
        try
        {
            _log.debug("document:\n" + OpenID4JavaDOMParser.toXmlString(doc));
        } catch (TransformerException e)
        {
            _log.debug("An exception occurs while transforming the document to string in debugging.", e);
        }
    }

    NodeList heads = doc.getElementsByTagName("head");
    if (heads.getLength() != 1)
        throw new YadisException(
                "HTML response must have exactly one HEAD element, "
                        + "found " + heads.getLength() + " : "
                        + heads.toString(),
                OpenIDException.YADIS_HTMLMETA_INVALID_RESPONSE);

    HTMLHeadElement head = (HTMLHeadElement) doc.getHead();
    NodeList metaElements = head.getElementsByTagName("META");
    if (metaElements == null || metaElements.getLength() == 0)
    {
        if (DEBUG)
            _log.debug("No <meta> element found under <html><head>. " +
            "See Yadis specification, section 6.2.5/1.");
    }
    else
    {
        for (int i = 0, len = metaElements.getLength(); i < len; i++)
        {
            HTMLMetaElement metaElement = (HTMLMetaElement) metaElements.item(i);

            String httpEquiv = metaElement.getHttpEquiv();
            if (YadisResolver.YADIS_XRDS_LOCATION.equalsIgnoreCase(httpEquiv))
            {
                if (xrdsLocation != null)
                    throw new YadisException(
                        "More than one "
                            + YadisResolver.YADIS_XRDS_LOCATION
                            + "META tags found in HEAD: "
                            + head.toString(),
                        OpenIDException.YADIS_HTMLMETA_INVALID_RESPONSE);

                xrdsLocation = metaElement.getContent();
                if (DEBUG)
                    _log.debug("Found " + YadisResolver.YADIS_XRDS_LOCATION
                        + " META tags.");
            }
        }
    }
    return xrdsLocation;
}
 
开发者ID:jbufu,项目名称:openid4java,代码行数:59,代码来源:CyberNekoDOMYadisHtmlParser.java

示例12: newDocument

import org.apache.html.dom.HTMLDocumentImpl; //导入依赖的package包/类
/**
 * @inheritDoc
 */
public SimpleHtmlDocument newDocument() {
    return new SimpleHtmlDocument(new HTMLDocumentImpl());
}
 
开发者ID:3dcitydb,项目名称:swingx-ws,代码行数:7,代码来源:SimpleHtmlDocumentBuilder.java

示例13: Html5IFrameElementImpl

import org.apache.html.dom.HTMLDocumentImpl; //导入依赖的package包/类
/**
 * Constructs new iframe element.
 * 
 * @param owner Document which owns this element.
 * @param name Name of the element.
 */
public Html5IFrameElementImpl(HTMLDocumentImpl owner, String name) {
	super(owner, name);
}
 
开发者ID:ITman1,项目名称:ScriptBox,代码行数:10,代码来源:Html5IFrameElementImpl.java

示例14: Html5ElementImpl

import org.apache.html.dom.HTMLDocumentImpl; //导入依赖的package包/类
/**
 * Constructs new element.
 * 
 * @param owner Document which owns this element.
 * @param name Name of the element.
 */
public Html5ElementImpl(HTMLDocumentImpl owner, String tagName) {
	super(owner, tagName);
}
 
开发者ID:ITman1,项目名称:ScriptBox,代码行数:10,代码来源:Html5ElementImpl.java

示例15: newPlainDocument

import org.apache.html.dom.HTMLDocumentImpl; //导入依赖的package包/类
/**
 * @return an unenclosed Document. This is used only by the SimpleDocument
 * no arg constructor
 */
HTMLDocument newPlainDocument() {
    return new HTMLDocumentImpl();
}
 
开发者ID:3dcitydb,项目名称:swingx-ws,代码行数:8,代码来源:SimpleHtmlDocumentBuilder.java


注:本文中的org.apache.html.dom.HTMLDocumentImpl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。