Hi Stefan,
I've used XMLBeans to work with RSS feeds before. It was incredibly easy.
In case you are unfamiliar with XMLBeans this link might help and
anywhere you see PurchaseOrderDocument think RssDocument,
http://xmlbeans.apache.org/documentation/tutorial_getstarted.html .
The easiest way to go about working with other XML Technologies is to
find the schema the defines the xml markup. With RSS there are several
versions and a google search often leads to a schema for one of them.
My guess is GeoRSS has a similar schema.
If you cannot find a schema, you can get started by creating one from
an xml instance using the inst2xsd tool from the xmlbeans bin
directory.
Once you've compiled the schema, you know have a type system for
working with the values, types, and elements that had been defined.
So in answer to your questions:
Are there already compiled XmlBeans for RSS-Feeds?
XMLBeans does not provide you with already compiled xmlbeans, instead
it allows you to create types for anything you would need.
And whats with GeoRSS?
I don't see any reason why it wouldn't work. If you have any issues,
please do let the list know.
How do I process these type of feeds with XmlBeans?
See the getting started link above. In most cases its as simple as,
scomp <your_schema>.xsd
Then in your Java class
public void foo(){
YourType yo = YourType.Factory.parse(<yourinstance>);
// -or-
YourType yo - YourType.Factory.newInstance();
yo.setSomeValue(baz);
}
How can I create a XmlBean which can parse simple RSS-Feeds and also
GeoRSS-Feeds
Just run scomp over the schemas and your have a type system for each
(see link above).
and how can I distinguish if a feed is a normal RSS-Feed or
a GeoRSS-Feed?
I'm not sure of the differences between the two feed, but there is no
reason this should not be possible. Its simply a matter of determining
the difference and selecting based on that. For example, if I have two
xml instances that differ and I want to tell the difference I might
use something like below.
XMLType1 -> corresponds to ->BazDocument
<baz>a</baz>
XmlType2 -> corresponds to ->FooDocument
<foo>foo</foo>
String myXMLInstance = "<baz>abc</baz>";
BazDocument ba;
FooDocument foo;
XmlObject xo = XmlObject.Factory.parse(myXmlInstance);
//use simple xpath to see which element is present
XmlObject[] baArr = xo.execQuery("//baz");
XmlObject[] fooArr = xo.execQuery("//foo");
//if we found element <baz />
if(baArr.length ==0)
ba = (BazDocument)xo;
//found element <foo />
if(fooArr.length == 0)
foo = FooDocument.Factory.parse(xo.xmlText());
naturally there are many more ways you could do this, and the code
could be a lot cleaner, but I thought this was a simple enough example
to scan in email.
So take a look at the tutorial, and then give your scenario with rss
and geoRss a try. If you have any problems, please do let the list
know.
Thanks,
-jacobd
On 3/16/07, Stefan Offermann <[EMAIL PROTECTED]> wrote:
Peter Neu schrieb:
> I might need to process also GML in the future for mapping stuff. Is
> XMLBeans the right tool for this job?
I want to join with my question:
Are there already compiled XmlBeans for RSS-Feeds?
And whats with GeoRSS?
How do I process these type of feeds with XmlBeans?
How can I create a XmlBean which can parse simple RSS-Feeds and also
GeoRSS-Feeds and how can I distinguish if a feed is a normal RSS-Feed or
a GeoRSS-Feed?
best regards, Stefan
--
Stefan Offermann
Institut für Geoinformatik
Westfälische Wilhelms-Universität
Robert-Koch-Str. 26-28
D-48149 Münster
Fon: +49 (0)251 83-31961
Mail: [EMAIL PROTECTED]
Web: http://www.ifgi.de
http://ifgi.uni-muenster.de/~offermann/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]