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


Java SAXException.toString方法代码示例

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


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

示例1: load

import org.xml.sax.SAXException; //导入方法依赖的package包/类
public static SyntaxScheme load(Font baseFont, InputStream in)
		throws IOException {
	SyntaxSchemeLoader parser = null;
	try {
		XMLReader reader = XMLReaderFactory.createXMLReader();
		parser = new SyntaxSchemeLoader(baseFont);
		parser.baseFont = baseFont;
		reader.setContentHandler(parser);
		InputSource is = new InputSource(in);
		is.setEncoding("UTF-8");
		reader.parse(is);
	} catch (SAXException se) {
		throw new IOException(se.toString());
	}
	return parser.scheme;
}
 
开发者ID:Thecarisma,项目名称:powertext,代码行数:17,代码来源:SyntaxScheme.java

示例2: parse

import org.xml.sax.SAXException; //导入方法依赖的package包/类
public void parse (InputSource input) throws SAXException, IOException
{
    XMLReader managedReader = null;

    try {
        if (getParent() == null) {
            try {
                managedReader = XMLReaderManager.getInstance(_useServicesMechanism)
                                                .getXMLReader();
                setParent(managedReader);
            } catch (SAXException  e) {
                throw new SAXException(e.toString());
            }
        }

        // call parse on the parent
        getParent().parse(input);
    } finally {
        if (managedReader != null) {
            XMLReaderManager.getInstance(_useServicesMechanism).releaseXMLReader(managedReader);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:TrAXFilter.java

示例3: flush

import org.xml.sax.SAXException; //导入方法依赖的package包/类
private void flush()
{
    try
    {
    if (m_firstTagNotEmitted)
    {
        emitFirstTag();
    }
    if (m_needToCallStartDocument)
    {
        m_handler.startDocument();
        m_needToCallStartDocument = false;
    }
    }
    catch(SAXException e)
    {
        throw new RuntimeException(e.toString());
    }


}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:ToUnknownStream.java

示例4: test

import org.xml.sax.SAXException; //导入方法依赖的package包/类
@Test(dataProvider = "illegalCharactersData")
public void test(int character) throws Exception {
    // Construct the XML document as a String
    int[] cps = new int[]{character};
    String txt = new String(cps, 0, cps.length);
    String inxml = "<topElement attTest=\'" + txt + "\'/>";
    String exceptionText = "NO EXCEPTION OBSERVED";
    String hexString = "0x" + Integer.toHexString(character);

    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    dbf.setNamespaceAware(true);
    dbf.setValidating(false);
    DocumentBuilder db = dbf.newDocumentBuilder();
    InputSource isrc = new InputSource(new StringReader(inxml));

    try {
        db.parse(isrc);
    } catch (SAXException e) {
        exceptionText = e.toString();
    }
    System.out.println("Got Exception:" + exceptionText);
    assertTrue(exceptionText.contains("attribute \"attTest\""));
    assertTrue(exceptionText.contains("element is \"topElement\""));
    assertTrue(exceptionText.contains("Unicode: " + hexString));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:26,代码来源:BadExceptionMessageTest.java

示例5: testException

import org.xml.sax.SAXException; //导入方法依赖的package包/类
@Test
public void testException() {
    try {
        parse();
    } catch (SAXException e) {
        // e.printStackTrace();
        String msg = e.toString();
        if (msg.indexOf("systemId") == -1) {
            Assert.fail("CR6889654 -- details should be returned.");
        }
        if (msg.indexOf(MSG) == -1) {
            Assert.fail("CR6889649 -- additional error message not returned.");
        }
        System.out.println("error message:\n" + msg);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:Bug6889654Test.java

示例6: getDocument

import org.xml.sax.SAXException; //导入方法依赖的package包/类
public HTMLPage.Scriptable getDocument() {
    try {
        if (!isHTML()) replaceText( BLANK_HTML, HTML_CONTENT );
        return getReceivedPage().getScriptableObject();
    } catch (SAXException e) {
        throw new RuntimeException( e.toString() );
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:WebResponse.java

示例7: loadFromXML

import org.xml.sax.SAXException; //导入方法依赖的package包/类
/**
 * Loads completions from an XML input stream.  The XML should validate
 * against <code>CompletionXml.dtd</code>.
 *
 * @param in The input stream to read from.
 * @param cl The class loader to use when loading any extra classes defined
 *        in the XML, such as custom {@link FunctionCompletion}s.  This
 *        may be <code>null</code> if the default is to be used, or if no
 *        custom completions are defined in the XML.
 * @throws IOException If an IO error occurs.
 */
public void loadFromXML(InputStream in, ClassLoader cl) throws IOException {

	//long start = System.currentTimeMillis();

	SAXParserFactory factory = SAXParserFactory.newInstance();
	factory.setValidating(true);
	CompletionXMLParser handler = new CompletionXMLParser(this, cl);
	BufferedInputStream bin = new BufferedInputStream(in);
	try {
		SAXParser saxParser = factory.newSAXParser();
		saxParser.parse(bin, handler);
		List<Completion> completions =  handler.getCompletions();
		addCompletions(completions);
		char startChar = handler.getParamStartChar();
		if (startChar!=0) {
			char endChar = handler.getParamEndChar();
			String sep = handler.getParamSeparator();
			if (endChar!=0 && sep!=null && sep.length()>0) { // Sanity
				setParameterizedCompletionParams(startChar, sep, endChar);
			}
		}
	} catch (SAXException se) {
		throw new IOException(se.toString());
	} catch (ParserConfigurationException pce) {
		throw new IOException(pce.toString());
	} finally {
		//long time = System.currentTimeMillis() - start;
		//System.out.println("XML loaded in: " + time + "ms");
		bin.close();
	}

}
 
开发者ID:Thecarisma,项目名称:powertext,代码行数:44,代码来源:DefaultCompletionProvider.java

示例8: flush

import org.xml.sax.SAXException; //导入方法依赖的package包/类
private void flush() {
    try {
        if (m_firstTagNotEmitted) {
            emitFirstTag();
        }
        if (m_needToCallStartDocument) {
            m_handler.startDocument();
            m_needToCallStartDocument = false;
        }
    } catch(SAXException e) {
        throw new RuntimeException(e.toString());
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:ToUnknownStream.java


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