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


Java FactoryConfigurationError类代码示例

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


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

示例1: export

import javax.xml.stream.FactoryConfigurationError; //导入依赖的package包/类
/**
 * Exports a single sheet to a file
 *
 * @param sheet
 * @throws FactoryConfigurationError
 * @throws XMLStreamException
 * @throws UnsupportedEncodingException
 * @throws FileNotFoundException
 */
private void export(final XSSFSheet sheet, final XMLStreamWriter out)
		throws UnsupportedEncodingException, XMLStreamException, FactoryConfigurationError, FileNotFoundException {
	boolean isFirst = true;
	final Map<String, String> columns = new HashMap<String, String>();
	final String sheetName = sheet.getSheetName();
	System.out.print(sheetName);
	out.writeStartElement("sheet");
	out.writeAttribute("name", sheetName);
	Iterator<Row> rowIterator = sheet.rowIterator();
	while (rowIterator.hasNext()) {
		Row row = rowIterator.next();
		if (isFirst) {
			isFirst = false;
			this.writeFirstRow(row, out, columns);
		} else {
			this.writeRow(row, out, columns);
		}
	}
	out.writeEndElement();
	System.out.println("..");
}
 
开发者ID:Stwissel,项目名称:Excel2XML,代码行数:31,代码来源:E2xCmdline.java

示例2: parse

import javax.xml.stream.FactoryConfigurationError; //导入依赖的package包/类
/**
 * Parses an inputstream containin xlsx into an outputStream containing XML
 * 
 * @param inputStream
 *            the source
 * @param outputStream
 *            the result
 * @throws IOException
 * @throws XMLStreamException
 */
public void parse(final InputStream inputStream, final OutputStream outputStream)
		throws IOException, XMLStreamException {
	XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
	XMLStreamWriter out = this.getXMLWriter(outputStream);
	out.writeStartDocument();
	out.writeStartElement("workbook");
	int sheetCount = workbook.getNumberOfSheets();
	for (int i = 0; i < sheetCount; i++) {
		final XSSFSheet sheet = workbook.getSheetAt(i);
		try {
			this.export(sheet, out);
		} catch (UnsupportedEncodingException | FileNotFoundException | XMLStreamException
				| FactoryConfigurationError e) {
			e.printStackTrace();
		}
	}
	out.writeEndElement();
	out.writeEndDocument();
	out.close();
	workbook.close();
}
 
开发者ID:Stwissel,项目名称:Excel2XML,代码行数:32,代码来源:E2xCmdline.java

示例3: FromXMLStreamIterator

import javax.xml.stream.FactoryConfigurationError; //导入依赖的package包/类
public FromXMLStreamIterator() throws XMLStreamException {
	XMLInputFactory fac = XMLInputFactory.newInstance();
	try { 
		this.xr = fac.createXMLStreamReader(Files.newInputStream(MzMLStAXParser.this.xml, StandardOpenOption.READ));
	} catch (FactoryConfigurationError | IOException e) {
		LOGGER.log(Level.ERROR, e.getMessage());
		System.exit(-1);
	}
	if (!this.moveToNextSpectrum()){
		LOGGER.log(Level.WARN,  "no spectrum found in mzml file");
	}
}
 
开发者ID:digitalproteomics,项目名称:dp-mzml,代码行数:13,代码来源:MzMLStAXParser.java

示例4: openPullParser

import javax.xml.stream.FactoryConfigurationError; //导入依赖的package包/类
/**
 * @param inputStream The inputstream to read from
 * @return A new pull parser
 */
