crafterjuli

CustomContentHandler

Jun 6th, 2015
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. package juliandrees;
  2.  
  3. import org.xml.sax.Attributes;
  4. import org.xml.sax.ContentHandler;
  5. import org.xml.sax.Locator;
  6. import org.xml.sax.SAXException;
  7.  
  8. public class CustomContentHandler implements ContentHandler {
  9.  
  10. @Override
  11. public void characters(char[] ch, int start, int length)
  12. throws SAXException {
  13.  
  14.  
  15. }
  16.  
  17. @Override
  18. public void endDocument() throws SAXException {
  19.  
  20.  
  21. }
  22.  
  23. @Override
  24. public void endElement(String uri, String localName, String qName)
  25. throws SAXException {
  26.  
  27.  
  28. }
  29.  
  30. @Override
  31. public void endPrefixMapping(String prefix) throws SAXException {
  32.  
  33.  
  34. }
  35.  
  36. @Override
  37. public void ignorableWhitespace(char[] ch, int start, int length)
  38. throws SAXException {
  39.  
  40.  
  41. }
  42.  
  43. @Override
  44. public void processingInstruction(String target, String data)
  45. throws SAXException {
  46.  
  47.  
  48. }
  49.  
  50. @Override
  51. public void setDocumentLocator(Locator locator) {
  52.  
  53.  
  54. }
  55.  
  56. @Override
  57. public void skippedEntity(String name) throws SAXException {
  58.  
  59.  
  60. }
  61.  
  62. @Override
  63. public void startDocument() throws SAXException {
  64.  
  65.  
  66. }
  67.  
  68. @Override
  69. public void startElement(String uri, String localName, String qName,
  70. Attributes atts) throws SAXException {
  71.  
  72. if (localName.equalsIgnoreCase("statistics")) {
  73. YoutubeStats.subCount = Integer.parseInt(atts.getValue("subscriberCount"));
  74. YoutubeStats.viewCount = Integer.parseInt(atts.getValue("totalUploadViews"));
  75. }
  76. }
  77.  
  78. @Override
  79. public void startPrefixMapping(String prefix, String uri)
  80. throws SAXException {
  81.  
  82.  
  83. }
  84.  
  85. }
Advertisement
Add Comment
Please, Sign In to add comment