public OMProcessingInstruction createOMProcessingInstruction( OMContainer parent, String piTarget, String piData) { ProcessingInstructionImpl pi = new ProcessingInstructionImpl(getDocumentFromParent(parent), piTarget, piData, this); parent.addChild(pi); return pi; }
/** * This method will check whether the text can be optimizable using IS_BINARY flag. If that is set * then we try to get the data handler. * * @param omContainer * @param textType * @return omNode */ private OMNode createOMText(OMContainer omContainer, int textType) { if (dataHandlerReader != null && dataHandlerReader.isBinary()) { Object dataHandlerObject; if (dataHandlerReader.isDeferred()) { dataHandlerObject = dataHandlerReader.getDataHandlerProvider(); } else { try { dataHandlerObject = dataHandlerReader.getDataHandler(); } catch (XMLStreamException ex) { throw new OMException(ex); } } OMText text = omfactory.createOMText(dataHandlerObject, dataHandlerReader.isOptimized()); String contentID = dataHandlerReader.getContentID(); if (contentID != null) { text.setContentID(contentID); } omContainer.addChild(text); return text; } else { // Some parsers (like Woodstox) parse text nodes lazily and may throw a // RuntimeException in getText() String text; try { text = parser.getText(); } catch (RuntimeException ex) { parserException = ex; throw ex; } return omfactory.createOMText(omContainer, text, textType); } }
/** * Creates an OMDOM Text node, adds it to the give parent element and returns it. * * @see org.apache.axiom.om.OMFactory#createOMText(OMContainer, String, String, boolean) */ public OMText createOMText(OMContainer parent, String s, String mimeType, boolean optimize) { TextImpl text = new TextImpl( (DocumentImpl) ((ElementImpl) parent).getOwnerDocument(), s, mimeType, optimize, this); parent.addChild(text); return text; }
/** * Creates a new OMDOM Text node with the given value and appends it to the given parent element. * * @see org.apache.axiom.om.OMFactory#createOMText( org.apache.axiom.om.OMElement,String) */ public OMText createOMText(OMContainer parent, String text) { if (parent instanceof DocumentImpl) { throw new OMHierarchyException("DOM doesn't support text nodes as children of a document"); } TextImpl txt = new TextImpl((DocumentImpl) ((ElementImpl) parent).getOwnerDocument(), text, this); parent.addChild(txt); return txt; }
public OMComment createOMComment(OMContainer parent, String content) { CommentImpl comment = new CommentImpl(getDocumentFromParent(parent), content, this); parent.addChild(comment); return comment; }
public OMText createOMText(String contentID, OMContainer parent, OMXMLParserWrapper builder) { TextImpl text = new TextImpl(contentID, parent, builder, this); parent.addChild(text); return text; }
/** Removes the contents (i.e. children) of the container. */ public static void removeContents(OMContainer container) { for (Iterator<?> iterator = container.getChildren(); iterator.hasNext(); ) { iterator.next(); iterator.remove(); } }