The method showed below is generate Axiom OMElement from input stream
/*** @param inputStream Reads input stream that use to build OMElement* @return OMElement that generated from input stream* @throws Exception at error in generating parser*/public static OMElement buildOMElement(InputStream inputStream) throws Exception {XMLStreamReader parser;try {parser = XMLInputFactory.newInstance().createXMLStreamReader(inputStream);}catch (XMLStreamException e) {String msg = "Error in initializing the parser to build the OMElement.";log.error(msg, e);throw new Exception(msg, e);}finally {log.info("Reading data from configuration file");}StAXOMBuilder builder = new StAXOMBuilder(parser);return builder.getDocumentElement();}
we can call this method as follows
OMElement element=buildOMElement(new FileInputStream("File path String"));
If you need more information go to this link
These are really great ideas in on the topic of blogging.
ReplyDeleteYou have touched some nice things here. Any way keep up wrinting.
Take a look at my web page :: Phone Therapy