private static XMLStreamReader openPullParser(InputStream inputStream) {
  try {
    BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, Charsets.UTF_8));
    Reader reader;
    int version = Version2to4TransformingReader.readVersion(bufferedReader);

    if (version == 2 || version == 3) {
      reader = new Version2to4TransformingReader(bufferedReader, version);
    } else {
      reader = bufferedReader;
    }

    if (version > 4) {
      throw new IllegalStateException("Unknown XML dataset format: "+version +"  This dataset has been produced by a later version of Morf");
    }
    return XMLInputFactory.newFactory().createXMLStreamReader(reader);
  } catch (XMLStreamException|FactoryConfigurationError e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:alfasoftware,项目名称:morf,代码行数:25,代码来源:XmlDataSetProducer.java

示例5: read

import javax.xml.stream.FactoryConfigurationError; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public T read(HttpResponseMessage httpResponseMessage, Type expectedType) {
	Class<T> expectedClassType = (Class<T>) expectedType;

	JAXBContext context = contextOf(expectedClassType);

	try {
		Unmarshaller unmarshaller = context.createUnmarshaller();

		StreamSource source = new StreamSource(httpResponseMessage.body());

		XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(source);

		return expectedClassType.isAnnotationPresent(XmlRootElement.class) ? (T) unmarshaller.unmarshal(reader)
				: unmarshaller.unmarshal(reader, expectedClassType).getValue();

	} catch (JAXBException | XMLStreamException | FactoryConfigurationError e) {
		throw new RestifyHttpMessageReadException("Error on try read xml message", e);
	}
}
 
开发者ID:ljtfreitas,项目名称:java-restify,代码行数:22,代码来源:JaxbXmlMessageConverter.java

示例6: getDataForFile

import javax.xml.stream.FactoryConfigurationError; //导入依赖的package包/类
protected DataSet getDataForFile(File f, final ProgressMonitor progressMonitor) throws FileNotFoundException, IOException, XMLStreamException, FactoryConfigurationError, JAXBException {
    Main.debug("[DownloadIlocateTask.ZippedShpReader.getDataForFile] Calling MY getDataForFile");
    if (f == null) {
        return null;
    } else if (!f.exists()) {
        Main.warn("File does not exist: " + f.getPath());
        return null;
    } else {
        Main.info("Parsing zipped shapefile " + f.getName());
        FileInputStream in = new FileInputStream(f);
        ProgressMonitor instance = null;
        if (progressMonitor != null) {
            instance = progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false);
        }
        return ShpReader.parseDataSet(in, f, null, instance);
    }
}
 
开发者ID:STEMLab,项目名称:JOSM-IndoorEditor,代码行数:18,代码来源:DownloadIlocateTask.java

示例7: findDocIdFromXml

import javax.xml.stream.FactoryConfigurationError; //导入依赖的package包/类
private String findDocIdFromXml(String xml) {
    try {
        XMLEventReader eventReader = XMLInputFactory.newInstance().createXMLEventReader(new StringReader(xml));
        while (eventReader.hasNext()) {
            XMLEvent event = eventReader.nextEvent();
            if (event.getEventType() == XMLEvent.START_ELEMENT) {
                StartElement element = event.asStartElement();
                String elementName = element.getName().getLocalPart();
                if (VespaDocumentOperation.Operation.valid(elementName)) {
                    return element.getAttributeByName(QName.valueOf("documentid")).getValue();
                }
            }
        }
    } catch (XMLStreamException | FactoryConfigurationError e) {
        // as json dude does
        return null;
    }
    return null;
}
 
开发者ID:vespa-engine,项目名称:vespa,代码行数:20,代码来源:VespaRecordWriter.java

示例8: setUpXMLParser

import javax.xml.stream.FactoryConfigurationError; //导入依赖的package包/类
private void setUpXMLParser(ReadableByteChannel channel, byte[] lookAhead) throws IOException {
  try {
    // We use Woodstox because the StAX implementation provided by OpenJDK reports
    // character locations incorrectly. Note that Woodstox still currently reports *byte*
    // locations incorrectly when parsing documents that contain multi-byte characters.
    XMLInputFactory2 xmlInputFactory = (XMLInputFactory2) XMLInputFactory.newInstance();
    this.parser = xmlInputFactory.createXMLStreamReader(
        new SequenceInputStream(
            new ByteArrayInputStream(lookAhead), Channels.newInputStream(channel)),
        getCurrentSource().configuration.getCharset());

    // Current offset should be the offset before reading the record element.
    while (true) {
      int event = parser.next();
      if (event == XMLStreamConstants.START_ELEMENT) {
        String localName = parser.getLocalName();
        if (localName.equals(getCurrentSource().configuration.getRecordElement())) {
          break;
        }
      }
    }
  } catch (FactoryConfigurationError | XMLStreamException e) {
    throw new IOException(e);
  }
}
 
