Methods Summary |
---|
public void | characters(char[] buf, int off, int len)
String top = getCurrentElementName ();
String value = new String (buf, off, len);
if ("title".equals (top)) {
if (item != null)
item.title += value;
else if (image != null)
image.title += value;
else if (input != null)
input.title += value;
else
channel.title += value;
} else if ("description".equals (top)) {
if (item != null)
item.description += value;
else if (image != null)
image.description += value;
else if (input != null)
input.description += value;
else
channel.description += value;
} else if ("link".equals (top)) {
if (item != null)
item.link += value;
else if (image != null)
image.link += value;
else if (input != null)
input.link += value;
else
channel.link += value;
} else if ("url".equals (top)) {
image.url += value;
} else if ("name".equals (top)) {
input.name += value;
} else if ("language".equals (top)) {
channel.language += value;
} else if ("managingEditor".equals (top)) {
channel.managingEditor += value;
} else if ("webMaster".equals (top)) {
channel.webMaster += value;
} else if ("copyright".equals (top)) {
channel.copyright += value;
} else if ("lastBuildDate".equals (top)) {
channel.lastBuildDate += value;
} else if ("pubDate".equals (top)) {
channel.pubDate += value;
} else if ("docs".equals (top)) {
channel.docs += value;
} else if ("rating".equals (top)) {
channel.rating += value;
} // else ignore ... skipDays and so on.
|
public void | endElement(java.lang.String namespace, java.lang.String local, java.lang.String name)
if ("item".equals (name)) {
// patch item.link
channel.items.addElement (item);
item = null;
} else if ("image".equals (name)) {
// patch image.link
// (patch image.url)
channel.image = image;
image = null;
} else if ("textinput".equals (name)) {
// patch input.link
channel.textinput = input;
input = null;
} else if ("channel".equals (name)) {
// patch channel.link
}
|
public RssChannel | getChannel() return channel;
|
private java.lang.String | getCurrentElementName() return (String) stack.peek ();
|
public void | setDocumentLocator(org.xml.sax.Locator l) locator = l;
|
public void | startDocument()
channel = new RssChannel ();
if (locator != null)
channel.sourceUri = locator.getSystemId ();
stack = new Stack ();
|
public void | startElement(java.lang.String namespace, java.lang.String local, java.lang.String name, org.xml.sax.Attributes attrs)
stack.push (name);
if ("item".equals (name))
item = new RssItem ();
else if ("image".equals (name))
image = new RssImage ();
else if ("textinput".equals (name))
input = new RssTextInput ();
// parser misconfigured?
else if (name.length () == 0)
throw new SAXParseException ("XML names not available", locator);
|