Package org.jdom2.output

Examples of org.jdom2.output.XMLOutputter.outputString()


     * @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 );
    }
   
    /**
     *  Return an Element with an element type name matching the parameter.
     * 
View Full Code Here


            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;
View Full Code Here

                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) {
            throw new IllegalArgumentException("error while processing xpath expressions: '" + xpaths + "'", xpe);
View Full Code Here

        }
        if (encoding != null) {
            format.setEncoding(encoding);
        }
        final XMLOutputter outputter = new XMLOutputter(format);
        return outputter.outputString(doc);
    }

    /**
     * Creates a File containing with the XML representation for the given WireFeed.
     * <p>
 
View Full Code Here

                case EntityRef:
                    LOG.debug("Entity: {}", c.getValue());
                    sb.append(c.getValue());
                    break;
                case Element:
                    sb.append(xmlOut.outputString((Element) c));
                    break;
                default:
                    // ignore
                    break;
            }
View Full Code Here

                        element.setNamespace(Namespace.NO_NAMESPACE);
                    }
                }

            }
            value = outputter.outputString(contents);

        }

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

                    if (element.getNamespace().equals(getAtomNamespace())) {
                        element.setNamespace(Namespace.NO_NAMESPACE);
                    }
                }
            }
            value = outputter.outputString(contents);
        } else {
            // Everything else comes in verbatim
            value = e.getText();
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.