/** * Parse an XML document located using an {@link InputSource} using the * pooled document builder. */ public static OMElement toOM(Source inputSource) throws IOException { Document doc = DOMUtils.sourceToDOM(inputSource); return toOM(doc.getDocumentElement(), OMAbstractFactory.getOMFactory()); }
protected Element parse(Source content) throws MessageTranslationException { // Check for the message in the cache. note that we are using a synchronized map here, // so that we are thread safe, although it is possible for the parse to happen twice. Document parsed = __parsed.get(content); if (parsed != null) return parsed.getDocumentElement(); try { parsed = DOMUtils.sourceToDOM(content); __parsed.put(content, parsed); return parsed.getDocumentElement(); } catch (Exception e) { throw new MessageTranslationException("Message parsing exception", e); } }