Here you can find the source of findElementUp(String name, Element start)
public static Element findElementUp(String name, Element start)
//package com.java2s; /*/* w ww . j a va2 s . c o m*/ * This file is part of the Scriba source distribution. This is free, open-source * software. For full licensing information, please see the LicensingInformation file * at the root level of the distribution. * * Copyright (c) 2006-2007 Kobrix Software, Inc. */ import javax.swing.text.Element; public class Main { public static Element findElementUp(String name, Element start) { Element elem = start; while ((elem != null) && (!elem.getName().equalsIgnoreCase(name))) { elem = elem.getParentElement(); } return elem; } }