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


Java Method类代码示例

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


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

示例1: convertToXHTML

import org.apache.xml.serialize.Method; //导入依赖的package包/类
public static String convertToXHTML(String in) {
    SAXParser parser = new SAXParser();
    InputSource source;
    OutputFormat outputFormat = new OutputFormat();
    try {
        //parser.setProperty("http://cyberneko.org/html/properties/default-encoding", charset);
        parser.setProperty("http://cyberneko.org/html/properties/names/elems", "lower");
        outputFormat.setOmitDocumentType(true);
        outputFormat.setOmitXMLDeclaration(true);
        outputFormat.setMethod(Method.XHTML);
        outputFormat.setIndenting(true);
        StringReader sr = new StringReader(in);
        StringWriter sw = new StringWriter();
        source = new InputSource(sr);
        parser.setContentHandler(new XMLSerializer(sw, outputFormat));
        parser.parse(source);
        return sw.toString();
    } catch (Exception ex) {
        new ExceptionDialog(ex);
    }
    return null;
}
 
开发者ID:cst316,项目名称:spring16project-Team-Laredo,代码行数:23,代码来源:HTMLFileExport.java

示例2: convertToXHTML

import org.apache.xml.serialize.Method; //导入依赖的package包/类
public static String convertToXHTML(String in) {       
    SAXParser parser = new SAXParser();
    InputSource source;
    OutputFormat outputFormat = new OutputFormat();
    try {
        //parser.setProperty("http://cyberneko.org/html/properties/default-encoding", charset);
        parser.setProperty("http://cyberneko.org/html/properties/names/elems", "lower");
        outputFormat.setOmitDocumentType(true);
        outputFormat.setOmitXMLDeclaration(true);
        outputFormat.setMethod(Method.XHTML);
        outputFormat.setIndenting(true);            
        StringReader sr = new StringReader(in);
        StringWriter sw = new StringWriter();
        source = new InputSource(sr);
        parser.setContentHandler(new XMLSerializer(sw, outputFormat));
        parser.parse(source);
        return sw.toString();
    }
    catch (Exception ex) {
       new ExceptionDialog(ex);
    }
    return null;
}
 
开发者ID:cst316,项目名称:spring16project-Modula-2,代码行数:24,代码来源:HTMLFileExport.java

示例3: convertToXHTML

import org.apache.xml.serialize.Method; //导入依赖的package包/类
public static String convertToXHTML(String in) {
	SAXParser parser = new SAXParser();
	InputSource source;
	OutputFormat outputFormat = new OutputFormat();
	try {
		// parser.setProperty("http://cyberneko.org/html/properties/default-encoding",
		// charset);
		parser.setProperty("http://cyberneko.org/html/properties/names/elems", "lower");
		outputFormat.setOmitDocumentType(true);
		outputFormat.setOmitXMLDeclaration(true);
		outputFormat.setMethod(Method.XHTML);
		outputFormat.setIndenting(true);
		StringReader sr = new StringReader(in);
		StringWriter sw = new StringWriter();
		source = new InputSource(sr);
		parser.setContentHandler(new XMLSerializer(sw, outputFormat));
		parser.parse(source);
		return sw.toString();
	} catch (Exception ex) {
		new ExceptionDialog(ex);
	}
	return null;
}
 
开发者ID:cst316,项目名称:spring16project-Fortran,代码行数:24,代码来源:HTMLFileExport.java

示例4: nodeToString

import org.apache.xml.serialize.Method; //导入依赖的package包/类
protected String nodeToString(Node node) {
    StringWriter stringOut = new StringWriter();

    OutputFormat format = new OutputFormat(Method.XML, null, false);
    format.setOmitXMLDeclaration(true);

    NodeXMLSerializer serial = new NodeXMLSerializer(stringOut, format);

    try {
        serial.serializeNode(node);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }

    return stringOut.toString();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:17,代码来源:CustomSchemaParser.java


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