public InputStream getXMLInputStream(String encoding) throws UnsupportedEncodingException{ if (data == null) { throw new OMException("The InputStreamDataSource does not have a backing object"); } return data.is; }
public String getNodeAsString( OMElement context, XPath xpath, String defaultValue ) throws XMLParsingException { String value = defaultValue; Object node = getNode( context, xpath ); if ( node != null ) { try { if ( node instanceof OMText ) { value = ( (OMText) node ).getText(); } else if ( node instanceof OMElement ) { value = ( (OMElement) node ).getText(); } else if ( node instanceof OMAttribute ) { value = ( (OMAttribute) node ).getAttributeValue(); } else { String msg = "Unexpected node type '" + node.getClass() + "'."; throw new XMLParsingException( this, context, msg ); } } catch ( OMException ex ) { String msg = "Internal error while accessing node '" + ex.getMessage() + "'."; throw new XMLParsingException( this, context, msg ); } } return value; }
public boolean isDestructiveRead() { if (data == null) { throw new OMException("The InputStreamDataSource does not have a backing object"); } return true; }
public void checkDocumentElement(OMElement element) { if (!(element instanceof SOAPEnvelope)) { throw new OMException("Child not allowed; must be a SOAPEnvelope"); } } }
public boolean isDestructiveWrite() { if (data == null) { throw new OMException("The InputStreamDataSource does not have a backing object"); } // Writing an input stream is destructive return true; }
public void setParent(OMContainer element) { if (element instanceof ParentNode) { this.parentNode = (ParentNode) element; } else { throw new OMException("The given parent is not of the type " + ParentNode.class); } }
public void setNextOMSibling(OMNode node) { if (node == null) { this.nextSibling = null; return; } if (node instanceof ChildNode) { this.nextSibling = (ChildNode) node; } else { throw new OMException("The node is not a " + ChildNode.class); } }
public void setPreviousOMSibling(OMNode node) { if (node == null) { this.previousSibling = null; return; } if (node instanceof ChildNode) { this.previousSibling = (ChildNode) node; } else { throw new OMException("The node is not a " + ChildNode.class); } }
String getRootPartContentType() { throw new OMException( "The attachments map was created programatically. Unsupported operation."); }
/** * Method detach * * @throws OMException */ public OMNode detach() throws OMException { throw new OMException("Root Element can not be detached"); }
public static OMException translate(CoreModelException ex) { return new OMException(ex); } }
public static OMException translate(CoreModelException ex) { return new OMException(ex); } }
InputStream getRootPartInputStream(boolean preserve) throws OMException { throw new OMException("Invalid operation. Attachments are created programatically."); }
public OMNode detach() { throw new OMException( "Elements that doesn't have a parent can not be detached"); }
public void close() { if (data.is != null) { try { data.is.close(); } catch (IOException e) { throw new OMException(e); } data.is = null; } }
/** * Method getNamespaceCount. * * @return Returns int. * @throws OMException */ public int getNamespaceCount() throws OMException { try { return parser.getNamespaceCount(); } catch (Exception e) { throw new OMException(e); } }
/** * Method getNamespacePrefix. * * @param index * @return Returns String. * @throws OMException */ public String getNamespacePrefix(int index) throws OMException { try { return parser.getNamespacePrefix(index); } catch (Exception e) { throw new OMException(e); } }
/** * Method getNamespaceUri. * * @param index * @return Returns String. * @throws OMException */ public String getNamespaceUri(int index) throws OMException { try { return parser.getNamespaceURI(index); } catch (Exception e) { throw new OMException(e); } }
public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException { try { output.write(stream, offset, length); } catch (IOException e) { throw new OMException("Could not serialize payload. " + e.getLocalizedMessage()); } }
public void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException { try { IOUtils.copy(new ByteArrayInputStream(stream, offset, length), writer); } catch (IOException e) { throw new OMException("Could not serialize payload. " + e.getLocalizedMessage()); } }