Example usage for org.jdom2 DocType getPublicID

List of usage examples for org.jdom2 DocType getPublicID

Introduction

In this page you can find the example usage for org.jdom2 DocType getPublicID.

Prototype

public String getPublicID() 

Source Link

Document

This will retrieve the public ID of an externally referenced DTD, or an empty String if none is referenced.

Usage

From source file:com.rometools.rome.io.impl.RSS091NetscapeParser.java

License:Open Source License

@Override
public boolean isMyType(final Document document) {

    final Element rssRoot = document.getRootElement();
    final String name = rssRoot.getName();
    final Attribute version = rssRoot.getAttribute("version");
    final DocType docType = document.getDocType();

    return name.equals(ELEMENT_NAME) && version != null && version.getValue().equals(getRSSVersion())
            && docType != null && ELEMENT_NAME.equals(docType.getElementName())
            && PUBLIC_ID.equals(docType.getPublicID()) && SYSTEM_ID.equals(docType.getSystemID());

}

From source file:com.sun.syndication.io.impl.RSS091NetscapeParser.java

License:Open Source License

public boolean isMyType(Document document) {
    boolean ok = false;
    Element rssRoot = document.getRootElement();
    ok = rssRoot.getName().equals("rss");
    if (ok) {//from   ww  w  . jav a 2 s . c o m
        ok = false;
        Attribute version = rssRoot.getAttribute("version");
        if (version != null) {
            ok = version.getValue().equals(getRSSVersion());
            if (ok) {
                ok = false;
                DocType docType = document.getDocType();

                if (docType != null) {
                    ok = ELEMENT_NAME.equals(docType.getElementName());
                    ok = ok && PUBLIC_ID.equals(docType.getPublicID());
                    ok = ok && SYSTEM_ID.equals(docType.getSystemID());
                }
            }
        }
    }
    return ok;
}