List of usage examples for org.jdom2 Namespace equals
@Override public boolean equals(final Object ob)
Namespaces
are equal if and only if their URIs are byte-for-byte equals. From source file:com.cybernostics.jsp2thymeleaf.api.elements.CopyElementConverter.java
protected void addAttributes(Element parent, JspElementContext node, JSPElementNodeConverter context) { final List<Attribute> attributes = convertAttributes(node, context); List<Attribute> atts = attributes.stream().map(a -> { Namespace ns = a.getNamespace(); if (ns.equals(XMLNS) || ns.getPrefix().equals("")) { if (a.getValue().startsWith("${") || a.getValue().startsWith("@{")) { a.setNamespace(TH);//w w w .j a v a 2 s . c o m } } return a; }).collect(toList()); atts.forEach(it -> parent.setAttribute(it)); }
From source file:com.rometools.modules.mediarss.io.RSS20YahooParser.java
License:Open Source License
/** * Indicates if a JDom document is an RSS instance that can be parsed with the parser. * <p/>//from www . j a v a 2 s . c o m * It checks for RDF ("http://www.w3.org/1999/02/22-rdf-syntax-ns#") and RSS * ("http://purl.org/rss/1.0/") namespaces being defined in the root element. * * @param document document to check if it can be parsed with this parser implementation. * @return <b>true</b> if the document is RSS1., <b>false</b> otherwise. */ @Override public boolean isMyType(final Document document) { boolean ok = false; final Element rssRoot = document.getRootElement(); final Namespace defaultNS = rssRoot.getNamespace(); ok = defaultNS != null && defaultNS.equals(getRSSNamespace()); return ok; }
From source file:com.rometools.rome.io.impl.Atom03Parser.java
License:Open Source License
@Override public boolean isMyType(final Document document) { final Element rssRoot = document.getRootElement(); final Namespace defaultNS = rssRoot.getNamespace(); return defaultNS != null && defaultNS.equals(getAtomNamespace()); }
From source file:com.rometools.rome.io.impl.ModuleParsers.java
License:Open Source License
private boolean hasElementsFrom(final Element root, final Namespace namespace) { boolean hasElements = false; for (final Element child : root.getChildren()) { final Namespace childNamespace = child.getNamespace(); if (namespace.equals(childNamespace)) { hasElements = true;/*w w w . j a v a 2 s. c o m*/ break; } } return hasElements; }
From source file:com.rometools.rome.io.impl.RSS090Parser.java
License:Open Source License
@Override public boolean isMyType(final Document document) { final Element rssRoot = document.getRootElement(); final Namespace defaultNS = rssRoot.getNamespace(); final List<Namespace> additionalNSs = rssRoot.getAdditionalNamespaces(); boolean myType = false; if (defaultNS != null && defaultNS.equals(getRDFNamespace()) && additionalNSs != null) { for (final Namespace namespace : additionalNSs) { if (getRSSNamespace().equals(namespace)) { myType = true;//from w ww . ja va 2 s. co m break; } } } return myType; }
From source file:com.rometools.rome.io.impl.RSS10Parser.java
License:Open Source License
/** * Indicates if a JDom document is an RSS instance that can be parsed with the parser. * <p/>/*from w ww . j ava 2 s . c om*/ * It checks for RDF ("http://www.w3.org/1999/02/22-rdf-syntax-ns#") namespace being defined in * the root element and for the RSS 1.0 ("http://purl.org/rss/1.0/") namespace in the channel * element. * * @param document document to check if it can be parsed with this parser implementation. * @return <b>true</b> if the document is RSS1., <b>false</b> otherwise. */ @Override public boolean isMyType(final Document document) { final Element rssRoot = document.getRootElement(); final Namespace defaultNS = rssRoot.getNamespace(); return defaultNS != null && defaultNS.equals(getRDFNamespace()) && rssRoot.getChild("channel", getRSSNamespace()) != null; }
From source file:com.rometools.rome.io.impl.RSS20wNSParser.java
License:Open Source License
@Override public boolean isMyType(final Document document) { final Element rssRoot = document.getRootElement(); final Namespace defaultNS = rssRoot.getNamespace(); return defaultNS != null && defaultNS.equals(getRSSNamespace()) && super.isMyType(document); }
From source file:com.sun.syndication.io.impl.Atom03Parser.java
License:Open Source License
public boolean isMyType(Document document) { Element rssRoot = document.getRootElement(); Namespace defaultNS = rssRoot.getNamespace(); return (defaultNS != null) && defaultNS.equals(getAtomNamespace()); }
From source file:com.sun.syndication.io.impl.ModuleParsers.java
License:Open Source License
private boolean hasElementsFrom(Element root, Namespace namespace) { boolean hasElements = false; // boolean hasElements = namespace.equals(root.getNamespace()); if (!hasElements) { List children = root.getChildren(); for (int i = 0; !hasElements && i < children.size(); i++) { Element child = (Element) children.get(i); hasElements = namespace.equals(child.getNamespace()); }//ww w. j av a 2 s. c om } return hasElements; }
From source file:com.sun.syndication.io.impl.RSS090Parser.java
License:Open Source License
public boolean isMyType(Document document) { boolean ok = false; Element rssRoot = document.getRootElement(); Namespace defaultNS = rssRoot.getNamespace(); List additionalNSs = rssRoot.getAdditionalNamespaces(); ok = defaultNS != null && defaultNS.equals(getRDFNamespace()); if (ok) {//from w ww . j av a2 s.c o m if (additionalNSs == null) { ok = false; } else { ok = false; for (int i = 0; !ok && i < additionalNSs.size(); i++) { ok = getRSSNamespace().equals(additionalNSs.get(i)); } } } return ok; }