|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.abdera.ext.bidi.BidiHelper
public final class BidiHelper
This is (hopefully) temporary. Ideally, this would be wrapped into the core model API so that the bidi stuff is handled seamlessly. There are still details being worked out on the Atom WG list and it's likely that at least one other impl (mozilla) will do something slightly different.
Based on http://www.ietf.org/internet-drafts/draft-snell-atompub-bidi-02.txt
Example:
<feed xmlns="http://www.w3.org/2005/Atom" dir="rtl"> ... </feed>
The getBidi___ elements use the in-scope direction to wrap the text with the appropriate Unicode control characters. e.g. if dir="rtl", the text is wrapped with the RLE and PDF controls. If the text already contains the control chars, the dir attribute is ignored.
org.apache.abdera.Abdera abdera = new org.apache.abdera.Abdera(); org.apache.abdera.model.Feed feed = abdera.getFactory().newFeed(); feed.setAttributeValue("dir", "rtl"); feed.setTitle("Testing"); feed.addCategory("foo"); System.out.println( BidiHelper.getBidiElementText( feed.getTitleElement())); System.out.println( BidiHelper.getBidiAttributeValue( feed.getCategories().get(0),"term"));
Nested Class Summary | |
---|---|
static class |
BidiHelper.Direction
|
Method Summary | ||
---|---|---|
static
|
getBidiAttributeValue(T element,
javax.xml.namespace.QName name)
Return the text content of the specified attribute using the in-scope directionality |
|
static
|
getBidiAttributeValue(T element,
java.lang.String name)
Return the text content of the specified attribute using the in-scope directionality |
|
static
|
getBidiChildText(T element,
javax.xml.namespace.QName child)
Return the textual content of a child element using the in-scope directionality |
|
static
|
getBidiElementText(T element)
Return the textual content of the specified element |
|
static java.lang.String |
getBidiText(BidiHelper.Direction direction,
java.lang.String text)
Return the specified text with appropriate Unicode Control Characters given the specified Direction. |
|
static
|
getDirection(T element)
Get the in-scope direction for an element. |
|
static
|
setDirection(BidiHelper.Direction direction,
T element)
Set the value of dir attribute |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <T extends Element> void setDirection(BidiHelper.Direction direction, T element)
public static <T extends Element> BidiHelper.Direction getDirection(T element)
public static java.lang.String getBidiText(BidiHelper.Direction direction, java.lang.String text)
direction
- The Directionality of the texttext
- The text to wrap within Unicode Control Characters
public static <T extends Element> java.lang.String getBidiChildText(T element, javax.xml.namespace.QName child)
element
- The parent elementchild
- The XML QName of the child element
public static <T extends Element> java.lang.String getBidiElementText(T element)
element
- An element containing directionally-sensitive text
public static <T extends Element> java.lang.String getBidiAttributeValue(T element, java.lang.String name)
element
- The parent elementname
- the name of the attribute
public static <T extends Element> java.lang.String getBidiAttributeValue(T element, javax.xml.namespace.QName name)
element
- The parent elementname
- the name of the attribute
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |