PageRenderTime 7ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/src/lib/xml/namespaces/xmlns_validator.e

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