Package org.jdom2.output

Examples of org.jdom2.output.XMLOutputter


        return (foundSomething) ? cm : null;
    }

    protected String getXmlInnerText(Element e) {
        StringBuffer sb = new StringBuffer();
        XMLOutputter xo = new XMLOutputter();
        List children = e.getContent();
        sb.append(xo.outputString(children));

        return sb.toString();
    }
View Full Code Here


        Document feedDoc = wireFeedOutput.outputJDom(feed1);

        // Grab entry element from feed and get JDOM to serialize it
        Element entryElement= (Element)feedDoc.getRootElement().getChildren().get(0);

        XMLOutputter outputter = new XMLOutputter();
        outputter.output(entryElement, writer);
    }
View Full Code Here

        if (mode.equals(Content.BASE64)) {
                value = Base64.decode(e.getText());
        }
        else
        if (mode.equals(Content.XML)) {
            XMLOutputter outputter = new XMLOutputter();
            List eContent = e.getContent();
            Iterator i = eContent.iterator();
            while (i.hasNext()) {
                org.jdom2.Content c = (org.jdom2.Content) i.next();
                if (c instanceof Element) {
                    Element eC = (Element) c;
                    if (eC.getNamespace().equals(getAtomNamespace())) {
                        ((Element)c).setNamespace(Namespace.NO_NAMESPACE);
                    }
                }
            }
            value = outputter.outputString(eContent);
        }

        Content content = new Content();
        content.setType(type);
        content.setMode(mode);
View Full Code Here

    private LinkedList<String> doFilter(String in, Set<String> xpaths) throws IOException {
        LinkedList<String> result = new LinkedList<String>();
        try {
            Document doc = new SAXBuilder(XMLReaders.NONVALIDATING).build(new StringReader(in));
            XMLOutputter out = new XMLOutputter();

            for (String xp : xpaths) {
                XPathExpression<Content> xpath = XPathFactory.instance().compile(xp, Filters.content());
                for (Content node : xpath.evaluate(doc)) {
                    if(node instanceof Element) {
                        result.add(out.outputString((Element) node));
                    } else if(node instanceof Text) {
                        result.add(out.outputString((Text) node));
                    }
                }
            }
            return result;
        } catch (JDOMException xpe) {
View Full Code Here

        String value = null;
        String type = getAttributeValue(e, "type");
        type = (type!=null) ? type : Content.TEXT;
        if (type.equals(Content.XHTML) || (type.indexOf("/xml")) != -1 || (type.indexOf("+xml")) != -1) {
            // XHTML content needs special handling
            XMLOutputter outputter = new XMLOutputter();
            List eContent = e.getContent();
            Iterator i = eContent.iterator();
            while (i.hasNext()) {
                org.jdom2.Content c = (org.jdom2.Content) i.next();
                if (c instanceof Element) {
                    Element eC = (Element) c;
                    if (eC.getNamespace().equals(getAtomNamespace())) {
                        ((Element)c).setNamespace(Namespace.NO_NAMESPACE);
                    }
                }
            }
            value = outputter.outputString(eContent);
        } else {
            // Everything else comes in verbatim
            value = e.getText();
        }
        return value;
View Full Code Here

            JDOMResult result = new JDOMResult();
            transformer.transform(input, result);
            Document output = result.getDocument();

            XMLOutputter printer = new XMLOutputter(Format.getPrettyFormat());
            printer.output(output, writer);
            writer.flush();

        } catch (Exception ex) {
            throw new TupleQueryResultHandlerException("error while transforming XML results to HTML", ex);
        } finally {
View Full Code Here

           
            JDOMResult result = new JDOMResult();
            transformer.transform(input, result);
            Document output = result.getDocument();
           
            XMLOutputter printer = new XMLOutputter(Format.getPrettyFormat());
            printer.output(output, writer);
            writer.flush();
        }
        catch(TransformerConfigurationException e)
        {
            log.error("could not compile stylesheet for rendering SPARQL results; result display not available!");
View Full Code Here

     * @param element  the element to serialize.
     * @param format   custom <tt>format</tt> used to serialize the Element.
     * @return the serialized Element.
     */
    public static String serialize( Element element, Format format ) {
        XMLOutputter out = new XMLOutputter( format );
        return out.outputString( element );
    }
View Full Code Here

        } catch( ProviderException e ) {
            log.warn("could not load page index",e);
            throw new PluginException( e.getMessage() );
        }
        // serialize to raw format string (no changes to whitespace)
        XMLOutputter out = new XMLOutputter(Format.getRawFormat());
        return out.outputString(masterDiv);
    }
View Full Code Here

        for (Intelligence ia : intelligencesEquipes.values()) {
            for (Coureur coureur : ia.getCompositionEquipe()) {
                parseurXML.modifierEquipe(coureur.getId(), ia.getEquipe().getId());
            }
        }
        XMLOutputter xmlSortie = new XMLOutputter();
        try {
            xmlSortie.output(parseurXML.getDocument(), new FileWriter("src/XML/tempPCM.xml"));
            FichierXML fichierXml = new FichierXML("tempPCM.xml");
            fichierXml.convertirEnCDB("test.cdb");
        } catch (IOException ex) {
            Logger.getLogger(Simulation.class.getName()).log(Level.SEVERE, null, ex);
        }
View Full Code Here

TOP

Related Classes of org.jdom2.output.XMLOutputter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.