/src/lib/xml/namespaces/xmlns_callbacks.e

http://github.com/tybor/Liberty · Specman e · 130 lines · 71 code · 15 blank · 44 comment · 1 complexity · 208611ab34ec4966bd263d57aef9fbf3 MD5 · raw file

  1. -- See the Copyright notice at the end of this file.
  2. --
  3. deferred class XMLNS_CALLBACKS
  4. --
  5. -- This class fulfills the same role as XML_CALLBACKS, but using namespace differentiation.
  6. --
  7. feature {XMLNS_PARSER}
  8. set_validator (a_validator: like validator)
  9. -- Sets a validator for this XML file.
  10. require
  11. validator = Void
  12. a_validator /= Void
  13. do
  14. validator := a_validator
  15. ensure
  16. validator = a_validator
  17. end
  18. validator: XMLNS_VALIDATOR
  19. -- The XML validator for this file (usually an XML Schema)
  20. with_attribute (attribute_namespace, attribute_name, attribute_value: UNICODE_STRING; line, column: INTEGER)
  21. -- Called by the parser to add an attribute of a node BEFORE calling `open_node'
  22. require
  23. not attribute_name.is_empty
  24. attribute_value /= Void
  25. deferred
  26. end
  27. open_node (node_namespace, node_name: UNICODE_STRING; line, column: INTEGER)
  28. -- When the parser reads an opening node
  29. require
  30. not node_name.is_empty
  31. deferred
  32. ensure
  33. not at_error implies current_node.is_equal(node_name)
  34. not at_error implies (current_namespace = node_namespace or else (node_namespace /= Void and then current_namespace /= Void
  35. and then current_namespace.is_equal(node_namespace)))
  36. end
  37. close_node (node_namespace, node_name: UNICODE_STRING; line, column: INTEGER)
  38. -- When the parser reads a closing node
  39. require
  40. not node_name.is_empty
  41. current_node.is_equal(node_name)
  42. node_namespace = Void implies current_namespace = Void
  43. node_namespace /= Void implies current_namespace.is_equal(node_namespace)
  44. deferred
  45. end
  46. open_close_node (node_namespace, node_name: UNICODE_STRING; line, column: INTEGER)
  47. -- When the parser reads a node that opens and closes immediately (syntax "<node/>")
  48. require
  49. not node_name.is_empty
  50. deferred
  51. end
  52. xml_header (line, column: INTEGER)
  53. -- Called by the parser if a "<?xml ... ?>" header is read.
  54. -- Note that with_attribute may have been called first (usually with the version and encoding
  55. -- attributes)
  56. deferred
  57. end
  58. processing_instruction (a_target, a_data: UNICODE_STRING)
  59. -- Called by the parser if a "<?...?>" processing instruction is read.
  60. deferred
  61. end
  62. entity (a_entity: UNICODE_STRING; line, column: INTEGER): UNICODE_STRING
  63. -- Called by the parser when an '''&entity;''' is found. Note that standard XML attributes (''lt'',
  64. -- ''gt'', ''amp'', ''apos'' and ''quot'') are automatically handled and not given to this feature
  65. -- (they cannot be bypassed).
  66. -- Returns Void if the entity is not recognized.
  67. deferred
  68. end
  69. current_node: UNICODE_STRING
  70. -- The current node
  71. deferred
  72. end
  73. current_namespace: UNICODE_STRING
  74. -- The current namespace
  75. deferred
  76. end
  77. data (a_data: UNICODE_STRING; line, column: INTEGER)
  78. -- Called by the parser when the node contains raw data
  79. require
  80. not a_data.is_empty
  81. deferred
  82. end
  83. parse_error (line, column: INTEGER; message: STRING)
  84. -- Called by the parser if there is an error
  85. require
  86. message /= Void
  87. deferred
  88. ensure
  89. at_error
  90. end
  91. at_error: BOOLEAN
  92. -- True if there was at least an error
  93. deferred
  94. end
  95. end -- class XMLNS_CALLBACKS
  96. --
  97. -- Copyright (C) 2009-2017: by all the people cited in the AUTHORS file.
  98. --
  99. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  100. -- of this software and associated documentation files (the "Software"), to deal
  101. -- in the Software without restriction, including without limitation the rights
  102. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  103. -- copies of the Software, and to permit persons to whom the Software is
  104. -- furnished to do so, subject to the following conditions:
  105. --
  106. -- The above copyright notice and this permission notice shall be included in
  107. -- all copies or substantial portions of the Software.
  108. --
  109. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  110. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  111. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  112. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  113. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  114. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  115. -- THE SOFTWARE.