Java Reference
In-Depth Information
1. The first step is to create a new
Entry
class in order to gain access to the processing
of the
title
node:
class SimpleTitleEntry
extends Entry
{
public override function fromXML(parser:PullParser):Void {
if(parser.event.qname == TITLE and
parser.event.type == parser.TEXT) {
title = parser.event.text.replaceAll(
"<[a-zA-Z\/][^>]*>", "");
}else{
super.fromXML(parser);
}
}
}
2. Next, define a new
Factory
class, which will be responsible for building instances of
the
SimpleTitleEntry
class during parsing:
class SimpleTitleFactory
extends Factory
{
public override function newEntry(feed:Feed):Void {
SimpleTitleEntry {feed: feed}
}
}
3. Once your factory is defined, add it to your
FeedTask
instance as such:
var atom =
AtomTask
{
location: "http://youratomlocation.com/file.atom"
factory
: SimpleTitleFactory{}
...
}
When the instance of
AtomTask
parses your document, it will automatically scrub the title of
any extraneous HTML.
Refer to
http://en.wikipedia.org/wiki/Web_feed
for further information on
web feeds.
See also
F
Chapter 4—Creating a form with JavaFX controls
F
Accessing remote data with HttpRequest
F
Downloading images with HttpRequest
F
Building RESTful clients with the PullParser API


