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