Exemplo n.º 1
0
  public Element importDetails(Element from, boolean move) {
    if (from == null) return this;

    if (!from.getNameSpace().isEmpty()) setNameSpace(from.getNameSpace());

    if (from.getElementFile() != null) setElementFile(from.getElementFile());
    if (from.getElementLine() >= 0) setElementLine(from.getElementLine());
    if (from.getCommentBefore() != null) addToCommentBefore(from.getCommentBefore());
    if (from.getCommentAfter() != null) setCommentAfter(from.getCommentAfter());

    if (move) from.stripDetails();
    return this;
  }
 public String resolveFile(Element e) {
   String file = null;
   while (e != null && (file = e.getElementFile()) == null) {
     e = e.getParentElement();
   }
   return file;
 }
Exemplo n.º 3
0
 public static String getFileOfAscendency(Element decl) {
   Element e = decl;
   String file = null;
   Set<Integer> visitedIds = new TreeSet<Integer>();
   while (e != null && (file = e.getElementFile()) == null && visitedIds.add(e.getId())) {
     e = e.getParentElement();
   }
   return file;
 }