PageRenderTime 47ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/bundles/plugins-trunk/XML/xml/parser/javacc/XmlVisitor.java

#
Java | 76 lines | 42 code | 15 blank | 19 comment | 7 complexity | 175f91f1b698c770a4fd23d108e8c901 MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
  1. /*
  2. * HtmlVisitor.java
  3. * Copyright (C) 1999 Quiotix Corporation.
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License, version 2, as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License (http://www.gnu.org/copyleft/gpl.txt)
  13. * for more details.
  14. */
  15. package xml.parser.javacc;
  16. import java.util.Iterator;
  17. /**
  18. * Abstract class implementing Visitor pattern for XmlDocument objects.
  19. *
  20. * @author Brian Goetz, Quiotix
  21. */
  22. public abstract class XmlVisitor {
  23. public void visit(XmlDocument.Tag t) {
  24. }
  25. public void visit(XmlDocument.EndTag t) {
  26. }
  27. public void visit(XmlDocument.Comment c) {
  28. }
  29. public void visit(XmlDocument.Text t) {
  30. }
  31. public void visit(XmlDocument.Newline n) {
  32. }
  33. public void visit(XmlDocument.Annotation a) {
  34. }
  35. public void visit(XmlDocument.TagBlock bl) {
  36. if (bl == null)
  37. return;
  38. bl.startTag.accept(this);
  39. visit(bl.body);
  40. bl.endTag.accept(this);
  41. }
  42. public void visit(XmlDocument.ElementSequence s) {
  43. if (s == null)
  44. return;
  45. for (Iterator iterator = s.iterator(); iterator.hasNext();) {
  46. XmlDocument.XmlElement htmlElement = (XmlDocument.XmlElement) iterator.next();
  47. htmlElement.accept(this);
  48. }
  49. }
  50. public void visit(XmlDocument d) {
  51. if (d == null)
  52. return;
  53. start();
  54. visit(d.elements);
  55. finish();
  56. }
  57. public void start() {
  58. }
  59. public void finish() {
  60. }
  61. }