Java Code Examples for org.jdom2.Document#getContent()

The following examples show how to use org.jdom2.Document#getContent() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File:    From gocd with Apache License 2.0 5 votes vote down vote up
private CommandSnippetComment getComment(Document document) {
    for (Object content : document.getContent()) {
        if (content instanceof Comment) {
            return new CommandSnippetTextComment(((Comment) content).getText());
    return new EmptySnippetComment();
Example 2
Source File:    From rome with Apache License 2.0 5 votes vote down vote up
protected String getStyleSheet(final Document doc) {
    String styleSheet = null;
    for (final Content c : doc.getContent(new ContentFilter(ContentFilter.PI))) {
        final ProcessingInstruction pi = (ProcessingInstruction) c;
        if ("text/xsl".equals(pi.getPseudoAttributeValue("type"))) {
            styleSheet = pi.getPseudoAttributeValue("href");
    return styleSheet;