Java HTML Jsoup Element getSrcOrRelFromImageElement(Element imgElm)

Here you can find the source of getSrcOrRelFromImageElement(Element imgElm)

Description

get Src Or Rel From Image Element

License

Apache License

Declaration

public static String getSrcOrRelFromImageElement(Element imgElm) 

Method Source Code

//package com.java2s;
/*/*ww  w.  ja v  a2  s .c om*/
 *  Copyright 2011 Peter Karich jetwick_@_pannous_._info
 * 
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 * 
 *       http://www.apache.org/licenses/LICENSE-2.0
 * 
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

import org.jsoup.nodes.Element;

public class Main {
    public static String getSrcOrRelFromImageElement(Element imgElm) {
        if (imgElm.hasAttr("src"))
            return imgElm.attr("src");
        return imgElm.attr("rel");
    }
}

Related

  1. getMoney(final Element container)
  2. getNameFromAttributes(org.jsoup.nodes.Element e)
  3. getOneSubItemOfClass(Element parent, String className)
  4. getReviewAuthorIDFromMultipleSelect(Element doc, String location, String locationValue)
  5. getSingleElement(final Elements elements)
  6. getString(Elements td, int i)
  7. getTextContent(Element node)
  8. getTextFromAClass(Element doc, String location)
  9. getTextFromMultipleSelect(Element doc, String location, String locationValue)