return (parentlang == null && lang != null) || (lang != null && parentlang != null && !parentlang
.equalsIgnoreCase(lang));
}
private static boolean needToWriteDir(Element element) {
Direction parentdir = Direction.UNSPECIFIED;
Direction dir = BidiHelper.getDirection(element);
if (element.getParentElement() != null) {
Base parent = element.getParentElement();
if (parent instanceof Element)
parentdir = BidiHelper.getDirection((Element)parent);
}
return dir != Direction.UNSPECIFIED && !dir.equals(parentdir);
}