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

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