Revision: 5939
http://gobo-eiffel.svn.sourceforge.net/gobo-eiffel/?rev=5939&view=rev
Author: ericb
Date: 2007-04-04 10:08:40 -0700 (Wed, 04 Apr 2007)
Log Message:
-----------
Added missing header comments.
Modified Paths:
--------------
gobo/trunk/library/lexical/regexp/lx_regexp_parser.y
gobo/trunk/library/lexical/regexp/lx_wildcard_parser.y
gobo/trunk/library/parse/generation/pr_parser_generator.e
gobo/trunk/library/xml/parser/eiffel/xm_eiffel_parser_skeleton.e
gobo/trunk/library/xml/resolver/catalog/xm_string_uri_resolver.e
gobo/trunk/library/xml/resolver/uri/xm_file_uri_resolver.e
gobo/trunk/library/xml/xpath/data_model/xm_xpath_name_pool.e
gobo/trunk/src/gepp/gepp_parser.y
gobo/trunk/test/kernel/uc_test_utf16_routines.e
gobo/trunk/test/xml/eiffel/xm_declaration_filter.e
gobo/trunk/test/xml/eiffel/xm_no_namespace_checker.e
gobo/trunk/test/xml/eiffel/xm_test_dtd.e
gobo/trunk/test/xml/eiffel/xm_test_latin1.e
gobo/trunk/test/xml/eiffel/xm_test_stop_filter.e
gobo/trunk/test/xml/general/test_string_external_resolver.e
gobo/trunk/test/xml/general/xm_test_namespace_jclark.e
gobo/trunk/test/xml/general/xm_test_simple_resolver.e
gobo/trunk/test/xml/general/xm_test_tree.e
gobo/trunk/test/xml/xpath/xm_xpath_test_builder.e
gobo/trunk/test/xml/xpath/xm_xpath_test_system_ids.e
gobo/trunk/test/xml/xpath/xm_xpath_test_tiny_builder.e
gobo/trunk/test/xml/xslt/xm_xslt_test_fragments.e
Modified: gobo/trunk/library/lexical/regexp/lx_regexp_parser.y
===================================================================
--- gobo/trunk/library/lexical/regexp/lx_regexp_parser.y 2007-04-03 16:45:56 UTC (rev 5938)
+++ gobo/trunk/library/lexical/regexp/lx_regexp_parser.y 2007-04-04 17:08:40 UTC (rev 5939)
@@ -33,7 +33,6 @@
make, make_from_description
-feature
%}
%token <INTEGER> CHAR NUMBER
Modified: gobo/trunk/library/lexical/regexp/lx_wildcard_parser.y
===================================================================
--- gobo/trunk/library/lexical/regexp/lx_wildcard_parser.y 2007-04-03 16:45:56 UTC (rev 5938)
+++ gobo/trunk/library/lexical/regexp/lx_wildcard_parser.y 2007-04-04 17:08:40 UTC (rev 5939)
@@ -33,7 +33,6 @@
make, make_from_description
-feature
%}
%token STAR_STAR_SLASH STAR_PAREN
Modified: gobo/trunk/library/parse/generation/pr_parser_generator.e
===================================================================
--- gobo/trunk/library/parse/generation/pr_parser_generator.e 2007-04-03 16:45:56 UTC (rev 5938)
+++ gobo/trunk/library/parse/generation/pr_parser_generator.e 2007-04-04 17:08:40 UTC (rev 5939)
@@ -5,7 +5,7 @@
"Parser generators"
library: "Gobo Eiffel Parse Library"
- copyright: "Copyright (c) 1999-2004, Eric Bezault and others"
+ copyright: "Copyright (c) 1999-2007, Eric Bezault and others"
license: "MIT License"
date: "$Date$"
revision: "$Revision$"
@@ -17,6 +17,7 @@
PR_PARSER_ENGINE
KL_IMPORTED_ARRAY_ROUTINES
+ KL_IMPORTED_STRING_ROUTINES
UT_IMPORTED_FORMATTERS
create
@@ -578,10 +579,21 @@
local
i, j, k, nb: INTEGER
a_table_upper: INTEGER
+ a_name_count: INTEGER
do
a_file.put_character ('%T')
a_file.put_string (a_name)
a_file.put_string (": SPECIAL [INTEGER] is%N")
+ a_file.put_string ("%T%T%T-- ")
+ a_name_count := a_name.count
+ if a_name_count > 9 and then STRING_.same_string (a_name.substring (a_name_count - 8, a_name_count), "_template") then
+ a_file.put_string ("Template for `")
+ a_file.put_string (a_name.substring (1, a_name_count - 9))
+ a_file.put_character ('%'')
+ else
+ a_file.put_string (a_name)
+ end
+ a_file.put_new_line
if array_size = 0 then
nb := 1
else
@@ -619,8 +631,22 @@
a_file.put_string (a_name)
a_file.put_character ('_')
a_file.put_integer (j)
- a_file.put_string (" (an_array: ARRAY [INTEGER]) is%N%
- %%T%Tdo%N%T%T%Tyy_array_subcopy (an_array, <<%N")
+ a_file.put_line (" (an_array: ARRAY [INTEGER]) is")
+ a_file.put_string ("%T%T%T-- ")
+ if a_name_count > 9 and then STRING_.same_string (a_name.substring (a_name_count - 8, a_name_count), "_template") then
+ a_file.put_string ("Fill chunk #")
+ a_file.put_integer (j)
+ a_file.put_string (" of template for `")
+ a_file.put_string (a_name.substring (1, a_name_count - 9))
+ a_file.put_string ("'.")
+ else
+ a_file.put_string (a_name)
+ a_file.put_string (" #")
+ a_file.put_integer (j)
+ a_file.put_character ('.')
+ end
+ a_file.put_new_line
+ a_file.put_line ("%T%Tdo%N%T%T%Tyy_array_subcopy (an_array, <<")
k := a_table_upper.min (i + array_size - 1)
ARRAY_FORMATTER_.put_integer_array (a_file, a_table, i, k)
a_file.put_string (", yyDummy>>,%N%T%T%T")
Modified: gobo/trunk/library/xml/parser/eiffel/xm_eiffel_parser_skeleton.e
===================================================================
--- gobo/trunk/library/xml/parser/eiffel/xm_eiffel_parser_skeleton.e 2007-04-03 16:45:56 UTC (rev 5938)
+++ gobo/trunk/library/xml/parser/eiffel/xm_eiffel_parser_skeleton.e 2007-04-04 17:08:40 UTC (rev 5939)
@@ -392,7 +392,7 @@
in_error: not is_correct
end
-feature {XM_PARSER_STOP_ON_ERROR_FILTER}
+feature {XM_PARSER_STOP_ON_ERROR_FILTER} -- Error reporting
force_unreported_error (an_error: STRING) is
-- Stop the parser, but do not issue an event error because
@@ -492,8 +492,13 @@
end
One_or_more_repetition: STRING is "+"
+ -- Special symbol: One of more
+
Zero_or_one_repetition: STRING is "?"
+ -- Special symbol: Zero or one
+
Zero_or_more_repetition: STRING is "*"
+ -- Special symbol: Zero or more
element_name (a_name: STRING): XM_DTD_ELEMENT_CONTENT is
-- New element content name node
Modified: gobo/trunk/library/xml/resolver/catalog/xm_string_uri_resolver.e
===================================================================
--- gobo/trunk/library/xml/resolver/catalog/xm_string_uri_resolver.e 2007-04-03 16:45:56 UTC (rev 5938)
+++ gobo/trunk/library/xml/resolver/catalog/xm_string_uri_resolver.e 2007-04-04 17:08:40 UTC (rev 5939)
@@ -25,18 +25,19 @@
create
make
-
-feature
+feature -- Initialization
+
make is
-- Create.
do
end
-
+
feature -- Status report
scheme: STRING is "string"
-
+ -- Scheme
+
feature -- Action(s)
resolve (a_uri: UT_URI) is
@@ -53,7 +54,7 @@
last_error := System_id_not_known_error
end
end
-
+
feature -- Result
last_stream: KI_CHARACTER_INPUT_STREAM
@@ -69,7 +70,7 @@
end
has_media_type: BOOLEAN is
- -- Is the media type available.
+ -- Is the media type available?
do
Result := False
end
@@ -81,7 +82,8 @@
end
feature {NONE} -- Error messages
-
+
System_id_not_known_error: STRING is "SYSTEM id not known to bootstrap resolver "
-
+ -- Error message
+
end
Modified: gobo/trunk/library/xml/resolver/uri/xm_file_uri_resolver.e
===================================================================
--- gobo/trunk/library/xml/resolver/uri/xm_file_uri_resolver.e 2007-04-03 16:45:56 UTC (rev 5938)
+++ gobo/trunk/library/xml/resolver/uri/xm_file_uri_resolver.e 2007-04-04 17:08:40 UTC (rev 5939)
@@ -26,7 +26,7 @@
make
-feature
+feature -- Initialization
make is
-- Create.
@@ -36,6 +36,7 @@
feature -- Status report
scheme: STRING is "file"
+ -- Scheme
feature -- Action(s)
@@ -83,5 +84,6 @@
feature {NONE} -- Error messages
Cannot_open_file_error: STRING is "Cannot open file "
+ -- Error message
end
Modified: gobo/trunk/library/xml/xpath/data_model/xm_xpath_name_pool.e
===================================================================
--- gobo/trunk/library/xml/xpath/data_model/xm_xpath_name_pool.e 2007-04-03 16:45:56 UTC (rev 5938)
+++ gobo/trunk/library/xml/xpath/data_model/xm_xpath_name_pool.e 2007-04-04 17:08:40 UTC (rev 5939)
@@ -16,7 +16,7 @@
-- a Namespace prefix, and a local name
-- plus a collection of namespaces, each consisting of a prefix/URI pair.
-- Also an index of names used as schema types.
-
+
-- The equivalence betweem names depends only on the URI and the local name.
-- The prefix is retained for documentary purposes only; it is useful when
-- reconstructing a document to use prefixes that the user is familiar with.
@@ -43,8 +43,8 @@
-- Fingerprints with depth 0 (i.e., in the range 0-2047) are reserved
-- for predefined names (names of XSLT elements and attributes, and of built-in types).
-- These names are not stored in the name pool, but are accessible as if they were.
- --
--
+ --
-- A name_code contains the fingerprint in the bottom 20 bits. It also contains
-- an 8-bit prefix index. This distinguishes the prefix used, among all the
-- prefixes that have been used with this namespace URI. If the prefix index is
@@ -79,7 +79,7 @@
-- Establish invariant
do
create hash_slots.make (0, Maximum_hash_chain_depth - 1)
-
+
create prefixes.make (100)
prefixes.set_equality_tester (string_equality_tester)
@@ -98,31 +98,31 @@
prefixes_for_uri.put ("xml ", Xml_prefix_index)
prefixes.put ("xs", Xml_schema_prefix_index)
- uris.put (Xml_schema_uri, Xml_schema_prefix_index)
+ uris.put (Xml_schema_uri, Xml_schema_prefix_index)
prefixes_for_uri.put ("xs ", Xml_schema_prefix_index)
-
+
prefixes.put ("xdt", Xpath_defined_datatypes_prefix_index)
- uris.put (Xpath_defined_datatypes_uri, Xpath_defined_datatypes_prefix_index)
+ uris.put (Xpath_defined_datatypes_uri, Xpath_defined_datatypes_prefix_index)
prefixes_for_uri.put ("xdt ", Xpath_defined_datatypes_prefix_index)
-
+
prefixes.put ("gexslt", Gexslt_uri_prefix_index)
- uris.put (Gexslt_eiffel_type_uri, Gexslt_uri_prefix_index)
+ uris.put (Gexslt_eiffel_type_uri, Gexslt_uri_prefix_index)
prefixes_for_uri.put ("gexslt ", Gexslt_uri_prefix_index)
prefixes.put ("xsl", Xslt_prefix_index)
uris.put (Xslt_uri, Xslt_prefix_index)
prefixes_for_uri.put ("xsl ", Xslt_prefix_index)
-
+
prefixes.put ("xsi", Xml_schema_instance_prefix_index)
- uris.put (Xml_schema_instance_uri, Xml_schema_instance_prefix_index)
+ uris.put (Xml_schema_instance_uri, Xml_schema_instance_prefix_index)
prefixes_for_uri.put ("xsi ", Xml_schema_instance_prefix_index)
prefixes.put ("fn", Xpath_standard_functions_prefix_index)
- uris.put (Xpath_standard_functions_uri, Xpath_standard_functions_prefix_index)
+ uris.put (Xpath_standard_functions_uri, Xpath_standard_functions_prefix_index)
prefixes_for_uri.put ("fn ", Xpath_standard_functions_prefix_index)
prefixes.put ("xhtml", Xhtml_prefix_index)
- uris.put (Xhtml_uri, Xhtml_prefix_index)
+ uris.put (Xhtml_uri, Xhtml_prefix_index)
prefixes_for_uri.put ("xhtml ", Xhtml_prefix_index)
prefixes.put ("err", Xpath_errors_prefix_index)
@@ -133,7 +133,7 @@
uris_used := 10
end
-
+
feature -- Access
Maximum_hash_chain_depth: INTEGER is 2048
@@ -221,7 +221,7 @@
std.error.put_string ("code_for_prefix: prefix is ")
std.error.put_string (an_xml_prefix)
std.error.put_new_line
- end
+ end
from
a_counter := 1
variant
@@ -233,7 +233,7 @@
std.error.put_string ("code_for_prefix: current prefix is ")
std.error.put_string (prefixes.item (a_counter))
std.error.put_new_line
- end
+ end
if STRING_.same_string (prefixes.item (a_counter),an_xml_prefix) then
Result := a_counter - 1
found := True
@@ -340,7 +340,7 @@
std.error.put_string (" to position ")
std.error.put_string ((a_blank - 1).out)
std.error.put_new_line
- end
+ end
last_blank := a_blank + 1 -- position AFTER the last blank
if last_blank > length_of_prefixes then found := True end
if a_counter = an_index then
@@ -386,7 +386,7 @@
ensure
valid_name_code: is_valid_name_code (Result)
end
-
+
fingerprint (a_uri: STRING; a_local_name: STRING): INTEGER is
-- Fingerprint for the name with a given uri and local name;
-- The fingerprint has the property that if two fingerprint are the same,
@@ -425,7 +425,7 @@
Result := -1
else
a_hash_code := a_local_name.hash_code \\ Maximum_hash_chain_depth
-
+
if hash_slots.item (a_hash_code) = Void then
Result := -1
else
@@ -546,7 +546,7 @@
Result := (is_reserved_namespace (a_uri) or else STRING_.same_string (a_uri, Gexslt_eiffel_type_uri))
and then type_factory.is_built_in_fingerprint (type_factory.standard_fingerprint (a_uri, a_local_name))
end
-
+
is_valid_uri_code (a_uri_code: INTEGER): BOOLEAN is
-- Does `a_uri_code' represent a URI in `Current'?
do
@@ -579,7 +579,7 @@
std.error.put_string ("looking at ")
std.error.put_string (uris.item (a_counter))
std.error.put_new_line
- end
+ end
if STRING_.same_string (uris.item (a_counter), a_uri) then
Result := True
end
@@ -611,7 +611,7 @@
std.error.put_string ("code_for_prefix: current prefix is ")
std.error.put_string (prefixes.item (a_counter))
std.error.put_new_line
- end
+ end
if STRING_.same_string (prefixes.item (a_counter), an_xml_prefix) then
Result := True
end
@@ -620,6 +620,7 @@
end
is_prefix_declared (a_qname: STRING): BOOLEAN is
+ -- Is prefix declared?
require
valid_qname: a_qname /= Void and then is_qname (a_qname)
local
@@ -661,7 +662,7 @@
a_prefix := prefix_from_name_code (a_name_code)
Result := is_code_for_prefix_allocated (a_prefix)
end
-
+
is_name_code_allocated (a_xml_prefix: STRING; a_uri: STRING; a_local_name: STRING): BOOLEAN is
-- Has a name code been allocated for `an_xml_prefix' with `a_uri' and `a_local_name'?
require
@@ -743,7 +744,7 @@
std.error.put_string ("is_name_code_allocated_using_uricode: result is ")
std.error.put_string (Result.out)
std.error.put_new_line
- end
+ end
end
is_name_pool_full (a_uri, a_local_name: STRING): BOOLEAN is
@@ -957,7 +958,7 @@
do
make
end
-
+
feature -- Element change
allocate_namespace_code (an_xml_prefix: STRING; a_uri: STRING) is
@@ -1027,7 +1028,7 @@
ensure
namespace_code_allocated: is_namespace_code_allocated_for_name_code (a_name_code)
end
-
+
allocate_code_for_uri (a_uri: STRING) is
-- Allocate the uri code for a given URI;
-- WARNING - this code is not thread safe
@@ -1232,7 +1233,7 @@
ensure
expanded_name_allocated: is_expanded_name_allocated (an_expanded_name)
end
-
+
feature -- Conversion
namespace_code_from_name_code (a_name_code: INTEGER): INTEGER is
@@ -1312,7 +1313,7 @@
end
ensure
result_not_void: Result /= Void
- end
+ end
prefix_from_name_code (a_name_code: INTEGER): STRING is
-- Xml prefix, given its name code
@@ -1393,7 +1394,7 @@
ensure
uri_not_void: Result /= Void
end
-
+
uri_from_uri_code (a_uri_code: INTEGER): STRING is
-- Namespace URI from `a_uri_code'
require
@@ -1405,7 +1406,7 @@
prefix_from_namespace_code (a_namespace_code: INTEGER): STRING is
-- Namespace prefix from `namespace_code'
require
- valid_code: is_valid_namespace_code (a_namespace_code)
+ valid_code: is_valid_namespace_code (a_namespace_code)
local
b16: INTEGER
do
@@ -1493,7 +1494,7 @@
do
-- look for quick wins
-
+
if an_xml_prefix.is_empty then
Result := 0
else
@@ -1556,7 +1557,7 @@
-- hash_code := a_name_code & 0x000003ff
a_scaled_prefix_index := name_code_to_prefix_index (a_name_code) * bits_20
a_depth := (a_name_code - a_scaled_prefix_index) // bits_11
-
+
Result := (a_name_code - a_scaled_prefix_index - (a_depth * bits_11))
ensure
positive_result: Result >= 0 and Result < Maximum_hash_chain_depth
@@ -1584,22 +1585,24 @@
hash_slots: ARRAY [XM_XPATH_NAME_ENTRY]
-- Fixed size hash table
-feature
+
+feature -- Access
+
prefixes: DS_ARRAYED_LIST [STRING]
-- The XML prefixes in use
-
+
prefixes_used: INTEGER
-- Highest number XML prefix in use
uris: DS_ARRAYED_LIST [STRING]
-- The URIs in use
-
+
prefixes_for_uri: DS_ARRAYED_LIST [STRING]
-- The XML prefixes in use for a given URI
-
+
uris_used: INTEGER
-- Highest number uri in use
-
+
invariant
fixed_hash_slots: hash_slots /= Void and then hash_slots.count = Maximum_hash_chain_depth
@@ -1608,7 +1611,7 @@
uris_not_void: uris /= Void
prefixes_for_uri_not_void: prefixes_for_uri /= Void
uris_used: uris_used >= 3
-
+
end
-
+
Modified: gobo/trunk/src/gepp/gepp_parser.y
===================================================================
--- gobo/trunk/src/gepp/gepp_parser.y 2007-04-03 16:45:56 UTC (rev 5938)
+++ gobo/trunk/src/gepp/gepp_parser.y 2007-04-04 17:08:40 UTC (rev 5939)
@@ -36,7 +36,6 @@
make
-feature
%}
%token P_IFDEF P_IFNDEF P_INCLUDE P_DEFINE P_UNDEF
Modified: gobo/trunk/test/kernel/uc_test_utf16_routines.e
===================================================================
--- gobo/trunk/test/kernel/uc_test_utf16_routines.e 2007-04-03 16:45:56 UTC (rev 5938)
+++ gobo/trunk/test/kernel/uc_test_utf16_routines.e 2007-04-04 17:08:40 UTC (rev 5939)
@@ -17,7 +17,7 @@
KL_TEST_CASE
UC_IMPORTED_UTF16_ROUTINES
-feature
+feature -- Test
test_valid is
-- Test feature `valid_utf16' when valid.
@@ -77,6 +77,9 @@
feature {NONE} -- Constants
Big_endian: STRING is "%/254/%/255/"
+ -- Big-endian BOM
+
Little_endian: STRING is "%/255/%/254/"
+ -- Little-endian BOM
end
Modified: gobo/trunk/test/xml/eiffel/xm_declaration_filter.e
===================================================================
--- gobo/trunk/test/xml/eiffel/xm_declaration_filter.e 2007-04-03 16:45:56 UTC (rev 5938)
+++ gobo/trunk/test/xml/eiffel/xm_declaration_filter.e 2007-04-04 17:08:40 UTC (rev 5939)
@@ -1,9 +1,9 @@
indexing
-
+
description:
-
+
"XML declaration event filter"
-
+
library: "Gobo Eiffel XML Library"
copyright: "Copyright (c) 2003, Eric Bezault and others"
license: "MIT License"
@@ -13,7 +13,7 @@
class XM_DECLARATION_FILTER
inherit
-
+
XM_CALLBACKS_FILTER
redefine
on_xml_declaration
@@ -23,22 +23,27 @@
make_null, set_next
-feature
-
+feature -- Document
+
on_xml_declaration (a_version: STRING; an_encoding: STRING; a_standalone: BOOLEAN) is
-- XML declaration.
do
version := a_version
encoding := an_encoding
standalone := a_standalone
-
+
Precursor (a_version, an_encoding, a_standalone)
end
-
+
feature -- Declaration info
version: STRING
+ -- Version
+
encoding: STRING
+ -- Encoding
+
standalone: BOOLEAN
+ -- Is standalone?
end
Modified: gobo/trunk/test/xml/eiffel/xm_no_namespace_checker.e
===================================================================
--- gobo/trunk/test/xml/eiffel/xm_no_namespace_checker.e 2007-04-03 16:45:56 UTC (rev 5938)
+++ gobo/trunk/test/xml/eiffel/xm_no_namespace_checker.e 2007-04-04 17:08:40 UTC (rev 5939)
@@ -1,9 +1,9 @@
indexing
-
+
description:
-
+
"Test no namespace parsing event tester"
-
+
library: "Gobo Eiffel XML Library"
copyright: "Copyright (c) 2003, Eric Bezault and others"
license: "MIT License"
@@ -23,27 +23,31 @@
KL_IMPORTED_STRING_ROUTINES
export {NONE} all end
-
+
create
make_null, set_next
-
-feature
+feature -- Document
+
on_start is
-- Initialize.
do
create actual.make
next.on_start
end
-
+
on_start_tag (a_ns, a_pre, a_local: STRING) is
+ -- Start of start tag.
+ -- Warning: strings may be polymorphic, see XM_STRING_MODE.
do
actual.force_last (a_local)
next.on_start_tag (a_ns, a_pre, a_local)
end
-
+
on_attribute (a_ns, a_pre, a_local: STRING; a_value: STRING) is
+ -- Start of attribute.
+ -- Warning: strings may be polymorphic, see XM_STRING_MODE.
do
actual.force_last (a_local)
next.on_attribute (a_ns, a_pre, a_local, a_value)
@@ -51,7 +55,8 @@
feature {NONE} -- Implemenation
- actual: DS_LINKED_LIST[STRING]
+ actual: DS_LINKED_LIST [STRING]
+ -- Array of actual URIs
feature -- Element change
@@ -60,17 +65,17 @@
do
expected := a
end
-
+
expected: ARRAY [STRING]
-- Array of expected URIs
-
+
feature -- Status
has_failed: BOOLEAN is
-- Is there a failed index?
local
i: INTEGER
- it: DS_LINEAR_CURSOR[STRING]
+ it: DS_LINEAR_CURSOR[STRING]
do
Result := (expected = Void or actual = Void) or else actual.count /= expected.count
if not Result then
@@ -89,5 +94,5 @@
end
end
end
-
+
end
Modified: gobo/trunk/test/xml/eiffel/xm_test_dtd.e
===================================================================
--- gobo/trunk/test/xml/eiffel/xm_test_dtd.e 2007-04-03 16:45:56 UTC (rev 5938)
+++ gobo/trunk/test/xml/eiffel/xm_test_dtd.e 2007-04-04 17:08:40 UTC (rev 5939)
@@ -1,27 +1,27 @@
indexing
description:
-
+
"Test DTD parsing"
-
+
library: "Gobo Eiffel XML Library"
copyright: "Copyright (c) 2003, Eric Bezault and others"
license: "MIT License"
date: "$Date$"
revision: "$Revision$"
-
+
deferred class XM_TEST_DTD
inherit
TS_TEST_CASE
-
-feature
+feature -- Test
+
test_declaration is
-- DTD declaration.
do
- assert_parsed ("<!DOCTYPE doc SYSTEM %"abc%"><doc/>",
+ assert_parsed ("<!DOCTYPE doc SYSTEM %"abc%"><doc/>",
"<!DOCTYPE doc SYSTEM abc >%N")
assert_parsed ("<!DOCTYPE doc PUBLIC 'uri' 'abc'><doc/>",
"<!DOCTYPE doc PUBLIC uri abc >%N")
@@ -39,7 +39,7 @@
assert_parsed ("<!DOCTYPE doc [ <!ELEMENT doc EMPTY> <!-- com -->]><doc/>",
"<!DOCTYPE doc>%N<!ELEMENT doc EMPTY>%N")
end
-
+
test_attribute is
-- Simple DTD with attributes.
do
@@ -65,7 +65,7 @@
"<!DOCTYPE doc [ <!ELEMENT doc EMPTY><!ATTLIST doc a (x | y|z) #IMPLIED>]><doc/>",
"<!DOCTYPE doc>%N<!ELEMENT doc EMPTY>%N<!ATTLIST doc a (x|y|z) #IMPLIED>%N")
end
-
+
test_element_repetition is
-- Test sub element repetition.
do
@@ -79,7 +79,7 @@
"<!DOCTYPE doc [<!ELEMENT doc (doc?)>]><doc/>",
"<!DOCTYPE doc>%N<!ELEMENT doc (doc?)>%N")
end
-
+
test_element_group is
-- Test sub element groups.
do
@@ -93,8 +93,8 @@
"<!DOCTYPE doc [<!ELEMENT a1 EMPTY><!ELEMENT a2 EMPTY><!ELEMENT doc (a1,(a1|a2))>]><doc/>",
"<!DOCTYPE doc>%N<!ELEMENT a1 EMPTY>%N<!ELEMENT a2 EMPTY>%N<!ELEMENT doc (a1,(a1|a2))>%N")
end
-
+
feature {NONE} -- Assertions
new_resolver: XM_STRING_EXTERNAL_RESOLVER is
@@ -105,22 +105,27 @@
ensure
not_void: Result /= Void
end
-
+
assert_parsed (a_in: STRING; a_out: STRING) is
+ -- Assert that `a_in' can be parsed correctly
+ -- and that the DTD parsed is equal to `a_out'.
+ require
+ a_in_not_void: a_in /= Void
+ a_out_not_void: a_out /= Void
local
a_printer: XM_DTD_PRETTY_PRINT_FILTER
a_parser: XM_EIFFEL_PARSER
do
create a_printer.make_null
a_printer.set_output_to_string
-
+
create a_parser.make
a_parser.set_dtd_resolver (new_resolver)
a_parser.set_dtd_callbacks (a_printer)
a_parser.parse_from_string (a_in)
assert ("parsed_ok", a_parser.is_correct)
- assert_equal ("dtd_as_expected", a_out, a_printer.last_output)
+ assert_equal ("dtd_as_expected", a_out, a_printer.last_output)
end
-
+
end
Modified: gobo/trunk/test/xml/eiffel/xm_test_latin1.e
===================================================================
--- gobo/trunk/test/xml/eiffel/xm_test_latin1.e 2007-04-03 16:45:56 UTC (rev 5938)
+++ gobo/trunk/test/xml/eiffel/xm_test_latin1.e 2007-04-04 17:08:40 UTC (rev 5939)
@@ -9,22 +9,23 @@
license: "MIT License"
date: "$Date$"
revision: "$Revision$"
-
+
deferred class XM_TEST_LATIN1
inherit
TS_TEST_CASE
-
+
KL_IMPORTED_STRING_ROUTINES
export {NONE} all end
-
+
XM_CALLBACKS_FILTER_FACTORY
export {NONE} all end
-
-feature
+feature -- Test
+
test_valid_tag is
+ -- Test valid tag.
do
assert_output(
"<?xml version='1.0' encoding='iso-8859-1'?><\xE9></\xE9>",
@@ -36,8 +37,9 @@
"<?xml version='1.0' encoding='iso-8859-1'?><doc \xE9=''/>",
"<doc %/195/%/169/=%"%"></doc>")
end
-
+
test_valid_content is
+ -- Test valid content.
do
assert_output(
"<?xml version='1.0' encoding='iso-8859-1'?><doc>\xE9</doc>",
@@ -48,11 +50,12 @@
end
test_invalid_latin1 is
+ -- Test invalid Latin1.
do
assert_invalid ("<doc>%/195/</doc>") -- half of UTF8
end
-feature {NONE}
+feature {NONE} -- Implementation
assert_invalid (a_in: STRING) is
-- Assert parsing OK and standalone declaration correctly read.
@@ -63,7 +66,7 @@
a_sink: XM_STOP_ON_ERROR_FILTER
do
a_sink := new_stop_on_error
-
+
create a_parser.make
a_parser.set_string_mode_mixed
a_parser.set_callbacks (standard_callbacks_pipe (<<new_unicode_validation, a_sink>>))
@@ -82,13 +85,13 @@
do
create a_sink.make_null
a_sink.set_output_to_string
-
+
create a_parser.make
a_parser.set_string_mode_mixed
a_parser.set_callbacks (standard_callbacks_pipe (<<a_sink>>))
a_parser.parse_from_stream (literal_stream (a_in))
-
+
assert ("parsed_ok", a_parser.is_correct)
assert_equal ("output", a_out_utf8, STRING_.as_string (a_sink.last_output))
end
@@ -102,5 +105,5 @@
ensure
not_void: Result /= Void
end
-
+
end
Modified: gobo/trunk/test/xml/eiffel/xm_test_stop_filter.e
===================================================================
--- gobo/trunk/test/xml/eiffel/xm_test_stop_filter.e 2007-04-03 16:45:56 UTC (rev 5938)
+++ gobo/trunk/test/xml/eiffel/xm_test_stop_filter.e 2007-04-04 17:08:40 UTC (rev 5939)
@@ -13,10 +13,11 @@
deferred class XM_TEST_STOP_FILTER
inherit
+
TS_TEST_CASE
-
-feature
+feature -- Test
+
test_stop is
-- Test stop filter stops the parser.
local
@@ -30,10 +31,10 @@
error_filter := parser.new_stop_on_error_filter
create result_filter.set_next (error_filter)
create ns_filter.set_next (result_filter)
-
+
parser.set_callbacks (ns_filter)
parser.parse_from_string ("<doc broken:attr=''>hello</doc>")
-
+
assert ("error", not parser.is_correct)
assert_equal ("no_content", "", result_filter.content)
assert_equal ("ns_error", "Undeclared namespace error", parser.last_error_description)
@@ -42,5 +43,6 @@
feature {NONE} -- Implementation
parser: XM_EIFFEL_PARSER
+ -- XML parser
end
Modified: gobo/trunk/test/xml/general/test_string_external_resolver.e
===================================================================
--- gobo/trunk/test/xml/general/test_string_external_resolver.e 2007-04-03 16:45:56 UTC (rev 5938)
+++ gobo/trunk/test/xml/general/test_string_external_resolver.e 2007-04-04 17:08:40 UTC (rev 5939)
@@ -1,9 +1,9 @@
indexing
description:
-
+
"String resolver counting events for testing"
-
+
library: "Gobo Eiffel XML Library"
copyright: "Copyright (c) 2004, Eric Bezault and others"
license: "MIT License"
@@ -13,7 +13,7 @@
class TEST_STRING_EXTERNAL_RESOLVER
inherit
-
+
XM_STRING_EXTERNAL_RESOLVER
redefine
resolve,
@@ -24,17 +24,25 @@
make
-feature
+feature -- Access
depth: INTEGER
+ -- Resolve depth
+feature -- Actions
+
resolve (a: STRING) is
+ -- Resolve a system identifier to an input stream
+ -- on behalf of an XML parser.
do
depth := depth + 1
Precursor (a)
end
resolve_finish is
+ -- The parser has finished with the last resolved entity.
+ -- The previously resolved entity becomes the last resolved one.
+ -- Note: `last_stream' is not required to be restored accordingly.
do
depth := depth - 1
end
Modified: gobo/trunk/test/xml/general/xm_test_namespace_jclark.e
===================================================================
--- gobo/trunk/test/xml/general/xm_test_namespace_jclark.e 2007-04-03 16:45:56 UTC (rev 5938)
+++ gobo/trunk/test/xml/general/xm_test_namespace_jclark.e 2007-04-04 17:08:40 UTC (rev 5939)
@@ -1,15 +1,15 @@
indexing
-
+
description:
-
+
"Test namespace from http://www.jclark.com/xml/xmlns.htm (normalised)"
-
+
library: "Gobo Eiffel XML Library"
copyright: "Copyright (c) 2002, Eric Bezault and others"
license: "MIT License"
date: "$Date$"
revision: "$Revision$"
-
+
deferred class XM_TEST_NAMESPACE_JCLARK
inherit
@@ -18,24 +18,27 @@
XM_CALLBACKS_FILTER_FACTORY
export {NONE} all end
-
-feature
+feature -- Test
+
test_cars is
+ -- Test namespace "cars".
do
assert_namespace ("cars",
"<cars:part xmlns:cars=%"http://www.cars.com/xml%"/>",
"<{http://www.cars.com/xml}part></{http://www.cars.com/xml}part>")
end
-
+
test_html is
+ -- Test namespace "HTML".
do
assert_namespace ("test",
"<NAME HTML:CLASS=%"largeSansSerif%" xmlns:HTML=%"http://www.w3.org/TR/REC-html40%">Layman, A</NAME>",
"<NAME {http://www.w3.org/TR/REC-html40}CLASS=%"largeSansSerif%">Layman, A</NAME>")
end
-
+
test_reservation is
+ -- Test namespace "HTML".
do
assert_namespace ("reservation",
"<RESERVATION xmlns:HTML=%"http://www.w3.org/TR/REC-html40%">"+
@@ -50,8 +53,9 @@
"<{http://www.w3.org/TR/REC-html40}A HREF=%"/cgi-bin/ResStatus%">Check Status</{http://www.w3.org/TR/REC-html40}A>"+
"<DEPARTURE>1997-05-24T07:55:00+1</DEPARTURE></RESERVATION>")
end
-
+
test_book is
+ -- Test namespace "urn:com:books-r-us".
do
assert_namespace ("book",
"<section xmlns='urn:com:books-r-us'>"+
@@ -70,8 +74,9 @@
" </{urn:com:books-r-us}signing>"+
"</{urn:com:books-r-us}section>")
end
-
+
test_book_empty is
+ -- Test namespace "urn:com:books-r-us".
do
assert_namespace ("book_empty",
"<section xmlns='urn:com:books-r-us'>"+
@@ -105,11 +110,11 @@
do
create a_printer.make_null
a_printer.set_output_to_string
-
+
create a_parser.make
a_parser.set_callbacks (standard_callbacks_pipe (<<a_printer>>))
a_parser.parse_from_string (a_xml)
-
+
assert ("parsing ok for "+a_name, a_parser.is_correct)
assert_equal (a_name, a_parsed, a_printer.last_output)
end
Modified: gobo/trunk/test/xml/general/xm_test_simple_resolver.e
===================================================================
--- gobo/trunk/test/xml/general/xm_test_simple_resolver.e 2007-04-03 16:45:56 UTC (rev 5938)
+++ gobo/trunk/test/xml/general/xm_test_simple_resolver.e 2007-04-04 17:08:40 UTC (rev 5939)
@@ -1,9 +1,9 @@
indexing
description:
-
+
"Test XML simple resolver(s)"
-
+
library: "Gobo Eiffel XML Library"
copyright: "Copyright (c) 2004, Eric Bezault and others"
license: "MIT License"
@@ -13,13 +13,13 @@
deferred class XM_TEST_SIMPLE_RESOLVER
inherit
-
+
TS_TEST_CASE
XM_RESOLVER_FACTORY
export {NONE} all end
-feature
+feature -- Test
test_balanced is
-- Test resolve/resolve_finish calls are balanced.
@@ -27,7 +27,7 @@
string_resolver: TEST_STRING_EXTERNAL_RESOLVER
do
create parser.make
-
+
create string_resolver.make
string_resolver.strings.put ("<!DOCTYPE doc SYSTEM 'dtd'><doc/>", "doc")
string_resolver.strings.put ("<!ELEMENT doc EMPTY>", "dtd")
@@ -36,7 +36,7 @@
parser.parse_from_system ("doc")
assert ("parsed", parser.is_correct)
assert_integers_equal ("balanced resolver", 0, string_resolver.depth)
-
+
-- Second time to check resolver left in a good state.
parser.parse_from_system ("doc")
assert ("parsed second time", parser.is_correct)
@@ -48,10 +48,10 @@
do
create parser.make
parser.set_resolver (new_file_resolver_current_directory)
-
+
parser.parse_from_system (Relative_data)
assert ("parsed", parser.is_correct)
-
+
-- Second time to check resolver left in a good state.
parser.parse_from_system (Relative_data)
assert ("parsed second time", parser.is_correct)
@@ -70,7 +70,7 @@
parser.parse_from_system (Relative_data)
assert ("parsed second time", parser.is_correct)
end
-
+
test_file_error is
-- Test file error resolver.
do
@@ -83,13 +83,13 @@
assert_integers_equal ("position count", 2, parser.positions.count)
assert_position ("top", parser.position, 1, 8)
assert_position ("parent ", parser.positions.item (2), 6, 1)
-
+
-- Parse correct file after error
-- to check resolver left in a good state.
parser.parse_from_system (Relative_data)
assert ("ok", parser.is_correct)
end
-
+
test_stream is
-- Test parse_from_stream and resolver interaction.
local
@@ -101,7 +101,7 @@
create a_stream.make (Relative_xml)
parser.parse_from_stream (a_stream)
assert ("parsed", parser.is_correct)
-
+
-- Second time to check resolver left in a good state.
create a_stream.make (Relative_xml)
parser.parse_from_stream (a_stream)
@@ -119,16 +119,17 @@
assert_integers_equal (a_prefix + " row", a_row, a_position.row)
assert_integers_equal (a_prefix + " column", a_column, a_position.column)
end
-
-feature {NONE} -- Implementation
parser: XM_EIFFEL_PARSER
- -- Test parser.
+ -- XML parser
Relative_xml: STRING is "<!DOCTYPE doc [ <!ELEMENT doc (child*)> <!ELEMENT child EMPTY> <!ENTITY e SYSTEM 'data/relative2.xml'> ]><doc>&e;</doc>"
-- Top level doc for stream test.
Relative_data: STRING is "data/relative.xml"
+ -- Data filename "relative.xml"
+
Brokensub_data: STRING is "data/brokensub.xml"
+ -- Data filename "brokensub.xml"
end
Modified: gobo/trunk/test/xml/general/xm_test_tree.e
===================================================================
--- gobo/trunk/test/xml/general/xm_test_tree.e 2007-04-03 16:45:56 UTC (rev 5938)
+++ gobo/trunk/test/xml/general/xm_test_tree.e 2007-04-04 17:08:40 UTC (rev 5939)
@@ -14,9 +14,9 @@
inherit
TS_TEST_CASE
-
-feature
+feature -- Test
+
test_simple is
-- Simple tree.
local
@@ -25,7 +25,7 @@
make_parser
parser.parse_from_string ("<doc><a/><b/></doc>")
assert ("parsing error", not tree_pipe.error.has_error)
-
+
if not tree_pipe.error.has_error then
assert_has_element (tree_pipe.document, "doc")
a_root := tree_pipe.document.root_element
@@ -34,7 +34,7 @@
assert_has_element (a_root, "b")
end
end
-
+
test_walk is
-- Walk through tree.
do
@@ -44,7 +44,7 @@
+" <a b='foo'></a><b/><!--inline--><c>zoo</c>"
+"</doc>"
+"<!-- post -->")
-
+
go_root
assert_document
assert_first
@@ -79,7 +79,7 @@
assert_comment (" post ")
assert_last
end
-
+
test_walk_namespaces is
-- Walk through tree with namespaces.
do
@@ -88,7 +88,7 @@
+"<a/><b xmlns='uri2'/>"
+"<ns1:c xmlns:ns1='uri3' xmlns:ns2='uri4' a1='foo1' ns2:a2='foo2'/>"
+"</doc>")
-
+
go_root
assert_single
assert_document
@@ -111,7 +111,7 @@
assert_ns_attribute ("uri4", "a2", "foo2")
assert_last
end
-
+
test_build_simple is
-- Build very simple tree.
local
@@ -123,17 +123,17 @@
create a_doc.make
create an_element.make (a_doc, "doc", a_namespace)
a_doc.set_root_element (an_element)
-
+
create typer
node := a_doc
-
+
assert_document
go_down
assert_first
assert_ns_element ("uri1", "doc")
assert_last
end
-
+
test_build_with_add is
-- Build simple tree and use addition routine(s).
local
@@ -149,13 +149,13 @@
an_element.add_unqualified_attribute ("attr1", "v1")
create a_namespace.make ("p2", "uri2")
an_element.add_attribute ("attr2", a_namespace, "v2")
-
+
create a_sub.make_last (an_element, "child", a_namespace)
an_element.add_unqualified_attribute ("attr3", "v3")
-
+
create typer
node := a_doc
-
+
assert_document
go_down
assert_first
@@ -173,28 +173,29 @@
assert_last
go_up
end
-
+
feature {NONE} -- Walk navigation
node: XM_NODE
-- Node.
-
+
typer: XM_NODE_TYPER
-
+ -- XML node typer
+
go_root is
-- Go to root node.
do
node := tree_pipe.document
create typer
end
-
+
go_up is
-- Go to parent.
do
assert ("has parent", not node.is_root_node)
node := node.parent
end
-
+
go_down is
-- Go to first child.
do
@@ -203,7 +204,7 @@
assert ("down: has child", typer.composite.count > 0)
node := typer.composite.first
end
-
+
go_next is
-- Move to next sibling, or don't
-- move if last sibling.
@@ -220,18 +221,18 @@
loop
it.forth
end
-
+
check not_after: not it.after end
it.forth
- if not it.after then
+ if not it.after then
node := it.item
it.go_after
-- else at end so don't move
end
-
+
check out: it.after end
end
-
+
feature {NONE} -- Walk assertions
assert_document is
@@ -240,7 +241,7 @@
node.process (typer)
assert ("document node expected", typer.is_document)
end
-
+
assert_comment (a: STRING) is
-- Assert current node is a comment.
require
@@ -250,8 +251,8 @@
assert ("comment expected", typer.is_comment)
assert_strings_equal ("comment value", a, typer.comment.data)
end
-
-
+
+
assert_element (a_name: STRING) is
-- Node is an element.
require
@@ -261,7 +262,7 @@
assert ("element expected", typer.is_element)
assert_strings_equal ("element name", a_name, typer.element.name)
end
-
+
assert_element_has_qualified (a_uri: STRING; a_name: STRING) is
-- Child node of an element.
require
@@ -272,7 +273,7 @@
assert ("element expected", typer.is_element)
assert_has_element_qualified (typer.element, a_uri, a_name)
end
-
+
assert_ns_element (a_ns: STRING; a_name: STRING) is
-- Node is an element (with namespace).
require
@@ -284,7 +285,7 @@
assert ("has_qualified_name", typer.element.has_qualified_name (a_ns, a_name))
assert_strings_equal ("element namespace", a_ns, typer.element.namespace.uri)
end
-
+
assert_childless is
-- Node is empty composite.
do
@@ -292,7 +293,7 @@
assert ("element expected", typer.is_element)
assert ("element not empty", typer.element.count = 0)
end
-
+
assert_attribute (a_name: STRING; a_value: STRING) is
-- Node is an attribute.
require
@@ -306,10 +307,10 @@
an_attribute := typer.xml_attribute
assert_strings_equal ("attribute name", a_name, an_attribute.name)
assert_strings_equal ("attribute value", a_value, an_attribute.value)
-
+
assert_attribute_element (an_attribute)
end
-
+
assert_attribute_element (an_attribute: XM_ATTRIBUTE) is
-- Checks on attributes parent element.
require
@@ -324,7 +325,7 @@
assert ("prefixed not by name", not typer.element.has_attribute_by_name (an_attribute.name))
end
end
-
+
assert_ns_attribute (a_ns: STRING; a_name: STRING; a_value: STRING) is
-- Node is an attribute (with namespace).
require
@@ -337,19 +338,19 @@
assert ("has_qualified_name", typer.xml_attribute.has_qualified_name (a_ns, a_name))
assert_strings_equal ("attribute namespace", a_ns, typer.xml_attribute.namespace.uri)
end
-
+
assert_last is
-- Node is last in parent.
do
assert ("last", node.is_last)
end
-
+
assert_first is
-- Node is first in parent.
do
assert ("first", node.is_first)
end
-
+
assert_text (a: STRING) is
-- Assert text node
require
@@ -359,7 +360,7 @@
assert ("text node expected", typer.is_character_data)
assert_strings_equal ("text", a, typer.character_data.content)
end
-
+
assert_text_space is
-- Assert text node with only spaces.
local
@@ -381,13 +382,13 @@
i := i + 1
end
end
-
+
assert_single is
-- Node is singleton.
do
assert ("singleton", node.is_first and node.is_last)
end
-
+
feature {NONE} -- Implementation
assert_has_element (a: XM_COMPOSITE; a_name: STRING) is
@@ -415,16 +416,20 @@
end
end
-feature {NONE} -- Implementation
-
make_parser is
+ -- Create XML parser.
do
create parser.make
create tree_pipe.make
parser.set_callbacks (tree_pipe.start)
+ ensure
+ parser_not_void: parser /= Void
end
-
+
parser: XM_EIFFEL_PARSER
+ -- XML parser
+
tree_pipe: XM_TREE_CALLBACKS_PIPE
-
+ -- Tree pipe
+
end
Modified: gobo/trunk/test/xml/xpath/xm_xpath_test_builder.e
===================================================================
--- gobo/trunk/test/xml/xpath/xm_xpath_test_builder.e 2007-04-03 16:45:56 UTC (rev 5938)
+++ gobo/trunk/test/xml/xpath/xm_xpath_test_builder.e 2007-04-04 17:08:40 UTC (rev 5939)
@@ -32,7 +32,7 @@
-- and exercise the DOM-like navigation features,
-- and the XPath axes.
-feature
+feature -- Test
test_simple is
-- Simple tree.
@@ -113,7 +113,7 @@
assert ("Document not void", document /= Void)
-- Test document_element
-
+
document_element ?= document.document_element
assert ("Document element not void", document_element /= Void)
a_name := document_element.node_name
@@ -129,14 +129,14 @@
-- Test parent
assert ("Parent", document_element.is_same_node (books_element.parent))
-
+
-- Test first_child of first child
item_element ?= books_element.first_child
assert ("First child not void", item_element /= Void)
a_name := item_element.node_name
assert_strings_equal ("First child 2 name", "ITEM", a_name)
-
+
-- Test next_sibling loop to last child
from
@@ -174,7 +174,7 @@
descendants.forth
end
assert ("Eight descendants", counter = 9)
-
+
-- Test ancestor axis - look for "BOOKLIST" ancestor of "ITEM"
create ancestors.make (item_element, any_node_test, False)
@@ -208,7 +208,7 @@
create preceding.make (categories_element, any_pi_test)
check
preceding_before: preceding.before
- end
+ end
from
counter := 1
preceding.start
@@ -253,12 +253,12 @@
counter := counter + 1
end
assert ("Six following elements", counter = 7)
-
+
-- Test attributes axis - look for NOTE attribute on CATEGORY element
a_fingerprint := shared_name_pool.fingerprint ("", "NOTE")
an_element := element_list_1.item (2)
-
+
create attribute_test.make (Attribute_node, a_fingerprint, "NODE")
create attributes.make (an_element, attribute_test)
check
@@ -303,7 +303,7 @@
assert ("Document not void", document /= Void)
-- Test document_element
-
+
document_element ?= document.document_element
assert ("Document element not void", document_element /= Void)
a_name := document_element.node_name
@@ -322,6 +322,7 @@
feature {NONE} -- Implementation
make_parser (a_base_uri: STRING) is
+ -- Create XML parser.
require
a_base_uri_not_void: a_base_uri /= Void
local
@@ -336,10 +337,15 @@
parser.set_callbacks (tree_pipe.start)
parser.set_dtd_callbacks (tree_pipe.emitter)
parser.set_string_mode_ascii
+ ensure
+ parser_not_void: parser /= Void
end
-
+
parser: XM_EIFFEL_PARSER
+ -- XML parser
+
tree_pipe: XM_XPATH_TREE_CALLBACKS_PIPE
+ -- Tree pipe
data_dirname: STRING is
-- Name of directory containing data files
@@ -350,7 +356,7 @@
data_dirname_not_void: Result /= Void
data_dirname_not_empty: not Result.is_empty
end
-
+
books_xml_uri: UT_URI is
-- URI of file 'books.xml'
local
Modified: gobo/trunk/test/xml/xpath/xm_xpath_test_system_ids.e
===================================================================
--- gobo/trunk/test/xml/xpath/xm_xpath_test_system_ids.e 2007-04-03 16:45:56 UTC (rev 5938)
+++ gobo/trunk/test/xml/xpath/xm_xpath_test_system_ids.e 2007-04-04 17:08:40 UTC (rev 5939)
@@ -32,7 +32,7 @@
-- These tests check the system_id and base_uri rotuines
-feature
+feature -- Test
test_with_dtd_using_tiny_tree is
-- Test using tiny tree
@@ -178,6 +178,7 @@
feature {NONE} -- Implementation
make_parser (a_base_uri: STRING; is_tiny: BOOLEAN) is
+ -- Create XML parser.
require
a_base_uri_not_void: a_base_uri /= Void
local
@@ -198,11 +199,18 @@
parser.set_dtd_callbacks (tree_pipe.emitter)
end
parser.set_string_mode_ascii
+ ensure
+ parser_not_void: parser /= Void
end
parser: XM_EIFFEL_PARSER
+ -- XML parser
+
tiny_tree_pipe: XM_XPATH_TINYTREE_CALLBACKS_PIPE
+ -- Tiny tree pipe
+
tree_pipe: XM_XPATH_TREE_CALLBACKS_PIPE
+ -- Tree pipe
data_dirname: STRING is
-- Name of directory containing data files
Modified: gobo/trunk/test/xml/xpath/xm_xpath_test_tiny_builder.e
===================================================================
--- gobo/trunk/test/xml/xpath/xm_xpath_test_tiny_builder.e 2007-04-03 16:45:56 UTC (rev 5938)
+++ gobo/trunk/test/xml/xpath/xm_xpath_test_tiny_builder.e 2007-04-04 17:08:40 UTC (rev 5939)
@@ -32,7 +32,7 @@
-- and exercise the DOM-like navigation features,
-- and the XPath axes.
-feature
+feature -- Test
test_simple is
-- Simple tree.
@@ -68,20 +68,20 @@
assert ("First child not void", an_element /= Void)
a_name := an_element.node_name
assert("First child name", STRING_.same_string (a_name, "a"))
-
+
-- Test next_sibling
an_element ?= an_element.next_sibling
- assert ("Second child not void", an_element /= Void)
+ assert ("Second child not void", an_element /= Void)
a_name := an_element.node_name
assert("Second child name", STRING_.same_string (a_name, "b"))
-- Test previous_sibling
an_element ?= an_element.previous_sibling
- assert ("Previous sibling not void", an_element /= Void)
+ assert ("Previous sibling not void", an_element /= Void)
a_name := an_element.node_name
- assert("Previous sibling name", STRING_.same_string (a_name, "a"))
+ assert("Previous sibling name", STRING_.same_string (a_name, "a"))
end
test_with_dtd is
@@ -113,7 +113,7 @@
assert ("Document not void", document /= Void)
-- Test document_element
-
+
document_element ?= document.document_element
assert ("Document element not void", document_element /= Void)
a_name := document_element.node_name
@@ -129,14 +129,14 @@
-- Test parent
assert ("Parent", document_element.is_same_node (books_element.parent))
-
+
-- Test first_child of first child
item_element ?= books_element.first_child
assert ("First child not void", item_element /= Void)
a_name := item_element.node_name
assert("First child 2 name", STRING_.same_string (a_name, "ITEM"))
-
+
-- Test next_sibling loop to last child
from
@@ -175,7 +175,7 @@
end
assert ("Eight descendants", counter = 9)
-
+
-- Test ancestor axis - look for "BOOKLIST" ancestor of "ITEM"
create ancestors.make (item_element, any_node_test, False)
@@ -209,7 +209,7 @@
create preceding.make (document.tree, categories_element, any_pi_test, False)
check
preceding_before: preceding.before
- end
+ end
from
counter := 1
preceding.start
@@ -254,12 +254,12 @@
counter := counter + 1
end
assert ("Six following elements", counter = 7)
-
+
-- Test attributes axis - look for NOTE attribute on CATEGORY element
a_fingerprint := shared_name_pool.fingerprint ("", "NOTE")
an_element := element_list_1.item (2)
-
+
create attribute_test.make (Attribute_node, a_fingerprint, "NOTE")
create attributes.make (document.tree, an_element.node_number, attribute_test)
check
@@ -304,7 +304,7 @@
assert ("Document not void", document /= Void)
-- Test document_element
-
+
document_element ?= document.document_element
assert ("Document element not void", document_element /= Void)
a_name := document_element.node_name
@@ -323,6 +323,7 @@
feature {NONE} -- Implementation
make_parser (a_base_uri: STRING) is
+ -- Create XML parser.
require
a_base_uri_not_void: a_base_uri /= Void
local
@@ -337,10 +338,15 @@
parser.set_callbacks (tree_pipe.start)
parser.set_dtd_callbacks (tree_pipe.emitter)
parser.set_string_mode_ascii
+ ensure
+ parser_not_void: parser /= Void
end
parser: XM_EIFFEL_PARSER
+ -- XML parser
+
tree_pipe: XM_XPATH_TINYTREE_CALLBACKS_PIPE
+ -- Tree pipe
feature {NONE} -- Implementation
@@ -354,7 +360,7 @@
data_dirname_not_void: Result /= Void
data_dirname_not_empty: not Result.is_empty
end
-
+
books_xml_uri: UT_URI is
-- URI of file 'books.xml'
local
@@ -365,7 +371,7 @@
ensure
books_xml_uri_not_void: Result /= Void
end
-
+
books_xsl_uri: UT_URI is
-- URI of file 'books.xsl'
local
@@ -376,5 +382,5 @@
ensure
books_xsl_uri_not_void: Result /= Void
end
-
+
end
Modified: gobo/trunk/test/xml/xslt/xm_xslt_test_fragments.e
===================================================================
--- gobo/trunk/test/xml/xslt/xm_xslt_test_fragments.e 2007-04-03 16:45:56 UTC (rev 5938)
+++ gobo/trunk/test/xml/xslt/xm_xslt_test_fragments.e 2007-04-04 17:08:40 UTC (rev 5939)
@@ -27,7 +27,7 @@
XM_XSLT_CONFIGURATION_CONSTANTS
-feature
+feature -- Test
test_shorthand_pointer is
-- Transform books3.xml with books1.xsl.
@@ -107,7 +107,7 @@
conformance.set_basic_xslt_processor
create l_configuration.make_with_defaults
create l_error_listener.make (l_configuration.recovery_policy)
- l_configuration.set_error_listener (l_error_listener)
+ l_configuration.set_error_listener (l_error_listener)
l_configuration.set_string_mode_ascii -- make_with_defaults sets to mixed
l_configuration.use_tiny_tree_model (False)
l_configuration.set_recovery_policy (Do_not_recover)
@@ -125,7 +125,7 @@
assert ("Transform successfull", not l_transformer.is_error)
assert ("Correct output", STRING_.same_string (l_output.last_output, expected_output_2))
end
-
+
test_embedded_stylesheet is
-- Transform embedded.xml by itself, without using xml-stylesheet-pi
local
@@ -140,7 +140,7 @@
conformance.set_basic_xslt_processor
create l_configuration.make_with_defaults
create l_error_listener.make (l_configuration.recovery_policy)
- l_configuration.set_error_listener (l_error_listener)
+ l_configuration.set_error_listener (l_error_listener)
l_configuration.set_string_mode_ascii
l_configuration.use_tiny_tree_model (False)
create l_transformer_factory.make (l_configuration)
@@ -264,11 +264,6 @@
assert ("Correct output", l_output.last_output.count = 81)
end
- expected_output_1: STRING is "<?xml version=%"1.0%" encoding=%"UTF-8%"?><output>Number, the Language of Science</output>"
-
- expected_output_2: STRING is "<?xml version=%"1.0%" encoding=%"UTF-8%"?><output>Danzig</output>"
-
-
feature {NONE} -- Implementation
data_dirname: STRING is
@@ -289,7 +284,7 @@
ensure
dummy_uri_is_absolute: Result /= Void and then Result.is_absolute
end
-
+
books1_xsl_uri: UT_URI is
-- URI of file 'books1.xsl'
local
@@ -311,7 +306,7 @@
xpath_data_dirname_not_void: Result /= Void
xpath_data_dirname_not_empty: not Result.is_empty
end
-
+
books3_xml_uri: UT_URI is
-- URI of file 'books3.xml'
local
@@ -356,4 +351,10 @@
example0_xsl_uri_not_void: Result /= Void
end
+ expected_output_1: STRING is "<?xml version=%"1.0%" encoding=%"UTF-8%"?><output>Number, the Language of Science</output>"
+ -- An expected output
+
+ expected_output_2: STRING is "<?xml version=%"1.0%" encoding=%"UTF-8%"?><output>Danzig</output>"
+ -- An expected output
+
end
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|