/** * {@inheritDoc} */ @Override public void build() { this.omNode.build(); }
public String getDocumentation() { if (documentation != null) { if (documentation instanceof OMText) { return ((OMText)documentation).getText(); } else if (documentation instanceof OMElement) { StringWriter writer = new StringWriter(); documentation.build(); try { ((OMElement)documentation).serialize(writer); } catch (XMLStreamException e) { log.error(e); } writer.flush(); return writer.toString(); } } return null; }
public String getDocumentation() { if (documentation != null) { if (documentation instanceof OMText) { return ((OMText)documentation).getText(); } else if (documentation instanceof OMElement) { StringWriter writer = new StringWriter(); documentation.build(); try { ((OMElement)documentation).serialize(writer); } catch (XMLStreamException e) { log.error(e); } writer.flush(); return writer.toString(); } } return null; }
/** * Converts a given inputstream to an OMNode * The reurned OMNode is fully built if buildAll is true. * If buildAll is false, the caller is responsible for closing the parser. * * @param inputStream * @param buildAll * @return OMNode * @throws javax.xml.stream.XMLStreamException * */ public static OMNode toOM(InputStream inputStream, boolean buildAll) throws XMLStreamException { OMXMLParserWrapper builder = OMXMLBuilderFactory.createOMBuilder(inputStream); OMNode omNode = builder.getDocumentElement(); if (buildAll) { omNode.build(); builder.close(); } return omNode; }
/** * Converts a given Reader to an OMNode. * The reurned OMNode is fully built if buildAll is true. * If buildAll is false, the caller is responsible for closing the parser. * * @param reader * @param buildAll * @return OMNode * @throws XMLStreamException */ public static OMNode toOM(Reader reader, boolean buildAll) throws XMLStreamException { OMXMLParserWrapper builder = OMXMLBuilderFactory.createOMBuilder(reader); OMNode omNode = builder.getDocumentElement(); if (buildAll) { omNode.build(); builder.close(); } return omNode; } }
/** * Converts a given Reader to an OMNode. * The reurned OMNode is fully built if buildAll is true. * If buildAll is false, the caller is responsible for closing the parser. * * @param reader * @param buildAll * @return OMNode * @throws XMLStreamException */ public static OMNode toOM(Reader reader, boolean buildAll) throws XMLStreamException { OMXMLParserWrapper builder = OMXMLBuilderFactory.createOMBuilder(reader); OMNode omNode = builder.getDocumentElement(); if (buildAll) { omNode.build(); builder.close(); } return omNode; } }
/** * Converts a given inputstream to an OMNode * The reurned OMNode is fully built if buildAll is true. * If buildAll is false, the caller is responsible for closing the parser. * * @param inputStream * @param buildAll * @return OMNode * @throws javax.xml.stream.XMLStreamException * */ public static OMNode toOM(InputStream inputStream, boolean buildAll) throws XMLStreamException { OMXMLParserWrapper builder = OMXMLBuilderFactory.createOMBuilder(inputStream); OMNode omNode = builder.getDocumentElement(); if (buildAll) { omNode.build(); builder.close(); } return omNode; }
public static void removeChildren(IContainer that) { boolean updateState; if (that.getState() == IParentNode.INCOMPLETE && that.getBuilder() != null) { OMNode lastKnownChild = that.getLastKnownOMChild(); if (lastKnownChild != null) { lastKnownChild.build(); } ((StAXOMBuilder)that.getBuilder()).discard(that); updateState = true; } else { updateState = false; } IChildNode child = (IChildNode)that.getFirstOMChildIfAvailable(); while (child != null) { IChildNode nextSibling = (IChildNode)child.getNextOMSiblingIfAvailable(); child.setPreviousOMSibling(null); child.setNextOMSibling(null); child.setParent(null); child = nextSibling; } that.setFirstChild(null); that.setLastChild(null); if (updateState) { that.setComplete(true); } } }