开发者ID:apache,项目名称:beam,代码行数:26,代码来源:XmlSource.java

示例9: _generate

import javax.xml.stream.FactoryConfigurationError; //导入依赖的package包/类
private String _generate() throws IOException, XMLStreamException, FactoryConfigurationError {
    final ByteArrayOutputStream fos = new ByteArrayOutputStream();
    writer = createWriter(fos);
    writeHead();
    writeOutput();
    writeJdk();
    writeContent();
    writeOrderEntrySourceFolder();
    final Set<Path> allPaths = new HashSet<>();
    final Set<Path> allModules = new HashSet<>();
    if (this.dependencyResolver != null) {
        writeDependencies(dependencies, this.dependencyResolver, allPaths, allModules, false);
    }
    if (this.buildDependencyResolver != null) {
        writeDependencies(this.buildDependencies, this.buildDependencyResolver, allPaths, allModules, true);
    }
    writeBuildProjectDependencies(allModules);

    writeFoot();
    writer.close();
    return fos.toString(ENCODING);
}
 
开发者ID:jerkar,项目名称:jerkar,代码行数:23,代码来源:JkImlGenerator.java

示例10: main

import javax.xml.stream.FactoryConfigurationError; //导入依赖的package包/类
public static void main(String[] args)
    throws FactoryConfigurationError, JAXBException, XMLStreamException, IOException {
    List<String> xmlReports = new ArrayList<String>();
    String[] extensions = {"xml"};
    String xmlPath = System.getProperty("xmlPath");
    String outputPath = System.getProperty("reportsOutputPath");
    if (xmlPath == null || outputPath == null) {
        throw new Error("xmlPath or reportsOutputPath variables have not been set");
    }
    Object[] files = FileUtils.listFiles(new File(xmlPath), extensions, false).toArray();
    System.out.println("Found " + files.length + " xml files");
    for (Object absFilePath : files) {
        System.out.println("Found an xml: " + absFilePath);
        xmlReports.add(((File) absFilePath).getAbsolutePath());
    }

    TestNgReportBuilder repo = new TestNgReportBuilder(xmlReports, outputPath);
    repo.writeReportsOnDisk();
}
 
开发者ID:web-innovate,项目名称:bootstraped-multi-test-results-report,代码行数:20,代码来源:TestNgReportBuilderCli.java

示例11: TestNgReportBuilder

import javax.xml.stream.FactoryConfigurationError; //导入依赖的package包/类
public TestNgReportBuilder(List<String> xmlReports, String targetBuildPath)
    throws JAXBException, XMLStreamException, FactoryConfigurationError, IOException {
    testOverviewPath = targetBuildPath + "/";
    classesSummaryPath = targetBuildPath + "/classes-summary/";
    processedTestNgReports = new ArrayList<>();

    JAXBContext cntx = JAXBContext.newInstance(TestngResultsModel.class);

    Unmarshaller unm = cntx.createUnmarshaller();

    for (String xml : xmlReports) {
        InputStream inputStream = new FileInputStream(xml);
        XMLStreamReader xmlStream = XMLInputFactory.newInstance().createXMLStreamReader(inputStream);
        TestngResultsModel ts = (TestngResultsModel) unm.unmarshal(xmlStream);
        ts.postProcess();
        processedTestNgReports.add(ts);
        inputStream.close();
        xmlStream.close();
    }
}
 
开发者ID:web-innovate,项目名称:bootstraped-multi-test-results-report,代码行数:21,代码来源:TestNgReportBuilder.java

示例12: createXMLInputFactory

import javax.xml.stream.FactoryConfigurationError; //导入依赖的package包/类
private static XMLInputFactory createXMLInputFactory()
		throws FactoryConfigurationError {
	XMLInputFactory factory = XMLInputFactory.newInstance();
	if (!SUPPORT_DTD) {
		factory.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE);
		//these next ones are somewhat redundant, we set them just in case the DTD support property is not respected
		factory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.FALSE);
		factory.setXMLResolver(new XMLResolver() {
			
			@Override
			public Object resolveEntity(String arg0, String arg1, String arg2,
					String arg3) throws XMLStreamException {
				throw new XMLStreamException("Reading external entities is disabled"); //$NON-NLS-1$
			}
		});
	}
	return factory;
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:19,代码来源:XMLType.java

