/** * {@inheritDoc} */ public String getString() throws IOException { m_document.setContext( m_context ); CustomXMLOutputProcessor processor = new CustomXMLOutputProcessor(); XMLOutputter output = new XMLOutputter(processor); StringWriter out = new StringWriter(); Format fmt = Format.getRawFormat(); fmt.setExpandEmptyElements( false ); fmt.setLineSeparator( LINEBREAK ); output.setFormat( fmt ); output.outputElementContent( m_document.getRootElement(), out ); String result = out.toString(); return result; } }
/** * {@inheritDoc} */ public String getString() throws IOException { Element rootElement = m_document.getRootElement(); processChildren( rootElement ); m_document.setContext( m_context ); XMLOutputter output = new XMLOutputter(); StringWriter out = new StringWriter(); Format fmt = Format.getRawFormat(); fmt.setExpandEmptyElements( false ); fmt.setLineSeparator( LINEBREAK ); output.setFormat( fmt ); output.outputElementContent( m_document.getRootElement(), out ); return out.toString(); } }
/** * This constructor is not intended for usage. * * @param xml * An XML string * @throws JDOMException * Is thrown when the xml string is invalid * @throws IOException * Is thrown when the xml string is invalid */ public LolStatus(String xml) throws JDOMException, IOException { outputter .setFormat(outputter.getFormat().setExpandEmptyElements(false)); final SAXBuilder saxBuilder = new SAXBuilder(); doc = saxBuilder.build(new StringReader(xml)); for (final Element e : doc.getRootElement().getChildren()) { boolean found = false; for (final XMLProperty p : XMLProperty.values()) { if (p.name().equals(e.getName())) { found = true; } } if (!found) { System.err.println("XMLProperty \"" + e.getName() + "\" value: \"" + e.getValue() + "\" not implemented yet!"); } } }
format.setExpandEmptyElements( false ); format.setOmitDeclaration( false ); format.setIndent( "\t" );
/** * Generate a default LoLStatus that can later be modified and be used to * change the current LolStatus ({@link LolChat#setStatus(LolStatus)}). * */ public LolStatus() { outputter .setFormat(outputter.getFormat().setExpandEmptyElements(false)); doc = new Document(new Element("body")); for (final XMLProperty p : XMLProperty.values()) { doc.getRootElement().addContent(new Element(p.toString())); } }
Format format = Format.getPrettyFormat(); format.setExpandEmptyElements( false ); format.setOmitDeclaration( false ); format.setIndent( "\t" );