Java Code Examples for org.jpmml.model.JAXBUtil#unmarshalPMML()
The following examples show how to use
org.jpmml.model.JAXBUtil#unmarshalPMML() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConverterFactory.java From jpmml-sparkml with GNU Affero General Public License v3.0 | 5 votes |
static public void checkApplicationClasspath(){ String string = "<PMML xmlns=\"http://www.dmg.org/PMML-4_4\"/>"; try { JAXBUtil.unmarshalPMML(new StreamSource(new StringReader(string))); } catch(JAXBException je){ throw new IllegalArgumentException("Expected JPMML-Model version 1.5.X, got a legacy version. See https://issues.apache.org/jira/browse/SPARK-15526", je); } }
Example 2
Source File: PmmlProcessorConfiguration.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@PostConstruct public void setUp() throws IOException, SAXException, JAXBException { try (InputStream is = properties.getModelLocation().getInputStream()) { Source transformedSource = ImportFilter.apply(new InputSource(is)); pmml = JAXBUtil.unmarshalPMML(transformedSource); Assert.state(!pmml.getModels().isEmpty(), "The provided PMML file at " + properties.getModelLocation() + " does not contain any model"); } }
Example 3
Source File: PMMLUtils.java From oryx with Apache License 2.0 | 5 votes |
/** * @param pmmlString PMML model encoded as an XML doc in a string * @return {@link PMML} object representing the model * @throws IOException if XML can't be unserialized */ public static PMML fromString(String pmmlString) throws IOException { try { SAXSource transformed = SAXUtil.createFilteredSource( new ByteArrayInputStream(pmmlString.getBytes(StandardCharsets.UTF_8)), new ImportFilter()); return JAXBUtil.unmarshalPMML(transformed); } catch (JAXBException | SAXException e) { throw new IOException(e); } }