this.prevStartTime = null;\r
}\r
}\r
+ \r
+ class DescStatus {\r
+ String inhoud;\r
+ String alginhoud;\r
+ String tt_inhoud;\r
+ }\r
\r
public RTL(int sourceId, Config config) {\r
super(sourceId, config);\r
System.out.println("Unknown attributes for RTL detail root node");\r
}\r
NodeList nodes = root.getChildNodes();\r
- for( int i=0; i<nodes.getLength(); i++) {\r
+ DescStatus descStatus = new DescStatus();\r
+ for(int i=0; i<nodes.getLength(); i++) {\r
Node n = nodes.item(i);\r
if (!n.getNodeName().equals("uitzending_data_item")) {\r
System.out.println("Ignoring RTL detail, tag " + n.getNodeName() +", full xml:");\r
String value = "\"" + sub.getTextContent().replaceAll("\\s", " ") + "\"";\r
result[index] = value;\r
}\r
- handleNode(prog, dateStatus, subnodes.item(j));\r
+ handleNode(prog, dateStatus, descStatus, subnodes.item(j));\r
} catch (RTLException e) {\r
System.out.println(e.getMessage());\r
Transformer t = TransformerFactory.newInstance().newTransformer();\r
debugWriter.println();\r
}\r
}\r
+ StringBuilder description = new StringBuilder();\r
+ if (descStatus.alginhoud!=null) {\r
+ description.append(descStatus.alginhoud);\r
+ //System.out.print("A");\r
+ }\r
+ if (descStatus.inhoud!=null) {\r
+ if (description.length()!=0) {\r
+ description.append("<p>");\r
+ //System.out.print("n");\r
+ //System.out.println("Date: "+prog.startTime + "; title: "+ prog.getFirstTitle());\r
+ }\r
+ description.append(descStatus.inhoud);\r
+ //System.out.print("B");\r
+ }\r
+ if (description.length()==0 && descStatus.tt_inhoud!=null) {\r
+ description.append(descStatus.tt_inhoud);\r
+ //System.out.print("C");\r
+ //System.out.println("Date: "+prog.startTime + "; title: "+ prog.getFirstTitle());\r
+ }\r
+ // ignore tt_inhoud since it is almost always a summary of the above and other fields\r
+ prog.addDescription(description.toString());\r
}\r
\r
\r
- private void handleNode(Programme prog, DateStatus dateStatus, Node n) throws RTLException, DOMException, SQLException {\r
+ private void handleNode(Programme prog, DateStatus dateStatus, DescStatus descStatus, Node n) throws RTLException, DOMException, SQLException {\r
if (n.getNodeType() != Node.ELEMENT_NODE) {\r
throw new RTLException("Ignoring non-element node " + n.getNodeName());\r
}\r
} else if (tag.equals("wwwadres")) {\r
prog.addUrl(e.getTextContent());\r
} else if (tag.equals("alginhoud")) {\r
- prog.addDescription(e.getTextContent());\r
+ descStatus.alginhoud = e.getTextContent();\r
} else if (tag.equals("inhoud")) {\r
- prog.addDescription(e.getTextContent());\r
+ descStatus.inhoud = e.getTextContent();\r
} else if (tag.equals("tt_inhoud")) {\r
- prog.addDescription(e.getTextContent());\r
+ descStatus.tt_inhoud = e.getTextContent();\r
// ignore, is summary of other fields\r
} else if (tag.equals("zendernr")) {\r
} else if (tag.equals("titel")) {\r