1 19 20 package org.netbeans.tax.dom; 21 22 import org.w3c.dom.*; 23 import org.netbeans.tax.*; 24 25 30 class Children { 31 32 public static Node getNextSibling(TreeChild child) { 33 TreeChild sibling = child.getNextSibling(); 34 35 while (sibling != null) { 36 if (sibling instanceof TreeElement) { 37 return Wrapper.wrap((TreeElement) sibling); 38 } else if (sibling instanceof TreeText) { 39 return Wrapper.wrap((TreeText) sibling); 40 } 41 sibling = sibling.getNextSibling(); 42 } 43 return null; 44 } 45 46 public static Node getPreviousSibling(TreeChild child) { 47 TreeChild sibling = child.getPreviousSibling(); 48 49 while (sibling != null) { 50 if (sibling instanceof TreeElement) { 51 return Wrapper.wrap((TreeElement) sibling); 52 } else if (sibling instanceof TreeText) { 53 return Wrapper.wrap((TreeText) sibling); 54 } 55 sibling = sibling.getPreviousSibling(); 56 } 57 return null; 58 } 59 60 } 61 | Popular Tags |