當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。