K21
02.05.2003, 23:06
hi!
ich möchte mit java von ner page 3 zeilen ziehen...
(sorry für diese überlänge:)
<DIV CLASS="SSLHEADLINE">now on air</DIV><TABLE><TR><TD NOWRAP VALIGN=TOP><SPAN CLASS=PROGRAMHL>aktuelle zeit:</TD><TD><SPAN CLASS=PROGRAMHL> 22:41</SPAN></TD></TR><TR><TD><SPAN CLASS=PROGRAMHL>headline:</SPAN></TD><TD><SPAN CLASS=PROGRAMHL>special</SPAN></TD></TR><TR><TD><SPAN CLASS=PROGRAMHL>title:</SPAN></TD><TD><SPAN CLASS=PROGRAMHL>friday de luxe melomania</SPAN></TD></TR><TR><TD VALIGN=TOP><SPAN CLASS=PROGRAMHL>content:</SPAN></TD><TD><SPAN CLASS=PROGRAMHL>dj shah, pedro del mar & martin eyerer and guests in the mix</TD></TR></TABLE> </TD>
das ist die zeile (quelle: http://www.sunshine-live.de/core/index.php3? )
nunja... das ganze soll unter java stattfinden und ich möchte folgende zeilen haben:
headline:
title:
content:
headline bekomme ich auf folgende weise:
Pattern textPattern = Pattern.compile (".*headline:</span></td><td><span CLASS=PROGRAMHL>.*[^[title]]</SPAN>", Pattern.CASE_INSENSITIVE);
Pattern textprefixPattern = Pattern.compile(".*PROGRAMHL>", Pattern.CASE_INSENSITIVE);
Pattern textsuffixPattern = Pattern.compile("</SPAN>", Pattern.CASE_INSENSITIVE);
die erste zeile gibt die "spanne" an, von wo bis wo geguckt werden soll.
die zweite zeile ist der begrenzer am anfang und die dritte zeile am ende.. alles was dazwischen liegt wird angezeigt.
ich habe aber echt null plan wie ich jetzt title und content rausbekomme (bzw. für content habe ich einen ausdruck gefunden der für mich überraschend funktioniert:
Pattern titlePattern = Pattern.compile (".*PROGRAMHL>title:</span></td><td><span CLASS=PROGRAMHL>.*[^<]", Pattern.CASE_INSENSITIVE);
Pattern titleprefixPattern = Pattern.compile(".*PROGRAMHL>", Pattern.CASE_INSENSITIVE);
Pattern titlesuffixPattern = Pattern.compile("<", Pattern.CASE_INSENSITIVE);
tja aber für title fällt mir nichts ein.. über hilfe wäre ich dankbar!
ich möchte mit java von ner page 3 zeilen ziehen...
(sorry für diese überlänge:)
<DIV CLASS="SSLHEADLINE">now on air</DIV><TABLE><TR><TD NOWRAP VALIGN=TOP><SPAN CLASS=PROGRAMHL>aktuelle zeit:</TD><TD><SPAN CLASS=PROGRAMHL> 22:41</SPAN></TD></TR><TR><TD><SPAN CLASS=PROGRAMHL>headline:</SPAN></TD><TD><SPAN CLASS=PROGRAMHL>special</SPAN></TD></TR><TR><TD><SPAN CLASS=PROGRAMHL>title:</SPAN></TD><TD><SPAN CLASS=PROGRAMHL>friday de luxe melomania</SPAN></TD></TR><TR><TD VALIGN=TOP><SPAN CLASS=PROGRAMHL>content:</SPAN></TD><TD><SPAN CLASS=PROGRAMHL>dj shah, pedro del mar & martin eyerer and guests in the mix</TD></TR></TABLE> </TD>
das ist die zeile (quelle: http://www.sunshine-live.de/core/index.php3? )
nunja... das ganze soll unter java stattfinden und ich möchte folgende zeilen haben:
headline:
title:
content:
headline bekomme ich auf folgende weise:
Pattern textPattern = Pattern.compile (".*headline:</span></td><td><span CLASS=PROGRAMHL>.*[^[title]]</SPAN>", Pattern.CASE_INSENSITIVE);
Pattern textprefixPattern = Pattern.compile(".*PROGRAMHL>", Pattern.CASE_INSENSITIVE);
Pattern textsuffixPattern = Pattern.compile("</SPAN>", Pattern.CASE_INSENSITIVE);
die erste zeile gibt die "spanne" an, von wo bis wo geguckt werden soll.
die zweite zeile ist der begrenzer am anfang und die dritte zeile am ende.. alles was dazwischen liegt wird angezeigt.
ich habe aber echt null plan wie ich jetzt title und content rausbekomme (bzw. für content habe ich einen ausdruck gefunden der für mich überraschend funktioniert:
Pattern titlePattern = Pattern.compile (".*PROGRAMHL>title:</span></td><td><span CLASS=PROGRAMHL>.*[^<]", Pattern.CASE_INSENSITIVE);
Pattern titleprefixPattern = Pattern.compile(".*PROGRAMHL>", Pattern.CASE_INSENSITIVE);
Pattern titlesuffixPattern = Pattern.compile("<", Pattern.CASE_INSENSITIVE);
tja aber für title fällt mir nichts ein.. über hilfe wäre ich dankbar!