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


Java StartTag.getEnd方法代码示例

本文整理汇总了Java中net.htmlparser.jericho.StartTag.getEnd方法的典型用法代码示例。如果您正苦于以下问题:Java StartTag.getEnd方法的具体用法?Java StartTag.getEnd怎么用?Java StartTag.getEnd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.htmlparser.jericho.StartTag的用法示例。


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

示例1: convert

import net.htmlparser.jericho.StartTag; //导入方法依赖的package包/类
public String convert() {
    Source source = new Source(code);
    source.fullSequentialParse();

    int from = 0;

    StringBuffer result = new StringBuffer();

    for (StartTag tag : source.getAllStartTags()) {
        if (tag.getName().startsWith("%")) {

            addLines(result, source, from, tag.getBegin());

            from = tag.getEnd();

            String script = tag.toString();
            if (script.length() > 4) {
                if (script.charAt(2) == '=') {
                    result.append("doc.print(");
                    result.append(script.substring(3, script.length() - 2));
                    result.append(");");
                } else {
                    result.append(script.substring(2, script.length() - 2));
                }
            }
        }
    }

    addLines(result, source, from, source.getEnd());

    return result.toString();
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:33,代码来源:JSSPToJsConverter.java

示例2: printHTMLPage

import net.htmlparser.jericho.StartTag; //导入方法依赖的package包/类
public void printHTMLPage(Source source)
        throws UnsupportedEncodingException, IOException {
    List<StartTag> list = source.getAllStartTags(HTMLElementName.STYLE);
    Iterator<StartTag> iterator = list.iterator();
    String text = "";
    while (iterator.hasNext()) {
        final StartTag tag = iterator.next();
        final Segment s = new Segment(source, tag.getEnd(), tag
                .getElement().getEndTag().getBegin());
        text += s.toString();
    }
    Vector<ReplaceRight> rights = Style.getStyles(text, styles, counter);

    // генерація сторінки з оновленими стилями.

    list = source.getAllStartTags();
    iterator = list.iterator();
    StartTag startTag = null;
    while (iterator.hasNext()) {
        final StartTag st = iterator.next();
        if (HTMLElementName.BODY.equals(st.getName())) {
            startTag = st;
            break;
        }
    }
    if (startTag == null)
        return;

    final StartTag body = startTag;
    final OutputDocument document = new OutputDocument(source);
    while (iterator.hasNext()) {
        startTag = iterator.next();
        replaceAttrs(startTag, document, rights);
    }

    OutputStreamWriter writer = new OutputStreamWriter(this.out, "UTF-8");
    document.writeTo(writer, body.getEnd(), body.getElement().getEndTag()
            .getBegin());
    writer.flush();
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:41,代码来源:Out.java

示例3: main

import net.htmlparser.jericho.StartTag; //导入方法依赖的package包/类
public static void main(final String[] args) {
    try {
        final FileInputStream is = new FileInputStream("d:/test.html");
        final FileOutputStream o = new FileOutputStream("d:/res1.txt");
        final Source source = new Source(is);
        final List<StartTag> list = source
                .getAllStartTags(HTMLElementName.STYLE);
        final Iterator<StartTag> iterator = list.iterator();
        String text = "";
        final PrintStream out = new PrintStream(o);
        while (iterator.hasNext()) {
            final StartTag tag = iterator.next();
            final Segment s = new Segment(source, tag.getEnd(), tag
                    .getElement().getEndTag().getBegin());
            text += s.toString();
            // out.println(text);
            // out.println("---------------");
        }
        is.close();
        final Vector<Style> styles = new Vector<Style>();
        getStyles(text, styles, createCounter());
        for (int i = 0; i < styles.size(); i++) {
            out.println(styles.get(i));
        }
        o.close();
    } catch (final IOException e) {
        e.printStackTrace();
    }
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:30,代码来源:Style.java

示例4: getMetaValue

import net.htmlparser.jericho.StartTag; //导入方法依赖的package包/类
private static String getMetaValue(Source source, String key) {
	for (int pos=0; pos<source.length();) {
		StartTag startTag=source.getNextStartTag(pos,"name",key,false);
		if (startTag==null) return null;
		if (startTag.getName()==HTMLElementName.META)
			return startTag.getAttributeValue("content"); // Attribute values are automatically decoded
		pos=startTag.getEnd();
	}
	return null;
}
 
开发者ID:EUMSSI,项目名称:EUMSSI-tools,代码行数:11,代码来源:ExtractGuardian.java


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