/src/lib/xml/xml_validator.e

http://github.com/tybor/Liberty · Specman e · 116 lines · 64 code · 14 blank · 38 comment · 0 complexity · fcb1bdae7ec5aa7266f1ad516b06d421 MD5 · raw file

  1. -- See the Copyright notice at the end of this file.
  2. --
  3. deferred class XML_VALIDATOR
  4. --
  5. -- Helps the parser to validate an XML file
  6. --
  7. feature {XML_PARSER}
  8. with_attribute (attribute_name: UNICODE_STRING; attribute_value: UNICODE_STRING; line, column: INTEGER)
  9. -- Called by the parser to add an attribute of a node BEFORE calling `open_node'
  10. require
  11. not attribute_name.is_empty
  12. not attribute_value.is_empty
  13. deferred
  14. end
  15. is_valid_open_node (node_name: UNICODE_STRING; line, column: INTEGER): BOOLEAN
  16. -- When the parser reads an opening node
  17. require
  18. not node_name.is_empty
  19. deferred
  20. end
  21. is_valid_close_node (node_name: UNICODE_STRING; line, column: INTEGER): BOOLEAN
  22. -- When the parser reads a closing node
  23. require
  24. not node_name.is_empty
  25. current_node.is_equal(node_name)
  26. deferred
  27. end
  28. is_valid_open_close_node (node_name: UNICODE_STRING; line, column: INTEGER): BOOLEAN
  29. -- When the parser reads a node that opens and closes immediately (syntax "<node/>")
  30. require
  31. not node_name.is_empty
  32. deferred
  33. end
  34. open_node (node_name: UNICODE_STRING; line, column: INTEGER)
  35. -- When the parser reads an opening node
  36. require
  37. is_valid_open_node(node_name, line, column)
  38. deferred
  39. ensure
  40. current_node.is_equal(node_name)
  41. end
  42. close_node (node_name: UNICODE_STRING; line, column: INTEGER)
  43. -- When the parser reads a closing node
  44. require
  45. is_valid_close_node(node_name, line, column)
  46. deferred
  47. end
  48. open_close_node (node_name: UNICODE_STRING; line, column: INTEGER)
  49. -- When the parser reads a node that opens and closes immediately (syntax "<node/>")
  50. require
  51. is_valid_open_close_node(node_name, line, column)
  52. deferred
  53. end
  54. current_node: UNICODE_STRING
  55. -- The current node
  56. deferred
  57. end
  58. entity (a_entity: UNICODE_STRING; line, column: INTEGER): UNICODE_STRING
  59. -- When the parser reads an '''&entity;'''.
  60. deferred
  61. end
  62. entity_url (a_entity: UNICODE_STRING; line, column: INTEGER): UNICODE_STRING
  63. -- When the parser reads an '''&entity;'''. Returns the entity URL if it is a SYSTEM or PUBLIC entity.
  64. deferred
  65. end
  66. is_valid_data (a_data: UNICODE_STRING; line, column: INTEGER): BOOLEAN
  67. -- Called by the parser when the node contains raw data
  68. require
  69. not a_data.is_empty
  70. deferred
  71. end
  72. data (a_data: UNICODE_STRING; line, column: INTEGER)
  73. -- Called by the parser when the node contains raw data
  74. require
  75. not a_data.is_empty
  76. deferred
  77. end
  78. the_end
  79. -- Called when the xml is totally parsed; usually it is used to recycle memory resources
  80. deferred
  81. end
  82. end -- class XML_VALIDATOR
  83. --
  84. -- Copyright (C) 2009-2017: by all the people cited in the AUTHORS file.
  85. --
  86. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  87. -- of this software and associated documentation files (the "Software"), to deal
  88. -- in the Software without restriction, including without limitation the rights
  89. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  90. -- copies of the Software, and to permit persons to whom the Software is
  91. -- furnished to do so, subject to the following conditions:
  92. --
  93. -- The above copyright notice and this permission notice shall be included in
  94. -- all copies or substantial portions of the Software.
  95. --
  96. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  97. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  98. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  99. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  100. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  101. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  102. -- THE SOFTWARE.