示例13: getOrCreateOutputFactory

import javax.xml.stream.FactoryConfigurationError; //导入依赖的package包/类
private static XMLOutputFactory getOrCreateOutputFactory() throws FactoryConfigurationError {
	if (ourOutputFactory == null) {
		XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();

		if (!ourHaveLoggedStaxImplementation) {
			logStaxImplementation(outputFactory.getClass());
		}

		/*
		 * Note that these properties are Woodstox specific and they cause a crash in environments where SJSXP is
		 * being used (e.g. glassfish) so we don't set them there.
		 */
		try {
			Class.forName("com.ctc.wstx.stax.WstxOutputFactory");
			if (outputFactory instanceof WstxOutputFactory) {
				outputFactory.setProperty(XMLOutputFactory2.P_TEXT_ESCAPER, new MyEscaper());
			}
		} catch (ClassNotFoundException e) {
			ourLog.debug("WstxOutputFactory (Woodstox) not found on classpath");
		}
		ourOutputFactory = outputFactory;
	}
	return ourOutputFactory;
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:25,代码来源:XmlUtil.java

示例14: serializeEmployeeWithNullSyndicationTitleProperty

import javax.xml.stream.FactoryConfigurationError; //导入依赖的package包/类
/**
 * Test serialization of empty syndication title property. EmployeeName is set to NULL after the update (which is
 * allowed because EmployeeName has default Nullable behavior which is true).
 * Write of an empty atom title tag is allowed within RFC4287 (http://tools.ietf.org/html/rfc4287#section-4.2.14).
 */
@Test
public void serializeEmployeeWithNullSyndicationTitleProperty() throws IOException, XpathException, SAXException,
    XMLStreamException, FactoryConfigurationError, ODataException {
  AtomEntityProvider ser = createAtomEntityProvider();
  EntityProviderWriteProperties properties = EntityProviderWriteProperties.serviceRoot(BASE_URI).build();
  employeeData.put("EmployeeName", null);
  ODataResponse response =
      ser.writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees"), employeeData,
          properties);
  String xmlString = verifyResponse(response);

  assertXpathExists("/a:entry/a:title", xmlString);
  assertXpathEvaluatesTo("", "/a:entry/a:title", xmlString);

  assertXpathExists("/a:entry", xmlString);
  assertXpathEvaluatesTo(BASE_URI.toASCIIString(), "/a:entry/@xml:base", xmlString);

  assertXpathExists("/a:entry/a:content", xmlString);
  assertXpathEvaluatesTo("Employees('1')/$value", "/a:entry/a:content/@src", xmlString);
  assertXpathExists("/a:entry/m:properties", xmlString);
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:27,代码来源:AtomEntryProducerTest.java

示例15: serializeEmployeeAndCheckOrderOfPropertyTags

import javax.xml.stream.FactoryConfigurationError; //导入依赖的package包/类
@Test
public void serializeEmployeeAndCheckOrderOfPropertyTags() throws IOException, XpathException, SAXException,
    XMLStreamException, FactoryConfigurationError, ODataException {
  AtomEntityProvider ser = createAtomEntityProvider();
  EntityProviderWriteProperties properties =
      EntityProviderWriteProperties.serviceRoot(BASE_URI).build();
  EdmEntitySet employeeEntitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");
  ODataResponse response = ser.writeEntry(employeeEntitySet, employeeData, properties);
  String xmlString = verifyResponse(response);

  // log.debug(xmlString);

  assertXpathExists("/a:entry", xmlString);
  assertXpathExists("/a:entry/a:content", xmlString);
  // verify properties
  assertXpathExists("/a:entry/m:properties", xmlString);
  assertXpathEvaluatesTo("9", "count(/a:entry/m:properties/*)", xmlString);

  // verify order of tags
  List<String> expectedPropertyNamesFromEdm = employeeEntitySet.getEntityType().getPropertyNames();
  verifyTagOrdering(xmlString, expectedPropertyNamesFromEdm.toArray(new String[0]));
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:23,代码来源:AtomEntryProducerTest.java


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