public AttrImpl(DocumentImpl ownerDocument, String localName, OMNamespace ns, String value, OMFactory factory) { super(ownerDocument, factory); this.attrName = localName; this.attrValue = new TextImpl(ownerDocument, value, factory); this.namespace = (NamespaceImpl) ns; }
public void buildWithAttachments() { this.build(); if (isOptimized()) { this.getDataHandler(); } }
public void discard() throws OMException { if (done) { this.detach(); } }
public Node cloneNode(boolean deep) { TextImpl textImpl = new TextImpl(this.textValue.toString(), this.factory); textImpl.setOwnerDocument(this.ownerNode); return textImpl; }
if (this.isReadonly()) { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, DOMMessageFormatter.formatMessage( this.deleteData(offset, this.textValue.length()); TextImpl newText = (TextImpl) this.getOwnerDocument().createTextNode( newValue); newText.setParent(this.parentNode); this.insertSiblingAfter(newText);
private void internalSerializeLocal(XMLStreamWriter writer2) throws XMLStreamException { MTOMXMLStreamWriter writer = (MTOMXMLStreamWriter) writer2; if (!this.isBinary) { writeOutput(writer); } else { if (writer.isOptimized()) { if (contentID == null) { contentID = writer.getNextContentId(); } // send binary as MTOM optimised this.attribute = new AttrImpl(this.ownerNode, "href", new NamespaceImpl("", ""), "cid:" + getContentID(), this.factory); this.serializeStartpart(writer); writer.writeOptimized(this); writer.writeEndElement(); } else { writer.writeCharacters(this.getText()); } } }
public String getText() { if (this.textNS != null) { return getTextString(); } else if (this.charArray != null || this.textValue != null) { return getTextFromProperPlace(); } else { try { return TextHelper.toString(getInputStream()); } catch (Exception e) { throw new OMException(e); } } }
private void serializeStartpart(XMLStreamWriter writer) throws XMLStreamException { String nameSpaceName = XOP_NS.getNamespaceURI(); String writer_prefix = writer.getPrefix(nameSpaceName); String prefix = XOP_NS.getPrefix(); if (writer_prefix != null) { writer.writeStartElement(nameSpaceName, this .getLocalName()); } else { writer.writeStartElement(prefix, this.getLocalName(), nameSpaceName); writer.setPrefix(prefix, nameSpaceName); } // add the elements attribute "href" serializeAttribute(this.attribute, writer); // add the namespace serializeNamespace(XOP_NS, writer); }
public Node cloneNode(boolean deep) { AttrImpl clone = (AttrImpl) super.cloneNode(deep); if (clone.attrValue == null) { // Need to break the association w/ original kids clone.attrValue = new TextImpl(this.attrValue.toString(), factory); if (this.attrValue.nextSibling != null) { throw new UnsupportedOperationException( "Attribute value can contain only a text " + "node with out any siblings"); } } clone.isSpecified(true); return clone; }
break; case TEXT: TextImpl text = new TextImpl(); text.setTextContent(((OMText) omNode).getText()); clonedNode = text; break;
public QName getTextAsQName() { if (textNS != null) { String prefix = textNS.getPrefix(); String name = textNS.getNamespaceURI(); if (prefix == null || "".equals(prefix)) { return new QName(name, getTextFromProperPlace()); } else { return new QName(textNS.getNamespaceURI(), getTextFromProperPlace(), prefix); } } else if (this.textValue != null || charArray != null) { return new QName(getTextFromProperPlace()); } else { try { return new QName(TextHelper.toString(getInputStream())); } catch (Exception e) { throw new OMException(e); } } }
/** * Returns the value of this attribute. * * @see org.w3c.dom.Node#getNodeValue() */ public String getNodeValue() throws DOMException { return (this.attrValue == null) ? "" : this.attrValue.getData(); }
public java.io.InputStream getInputStream() throws OMException { if (isBinary) { if (dataHandlerObject == null) { getDataHandler(); } InputStream inStream; javax.activation.DataHandler dataHandler = (javax.activation.DataHandler) dataHandlerObject; try { inStream = dataHandler.getDataSource().getInputStream(); } catch (IOException e) { throw new OMException( "Cannot get InputStream from DataHandler." + e); } return inStream; } else { throw new OMException("Unsupported Operation"); } }
/** * Create OMText node that is a copy of the source text node * @param parent * @param source * @return */ public OMText createOMText(OMContainer parent, OMText source) { return new TextImpl(parent, (TextImpl) source, this); }
/** * Creates a new OMDOM Text node with the given datahandler and the given MTOM optimization * configuration and returns it. * * @see org.apache.axiom.om.OMFactory#createOMText(Object, boolean) */ public OMText createOMText(Object dataHandler, boolean optimize) { return new TextImpl(this.document, dataHandler, optimize, this); }
public AttrImpl(DocumentImpl ownerDocument, String name, String value, OMFactory factory) { super(ownerDocument, factory); this.attrName = name; this.attrValue = new TextImpl(ownerDocument, value, factory); }
/** * Creates a OMDOM Text node carrying the given value. * * @see org.apache.axiom.om.OMFactory#createOMText(String) */ public OMText createOMText(String s) { return new TextImpl(this.document, s, this); }
/** * Creates a new OMDOM Text node with the value of the given text value along with the MTOM * optimization parameters and returns it. * * @see org.apache.axiom.om.OMFactory#createOMText(String, String, boolean) */ public OMText createOMText(String text, String mimeType, boolean optimize) { return new TextImpl(this.document, text, mimeType, optimize, this); }
public OMText createOMText(OMContainer parent, QName text, int type) { return new TextImpl(parent, text, type, this); }
public Text createTextNode(String value) { return new TextImpl(this, value, this.factory); }