public static String xsd2inst(Reader[] schemaReaders, String rootName, Xsd2InstOptions options) { // Process Schema files List sdocs = new ArrayList(); for (int i = 0; i < schemaReaders.length; i++) { try { sdocs.add(XmlObject.Factory.parse(schemaReaders[i], (new XmlOptions()).setLoadLineNumbers().setLoadMessageDigest())); } catch (Exception e) { System.err.println("Can not load schema reader: " + i + " " + schemaReaders[i] + ": "); e.printStackTrace(); } } XmlObject[] schemas = (XmlObject[]) sdocs.toArray(new XmlObject[sdocs.size()]); return xsd2inst(schemas, rootName, options); }
public static String indent(String xmldoc) throws IOException, XmlException { StringWriter sw = new StringWriter(); XmlObject doc = XmlObject.Factory.parse(xmldoc, (new XmlOptions()).setLoadLineNumbers()); doc.save(sw, new XmlOptions().setSavePrettyPrint().setSavePrettyPrintIndent(DEFAULT_INDENT)); sw.close(); return sw.getBuffer().toString(); } }
protected final Object unmarshalReader(Reader reader) throws XmlMappingException, IOException { try { XmlObject object = XmlObject.Factory.parse(reader, getXmlOptions()); validate(object); return object; } catch (XmlException ex) { throw convertXmlBeansException(ex, false); } }
@ResponseStatus(HttpStatus.NO_CONTENT) @RequestMapping(value="/save", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) public void saveOfferingExtension(@RequestBody final String extensionJson) throws XmlException, NoSuchOfferingException, OwsExceptionReport, IOException { JsonNode request = Json.loadString(extensionJson); final String offeringId = request.path(OFFERING).asText(); final String extensionId = request.path(IDENTIFIER).asText(); final String extensionContent = request.path(EXTENSION_PROPERTY).asText(); checkOffering(offeringId); XmlObject.Factory.parse(extensionContent); getCapabilitiesExtensionService().saveOfferingExtension(offeringId, extensionId, extensionContent); }
private XmlObject parseToXmlObject(String responseString) throws XmlException { try { return XmlObject.Factory.parse(responseString); } catch (XmlException e) { LOGGER.warn("Server returned non XML data: {}", responseString); throw e; } }
private Object decodeXmlObject(String xmlString) throws DecodingException { try { return decodeXmlObject(XmlObject.Factory.parse(xmlString)); } catch (final XmlException e) { throw new XmlDecodingException("XML string", xmlString, e); } }
public static XmlObject readXML(String string) throws XmlDecodingException { try { return XmlObject.Factory.parse(string); } catch (XmlException e) { throw new XmlDecodingException("XML string", string, e); } }
public static XmlObject parseXmlString(String xmlString) throws DecodingException { try { return XmlObject.Factory.parse(xmlString); } catch (final XmlException xmle) { throw new DecodingException("An xml error occured when parsing the request!", xmle); } }
xmlInstances[i] = XmlObject.Factory.parse(xmlFiles[i]);
x = XmlObject.Factory.parse( files[i] );
XmlObject.Factory.parse( schemaFiles[i], (new XmlOptions()).setLoadLineNumbers().setLoadMessageDigest()));
sdocs.add(XmlObject.Factory.parse(schemaFiles[i], (new XmlOptions()).setLoadLineNumbers().setLoadMessageDigest()));
try { sdocs.add( XmlObject.Factory.parse( schemaFiles[i], options.setLoadMessageDigest()));
try doc = XmlObject.Factory.parse(files[i], (new XmlOptions()).setLoadLineNumbers());
try XmlObject schema = XmlObject.Factory.parse(testCase.getSchemaFile(), new XmlOptions().setErrorListener(errors).setLoadLineNumbers()); XmlObject schema2 = null; if (testCase.getResourceFile() != null) schema2 = XmlObject.Factory.parse(testCase.getResourceFile(), new XmlOptions().setErrorListener(errors).setLoadLineNumbers()); XmlObject[] schemas = schema2 == null ? new XmlObject[] { schema } : new XmlObject[] { schema, schema2 }; SchemaTypeSystem system = XmlBeans.compileXsd(schemas, XmlBeans.getBuiltinTypeSystem(), new XmlOptions().setErrorListener(errors));
XmlCursor c = org.apache.xmlbeans.XmlObject.Factory.parse(xml).newCursor();
private static Map findRelativeInOne(URI source, URI target) { try { URL sourceURL = source.toURL(); XmlObject xobj = XmlObject.Factory.parse(sourceURL, loadOptions); XmlCursor xcur = xobj.newCursor(); xcur.toFirstChild(); Map result = new LinkedHashMap(); if (xobj instanceof SchemaDocument) putMappingsFromSchema(result, source, target, ((SchemaDocument)xobj).getSchema()); else if (xobj instanceof DefinitionsDocument) putMappingsFromWsdl(result, source, target, ((DefinitionsDocument)xobj).getDefinitions()); return result; } catch (Exception e) { // any exceptions parsing the given URL? Then skip this file silently } return Collections.EMPTY_MAP; }
void dumpXml() { String xml = readString(); try { emit( XmlObject.Factory.parse( xml ).xmlText( prettyOptions ) ); } catch ( XmlException x ) { emit( "!!!!!! BAD XML !!!!!" ); emit( xml ); } }
public static SchemaDocument[] inst2xsd(Reader[] instReaders, Inst2XsdOptions options) throws IOException, XmlException { XmlObject[] instances = new XmlObject[ instReaders.length ]; for (int i = 0; i < instReaders.length; i++) { instances[i] = XmlObject.Factory.parse(instReaders[i]); } return inst2xsd(instances, options); }