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


Java ParserConfigurationException.getMessage方法代码示例

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


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

示例1: InstanceCreator

import javax.xml.parsers.ParserConfigurationException; //导入方法依赖的package包/类
public InstanceCreator(InputStream in) {
	try {
		this.relations = new HashMap<Relation,Set<List<String>>>();
		this.atoms = new LinkedHashSet<String>();

		DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
		DocumentBuilder builder = factory.newDocumentBuilder();
		this.document = builder.parse(in);
	} catch (SAXException sxe) {
		// Error generated during parsing
		Exception x = sxe;
		if (sxe.getException() != null)
			x = sxe.getException();
		throw new InstanceCreationException("Error generated during parsing: " + x.getMessage());

	} catch (ParserConfigurationException pce) {
		// Parser with specified options can't be built
		throw new InstanceCreationException("Parser with specified options cannot be built: " + pce.getMessage());

	} catch (IOException ioe) {
		// I/O error
		throw new InstanceCreationException("I/O error: " + ioe.getMessage());
	} finally {
		try {
			in.close();
		} catch (IOException e) {
			// ignore
		}
	}
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:31,代码来源:InstanceCreator.java

示例2: parse

import javax.xml.parsers.ParserConfigurationException; //导入方法依赖的package包/类
public void parse( InputSource source, ContentHandler handler,
    ErrorHandler errorHandler, EntityResolver entityResolver )

    throws SAXException, IOException {

    try {
        SAXParser saxParser = allowFileAccess(factory.newSAXParser(), false);
        XMLReader reader = new XMLReaderEx(saxParser.getXMLReader());

        reader.setContentHandler(handler);
        if(errorHandler!=null)
            reader.setErrorHandler(errorHandler);
        if(entityResolver!=null)
            reader.setEntityResolver(entityResolver);
        reader.parse(source);
    } catch( ParserConfigurationException e ) {
        // in practice this won't happen
        SAXParseException spe = new SAXParseException(e.getMessage(),null,e);
        errorHandler.fatalError(spe);
        throw spe;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:JAXPParser.java

示例3: XmlDoc

import javax.xml.parsers.ParserConfigurationException; //导入方法依赖的package包/类
/**
 * Create a new XML doc with root element. 
 *
 * @param rootName - the tagName of the root element
 */
public XmlDoc( String rootName )
{
	final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance( );
	DocumentBuilder db = null;
	
	try
	{
		db = dbf.newDocumentBuilder( );
	}
	catch ( ParserConfigurationException e )
	{
		logger.log(""+e);
		throw new TestCaseFailure(e.getMessage());
	}
	
	Doc = db.newDocument( );
	final Element root = Doc.createElement( rootName );
	Doc.appendChild( root );
}
 
开发者ID:danrusu,项目名称:mobileAutomation,代码行数:25,代码来源:XmlDoc.java

示例4: newXMLDocument

import javax.xml.parsers.ParserConfigurationException; //导入方法依赖的package包/类
/**
 * 初始化一个空Document对象返回。
 *
 * @return a Document
 */
public static Document newXMLDocument() {
	try {
		return newDocumentBuilder().newDocument();
	} catch (ParserConfigurationException e) {
		throw new RuntimeException(e.getMessage());
	}
}
 
开发者ID:DataAgg,项目名称:DAFramework,代码行数:13,代码来源:DomXmlUtils.java

示例5: createDocument

import javax.xml.parsers.ParserConfigurationException; //导入方法依赖的package包/类
/**
 * @return New XML document from the default document builder factory.
 */
private static Document createDocument()
{
	DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
	DocumentBuilder builder;
	try
	{
		builder = factory.newDocumentBuilder();
	}
	catch (ParserConfigurationException e)
	{
		throw new RuntimeException(e.getMessage(), e);
	}
	return builder.newDocument();
}
 
开发者ID:starn,项目名称:encdroidMC,代码行数:18,代码来源:SardineUtil.java

示例6: DSchemaBuilderImpl

import javax.xml.parsers.ParserConfigurationException; //导入方法依赖的package包/类
public DSchemaBuilderImpl() {
    try {
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        dbf.setNamespaceAware(true);
        this.dom = dbf.newDocumentBuilder().newDocument();
    } catch (ParserConfigurationException e) {
        // impossible
        throw new InternalError(e.getMessage());
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:DSchemaBuilderImpl.java

示例7: parse

import javax.xml.parsers.ParserConfigurationException; //导入方法依赖的package包/类
/**
 * Parses the given document and add it to the DOM forest.
 *
 * @return null if there was a parse error. otherwise non-null.
 */
private @NotNull Document parse(String systemId, InputSource inputSource, boolean root) throws SAXException, IOException{
    Document dom = documentBuilder.newDocument();

    systemId = normalizeSystemId(systemId);

    // put into the map before growing a tree, to
    // prevent recursive reference from causing infinite loop.
    core.put(systemId, dom);

    dom.setDocumentURI(systemId);
    if (root)
        rootDocuments.add(systemId);

    try {
        XMLReader reader = createReader(dom);

        InputStream is = null;
        if(inputSource.getByteStream() == null){
            inputSource = entityResolver.resolveEntity(null, systemId);
        }
        reader.parse(inputSource);
        Element doc = dom.getDocumentElement();
        if (doc == null) {
            return null;
        }
        NodeList schemas = doc.getElementsByTagNameNS(SchemaConstants.NS_XSD, "schema");
        for (int i = 0; i < schemas.getLength(); i++) {
            inlinedSchemaElements.add((Element) schemas.item(i));
        }
    } catch (ParserConfigurationException e) {
        errorReceiver.error(e);
        throw new SAXException(e.getMessage());
    }
    resolvedCache.put(systemId, dom.getDocumentURI());
    return dom;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:42,代码来源:DOMForest.java

示例8: createDocument

import javax.xml.parsers.ParserConfigurationException; //导入方法依赖的package包/类
/**
 * @return New XML document from the default document builder factory.
 */
private static Document createDocument() {
    DocumentBuilder builder;
    try {
        builder = factory.newDocumentBuilder();
    } catch (ParserConfigurationException e) {
        throw new RuntimeException(e.getMessage(), e);
    }
    return builder.newDocument();
}
 
开发者ID:thegrizzlylabs,项目名称:sardine-android,代码行数:13,代码来源:SardineUtil.java

示例9: processSheet

import javax.xml.parsers.ParserConfigurationException; //导入方法依赖的package包/类
/**
 * Parses and shows the content of one sheet using the specified styles and
 * shared-strings tables.
 *
 * @param styles
 * @param strings
 * @param sheetInputStream
 */
public void processSheet(StylesTable styles, ReadOnlySharedStringsTable strings, SheetContentsHandler sheetHandler,
                         InputStream sheetInputStream) throws IOException, ParserConfigurationException, SAXException {
    DataFormatter formatter = new DataFormatter();
    InputSource sheetSource = new InputSource(sheetInputStream);
    try {
        XMLReader sheetParser = SAXHelper.newXMLReader();
        ContentHandler handler = new XSSFSheetXMLHandler(styles, null, strings, sheetHandler, formatter, false);
        sheetParser.setContentHandler(handler);
        sheetParser.parse(sheetSource);
    } catch (ParserConfigurationException e) {
        throw new RuntimeException("SAX parser appears to be broken - " + e.getMessage());
    }
}
 
开发者ID:warlock-china,项目名称:azeroth,代码行数:22,代码来源:XLSX2CSV.java

示例10: objectToElement

import javax.xml.parsers.ParserConfigurationException; //导入方法依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
public static <T> Element objectToElement(Object objeto, Class<T> classe, String qName ) throws CteException {

	try {
		Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
		JAXB.marshal(new JAXBElement(new QName(qName), classe, objeto), new DOMResult(document));

		return document.getDocumentElement();

	} catch (ParserConfigurationException e) {
		throw new CteException("Erro Ao Converter Objeto em Elemento: "+e.getMessage());
	}
}
 
开发者ID:Samuel-Oliveira,项目名称:Java_CTe,代码行数:14,代码来源:ObjetoUtil.java


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