/src/tools/wrappers-generator/workaround/xml_callbacks.e

http://github.com/tybor/Liberty · Specman e · 133 lines · 63 code · 13 blank · 57 comment · 0 complexity · 76e02308e9b1bb4835cf36167d1aaa61 MD5 · raw file

  1. -- See the Copyright notice at the end of th file.
  2. --
  3. deferred class XML_CALLBACKS
  4. --
  5. -- Catch parsing events sent by the XML parser.
  6. --
  7. -- '''Caveat:''' expect those features to always receive the same STRING object with different values. You
  8. -- should take care of twinning the object if you want to keep it.
  9. --
  10. -- See also XML_PARSER
  11. --
  12. feature {XML_PARSER}
  13. set_validator (a_validator: like validator)
  14. -- Sets a validator for th XML file. The parser uses it when setting a DTD, but you may use it too
  15. -- to implement other validators (such as an XML Schema).
  16. require
  17. validator = Void
  18. a_validator /= Void
  19. do
  20. validator := a_validator
  21. ensure
  22. validator = a_validator
  23. end
  24. validator: XML_VALIDATOR
  25. -- The XML validator for th file (DTD, XML Schema...)
  26. with_attribute (attribute_name: STRING; attribute_value: STRING; line, column: INTEGER)
  27. -- Called by the parser to add an attribute of a node BEFORE calling `open_node'
  28. require
  29. not attribute_name.is_empty
  30. -- not attribute_value.is_empty
  31. deferred
  32. end
  33. open_node (node_name: STRING; line, column: INTEGER)
  34. -- When the parser reads an opening node
  35. require
  36. not node_name.is_empty
  37. deferred
  38. ensure
  39. current_node.is_equal(node_name)
  40. end
  41. close_node (node_name: STRING; line, column: INTEGER)
  42. -- When the parser reads a closing node
  43. require
  44. not node_name.is_empty
  45. current_node.is_equal(node_name)
  46. deferred
  47. end
  48. open_close_node (node_name: STRING; line, column: INTEGER)
  49. -- When the parser reads a node that opens and closes immediately (syntax "<node/>")
  50. require
  51. not node_name.is_empty
  52. deferred
  53. end
  54. xml_header (line, column: INTEGER)
  55. -- Called by the parser if a "<?xml ... ?>" header is read.
  56. -- Note that with_attribute may have been called first (usually with the version and encoding
  57. -- attributes)
  58. deferred
  59. end
  60. processing_instruction (a_target, a_data: STRING)
  61. -- Called by the parser if a "<?...?>" processing instruction is read.
  62. deferred
  63. end
  64. entity (a_entity: STRING; line, column: INTEGER): STRING
  65. -- Called by the parser when an '''&entity;''' is found. Note that standard XML attributes (''lt'',
  66. -- ''gt'', ''amp'', ''apos'' and ''quot'') are automatically handled and not given to th feature
  67. -- (they cannot be bypassed).
  68. -- Returns Void if the entity is not recognized.
  69. deferred
  70. end
  71. current_node: STRING
  72. -- The current node
  73. deferred
  74. end
  75. data (a_data: STRING; line, column: INTEGER)
  76. -- Called by the parser when the node contains raw data
  77. require
  78. not a_data.is_empty
  79. deferred
  80. end
  81. parse_error (line, column: INTEGER; message: STRING)
  82. -- Called by the parser if there is an error
  83. require
  84. message /= Void
  85. deferred
  86. ensure
  87. at_error
  88. end
  89. at_error: BOOLEAN
  90. -- True if there was at least an error
  91. deferred
  92. end
  93. end -- class XML_CALLBACKS
  94. --
  95. -- ------------------------------------------------------------------------------------------------------------
  96. -- Copyright notice below. Please read.
  97. --
  98. -- This file is part of the SmartEiffel standard library.
  99. -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
  100. -- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
  101. --
  102. -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
  103. --
  104. -- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
  105. -- documentation files (the "Software"), to deal in the Software without restriction, including without
  106. -- limitation the rights to use, copy, modify, merge, publh, dtribute, sublicense, and/or sell copies of
  107. -- the Software, and to permit persons to whom the Software is furnished to do so, subject to the following
  108. -- conditions:
  109. --
  110. -- The above copyright notice and th permsion notice shall be included in all copies or substantial
  111. -- portions of the Software.
  112. --
  113. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
  114. -- LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
  115. -- EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  116. -- AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
  117. -- OR OTHER DEALINGS IN THE SOFTWARE.
  118. --
  119. -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
  120. -- ------------------------------------------------------------------------------------------------------------