/** * Create an object model builder that reads a plain XML document from the provided input stream * with a given parser configuration. * * @param configuration * the parser configuration to use * @param in * the input stream representing the XML document * @return the builder */ public static OMXMLParserWrapper createOMBuilder(StAXParserConfiguration configuration, InputStream in) { return createOMBuilder(configuration, in, null); }
/** * Create an object model builder that reads a plain XML document from the provided input stream * with the default parser configuration defined by {@link StAXParserConfiguration#DEFAULT}. * * @param in * the input stream representing the XML document * @return the builder */ public static OMXMLParserWrapper createOMBuilder(InputStream in) { return createOMBuilder(StAXParserConfiguration.DEFAULT, in); }
/** * Create an object model builder that reads a plain XML document from the provided character * stream with the default parser configuration defined by * {@link StAXParserConfiguration#DEFAULT}. * * @param in * the character stream representing the XML document * @return the builder */ public static OMXMLParserWrapper createOMBuilder(Reader in) { return createOMBuilder(StAXParserConfiguration.DEFAULT, in); }
/** * Create an object model builder that reads an XML document from the provided input stream * using a specified object model factory and with the default parser configuration defined by * {@link StAXParserConfiguration#DEFAULT}. * * @param omFactory * the object model factory to use * @param in * the input stream representing the XML document * @return the builder */ public static OMXMLParserWrapper createOMBuilder(OMFactory omFactory, InputStream in) { return createOMBuilder(omFactory, StAXParserConfiguration.DEFAULT, in); }
/** * Create an object model builder that reads an XML document from the provided character stream * using a specified object model factory and with the default parser configuration defined by * {@link StAXParserConfiguration#DEFAULT}. * * @param omFactory * the object model factory to use * @param in * the character stream representing the XML document * @return the builder */ public static OMXMLParserWrapper createOMBuilder(OMFactory omFactory, Reader in) { return createOMBuilder(omFactory, StAXParserConfiguration.DEFAULT, in); }
/** * Create an object model builder that reads an XML document from the provided input stream * using a specified object model factory and with a given parser configuration. * * @param omFactory * the object model factory to use * @param configuration * the parser configuration to use * @param in * the input stream representing the XML document * @return the builder */ public static OMXMLParserWrapper createOMBuilder(OMFactory omFactory, StAXParserConfiguration configuration, InputStream in) { return createOMBuilder(omFactory, configuration, in, null); }
/** * Create an object model builder that reads a plain XML document from the provided input stream * with the default parser configuration defined by {@link StAXParserConfiguration#DEFAULT}. * * @param in * the input stream representing the XML document * @param encoding * the charset encoding of the XML document or <code>null</code> if the parser should * determine the charset encoding * @return the builder */ public static OMXMLParserWrapper createOMBuilder(InputStream in, String encoding) { return createOMBuilder(StAXParserConfiguration.DEFAULT, in, encoding); }
/** * Create a builder suitable for an XML message. This method uses * {@link StAXParserConfiguration#SOAP} to disallow document type declarations (that potentially * reference external entities). * * @param in * the input stream containing the plain XML message * @param encoding * the charset encoding of the message or <code>null</code> if the parser should * determine the charset encoding * @return the builder */ public static OMXMLParserWrapper createPOXBuilder(InputStream in, String encoding) { return OMXMLBuilderFactory.createOMBuilder(StAXParserConfiguration.SOAP, in, encoding); }
/** * Returns the parsed xml document. * * @param stream input stream of xml string or document needed to be parsed * @return parsed document */ public OMElement getParsedOMElement(InputStream stream) { OMXMLParserWrapper builder = OMXMLBuilderFactory.createOMBuilder(stream); return builder.getDocumentElement(); }
/** * Parse input stream to get document. * @param in input stream * @return the document */ public static OMDocument getDocument(InputStream in) { // create the builder OMXMLParserWrapper builder = OMXMLBuilderFactory.createOMBuilder(in); // get the root element OMDocument doc = builder.getDocument(); return doc; } /**
public OMElement convert(Element s) { return OMXMLBuilderFactory.createOMBuilder(new DOMSource(s)).getDocumentElement(); } }
private static Policy loadPolicy(String xmlPath) throws Exception { InputStream in = new FileInputStream(xmlPath); try { return PolicyEngine.getPolicy( OMXMLBuilderFactory.createOMBuilder(in).getDocumentElement()); } finally { in.close(); } }
/** * Convert DOM Element into a fully built OMElement * @param element dom Element * @return OMElement * @throws Exception */ public static OMElement toOM(Element element) throws Exception { OMXMLParserWrapper builder = OMXMLBuilderFactory.createOMBuilder(element, true); builder.detach(); return builder.getDocumentElement(); }
/** * Converts the DOM representation of an Element to the Axiom one. * * @param element The DOM representation of the element * @return The Axiom representation of the same element */ public static OMElement convertDOMElementToAxiom(final Element element) { OMXMLParserWrapper parser = OMXMLBuilderFactory.createOMBuilder(element, false); OMElement omElement = parser.getDocumentElement(); omElement.build(); return omElement; } }
private List<OMElement> splitToRecords(String recordsSrc) { OMXMLParserWrapper records = OMXMLBuilderFactory.createOMBuilder(new StringReader(recordsSrc)); OMElement element = records.getDocumentElement(); AXIOMXPath xpath = null; try { xpath = new AXIOMXPath("//PubmedArticle"); List<OMElement> recordsList = xpath.selectNodes(element); return recordsList; } catch (JaxenException e) { return null; } }
public static TokenRequestDispatcherConfig load(String configFilePath) throws TrustException { FileInputStream fis; OMXMLParserWrapper builder; try { fis = new FileInputStream(configFilePath); builder = OMXMLBuilderFactory.createOMBuilder(fis); } catch (Exception e) { throw new TrustException("errorLoadingConfigFile", new String[]{configFilePath}, e); } return load(builder.getDocumentElement()); }
private static org.apache.neethi.Policy getPolicy (java.lang.String policyString) { return org.apache.neethi.PolicyEngine.getPolicy(org.apache.axiom.om.OMXMLBuilderFactory.createOMBuilder( new java.io.StringReader(policyString)).getDocument().getXMLStreamReader(false)); }
private static org.apache.neethi.Policy getPolicy (java.lang.String policyString) { return org.apache.neethi.PolicyEngine.getPolicy(org.apache.axiom.om.OMXMLBuilderFactory.createOMBuilder( new java.io.StringReader(policyString)).getDocument().getXMLStreamReader(false)); }
private static org.apache.neethi.Policy getPolicy (java.lang.String policyString) { return org.apache.neethi.PolicyEngine.getPolicy(org.apache.axiom.om.OMXMLBuilderFactory.createOMBuilder( new java.io.StringReader(policyString)).getDocument().getXMLStreamReader(false)); }
public static SynapseConfiguration getConfiguration(InputStream is, Properties properties) throws XMLStreamException { log.info("Generating the Synapse configuration model by parsing the XML configuration"); OMElement definitions = OMXMLBuilderFactory.createOMBuilder(is).getDocumentElement(); definitions.build(); return ConfigurationFactoryAndSerializerFinder.getInstance() .getConfiguration(definitions, properties); } }