Eiffel Media API
Overview Cluster Class Classes Index      Previous Next      Top Features

xml.resolver.catalog

Class XM_CATALOG


Direct ancestors

XM_SHARED_CATALOG_MANAGER, XM_STRING_MODE, XM_CALLBACKS_NULL, UT_URL_ENCODING, XM_FORMAL_PUBLIC_IDENTIFIER_ROUTINES, KL_SHARED_FILE_SYSTEM, UC_SHARED_STRING_EQUALITY_TESTER

Creation

Features

Invariants

indexing

description

Objects that represent an OASIS ETRC XML Catalog

library

Gobo Eiffel XML Library

copyright

Copyright (c) 2004, Colin Adams and others

license

Eiffel Forum License v2 (see forum.txt)

date

$Date: 2005/07/13 19:49:00 $

revision

$Revision: 1.10 $

class

XM_CATALOG

inherit

XM_SHARED_CATALOG_MANAGER
XM_STRING_MODE
XM_CALLBACKS_NULL
UT_URL_ENCODING
XM_FORMAL_PUBLIC_IDENTIFIER_ROUTINES
KL_SHARED_FILE_SYSTEM
UC_SHARED_STRING_EQUALITY_TESTER

create

make (a_base_uri: UT_URI)

-- Establish invariant.

require
base_uri_not_void: a_base_uri /= Void
ensure
base_uri_set: base_uri = a_base_uri

feature -- Access

resolved_fpi (a_public_id: STRING; prefer_public_required: BOOLEAN): STRING

-- Resolved URI for a_public_id

require
public_id_not_void: a_public_id /= Void
ensure
result_may_be_void_if_not_match: True
resolved_fsi (a_system_id: STRING): STRING

-- Resolved URI for a_system_id

require
system_id_not_void: a_system_id /= Void
ensure
result_may_be_void_if_not_match: True
resolved_uri (a_uri_reference: STRING): STRING

-- Resolved URI for a_uri_reference

require
uri_reference_not_void: a_uri_reference /= Void
ensure
result_may_be_void_if_not_match: True
shared_catalog_manager: XM_CATALOG_MANAGER

-- Shared catalog manager

-- (From XM_SHARED_CATALOG_MANAGER)

ensure
shared_catalog_manager_not_void: Result /= Void
string_equality_tester: UC_STRING_EQUALITY_TESTER

-- String equality tester

-- (From UC_SHARED_STRING_EQUALITY_TESTER)

ensure
string_equality_tester_not_void: Result /= Void

feature -- Status report

delegated: BOOLEAN

-- Has delegation FROM this catalog taken place?

is_error: BOOLEAN

-- Did read detect an error?

is_string_mode_ascii: BOOLEAN

-- Is string mode set to ascii only?
-- This means that all strings issued by this source
-- will be of dynamic type STRING.

-- (From XM_STRING_MODE)

is_string_mode_latin1: BOOLEAN

-- Is string mode set to latin-1 only?
-- This means that all strings issued by this source
-- will be of dynamic type STRING.

-- (From XM_STRING_MODE)

is_string_mode_mixed: BOOLEAN

-- Is string mode set to polymorphic strings?
-- This means that strings issued by this source will
-- be of dynamic type STRING for ascii, and dynamic
-- type UC_STRING or descendant when characters >127
-- are present in that string.

-- (From XM_STRING_MODE)

is_string_mode_unicode: BOOLEAN

-- Is string mode set to UC_STRING only?
-- This means that all strings issued by this source
-- will be of a dynamic type UC_STRING or descendant.

-- (From XM_STRING_MODE)

same_string_mode (other: XM_STRING_MODE): BOOLEAN

-- Is other with the same string mode?

-- (From XM_STRING_MODE)

require
other_not_void: other /= Void

feature -- Status setting

set_string_mode_ascii

-- Set all strings issued by this source to be ascii
-- (all characters <= 127) and be of dynamic type STRING.
-- The source will be in an error state if it has
-- characters that do not fit in a STRING.

-- (From XM_STRING_MODE)

ensure
string_mode_set: is_string_mode_ascii
set_string_mode_latin1

-- Set all strings issued by this source to be latin-1
-- (all characters <= 255) and be of dynamic type STRING.
-- The source will be in an error state if it has
-- characters that do not fit in a STRING.

-- (From XM_STRING_MODE)

ensure
string_mode_set: is_string_mode_latin1
set_string_mode_mixed

-- Set all strings issued by this source to be either of
-- type UC_STRING or descendant if they contain characters
-- >127 or of dynamic type STRING otherwise.
-- The client receiving these strings will have to
-- be careful about polymorphically unsafe features
-- of STRING, like append_string.

-- (From XM_STRING_MODE)

ensure
string_mode_set: is_string_mode_mixed
set_string_mode_unicode

-- Set all strings issued by this source to be of
-- dynamic type UC_STRING or descendant.

-- (From XM_STRING_MODE)

ensure
string_mode_set: is_string_mode_unicode

feature -- Conversion

normalized_fpi (an_fpi: STRING): STRING

-- Normalized version of an_fpi.

-- (From XM_FORMAL_PUBLIC_IDENTIFIER_ROUTINES)

require
public_identifier_is_ascii: an_fpi /= Void
urn_to_fpi (a_publicid_urn: STRING) : STRING

-- Unwrapped urn:publicid: URN

-- (From XM_FORMAL_PUBLIC_IDENTIFIER_ROUTINES)

require
public_id_urn: a_publicid_urn /= Void and then a_publicid_urn.substring_index (

urn:publicid:

, 1) = 1
ensure
fpi_not_void: result /= Void

feature -- Events

on_attribute (a_namespace: STRING; a_prefix: STRING; a_local_part: STRING; a_value: STRING)

-- Start of attribute

-- (From XM_CALLBACKS)

require
unresolved_namespace_is_void: has_resolved_namespaces implies a_namespace /= Void
local_part: is_local_part (a_local_part)
a_value_not_void: a_value /= Void
on_content (a_content: STRING)

-- Text content.

-- (From XM_CALLBACKS)

require
not_void: a_content /= Void
not_empty: a_content.count >= 0
on_end_tag (a_namespace: STRING; a_prefix: STRING; a_local_part: STRING)

-- End tag.

-- (From XM_CALLBACKS)

require
unresolved_namespace_is_void: has_resolved_namespaces implies a_namespace /= Void
local_part: is_local_part (a_local_part)
on_start_tag (a_namespace: STRING; a_prefix: STRING; a_local_part: STRING)

-- Start of start tag.

-- (From XM_CALLBACKS)

require
unresolved_namespace_is_void: has_resolved_namespaces implies a_namespace /= Void
local_part: is_local_part (a_local_part)
on_start_tag_finish

-- End of start tag.

-- (From XM_CALLBACKS)

feature -- Meta

on_comment (a_content: STRING)

-- Processing comment.
-- Atomic: single comment produces single event

-- (From XM_CALLBACKS)

require
a_content_not_void: a_content /= Void
on_processing_instruction (a_name: STRING; a_content: STRING)

-- Processing instruction.

-- (From XM_CALLBACKS)

require
name_not_void: a_name /= Void
content_not_void: a_content /= Void

feature -- Errors

on_error (a_message: STRING)

-- Event producer detected an error.

-- (From XM_CALLBACKS)

require
not_void: a_message /= Void

feature -- Document

on_finish

-- Called when parsing finished.

-- (From XM_CALLBACKS)

on_start

-- Called when parsing starts.

-- (From XM_CALLBACKS)

on_xml_declaration (a_version: STRING; an_encoding: STRING; a_standalone: BOOLEAN)

-- XML declaration.

-- (From XM_CALLBACKS)

require
a_version_not_void: a_version /= Void
a_version_not_empty: a_version.count > 0

feature -- Copy

copy_string_mode (other: XM_STRING_MODE)

-- Copy string mode.

-- (From XM_STRING_MODE)

require
other_not_void: other /= Void
ensure
copied: same_string_mode (other)

feature -- Assertion

has_resolved_namespaces: BOOLEAN

-- Does this callback event consumer expect resolved
-- namespaces?
-- If True, it must be located downstream of a filter
-- or source producing resolved namespaces such
-- as XM_NAMESPACE_RESOLVER.

-- (From XM_CALLBACKS)

feature -- Support

has_namespace (a: STRING): BOOLEAN

-- Is namespace resolved?

-- (From XM_CALLBACKS)

has_prefix (a: STRING): BOOLEAN

-- Is prefix in use?

-- (From XM_CALLBACKS)

is_local_part (a: STRING): BOOLEAN

-- Is this a valid local part string?

-- (From XM_CALLBACKS)

ensure
definition: Result = (a /= Void and then a.count > 0)

feature -- Valid characters

has_excluded_characters (s: STRING): BOOLEAN

-- Does s contain excluded characters?
-- Note that the escape character '%' is not considered excluded.

-- (From UT_URL_ENCODING)

require
s_not_void: s /= Void
is_valid_scheme (a_scheme: STRING): BOOLEAN

-- Is a_scheme a valid scheme?

-- (From UT_URL_ENCODING)

feature -- Character sets

default_unescaped: DS_HASH_SET [CHARACTER]

-- Default character set not to escape

-- (From UT_URL_ENCODING)

rfc_digit_characters: STRING

-- RFC 2396 'digit' characters

-- (From UT_URL_ENCODING)

rfc_extra_reserved_characters: STRING

-- RFC 2732 addition to 'reserved' characters

-- (From UT_URL_ENCODING)

rfc_lowalpha_characters: STRING

-- RFC 2396 'lowalpha' characters

-- (From UT_URL_ENCODING)

rfc_mark_characters: STRING

-- RFC 2396 'mark' characters

-- (From UT_URL_ENCODING)

rfc_reserved_characters: STRING

-- RFC 2396 'reserved' characters

-- (From UT_URL_ENCODING)

rfc_upalpha_characters: STRING

-- RFC 2396 'lowalpha' characters

-- (From UT_URL_ENCODING)

maximum_character_code_in_string (a_string: STRING): INTEGER

-- Maximum character code used in string

-- (From UT_URL_ENCODING)

require
a_string_not_void: a_string /= Void
ensure
positive_result: Result >= 0
empty_zero: a_string.is_empty implies Result = 0
new_character_set (some_characters: STRING): DS_HASH_SET [CHARACTER]

-- New set of characters for use with escape_custom

-- (From UT_URL_ENCODING)

require
some_characters_not_void: some_characters /= Void
ensure
set_not_void: Result /= Void
count_set: Result.count = some_characters.count

feature -- Escape/unescape data characters

escape_custom (a_string: STRING; unescaped_chars: DS_SET [CHARACTER]; escape_space_as_plus: BOOLEAN): STRING

-- Escape all characters except those in unescaped_chars in
-- a_string and return a new string.

-- (From UT_URL_ENCODING)

require
a_string_not_void: a_string /= Void
unescaped_chars_not_void: unescaped_chars /= Void
no_high_characters: maximum_character_code_in_string (a_string) < 256
ensure
escape_custom_not_void: Result /= Void
space_as_plus: escape_space_as_plus implies (not Result.has (' ') and (a_string.has (' ') implies Result.has ('+')))
escape_custom_cannot_be_smaller: Result.count >= a_string.count
escape_string (a_string: STRING): STRING

-- Escape reserved characters in a_string and return a new string.

-- (From UT_URL_ENCODING)

require
a_string_not_void: a_string /= Void
no_high_characters: maximum_character_code_in_string (a_string) < 256
ensure
escape_string_not_void: Result /= Void
no_spaces: not Result.has (' ')
escape_string_cannot_be_smaller: Result.count >= a_string.count
escape_utf8 (a_string: STRING): STRING

-- Escape reserved characters in a_string and return a new
-- string. Characters above 128 are converted to UTF8
-- representation before being encoded.

-- (From UT_URL_ENCODING)

require
a_string_not_void: a_string /= Void
ensure
escape_utf8_not_void: Result /= Void
no_spaces: not Result.has (' ')
escape_utf8_cannot_be_smaller: Result.count >= a_string.count
unescape_string (a_string: STRING): STRING

-- Replace the URI hexadecimal escape sequences in a_string
-- with the corresponding characters.

-- (From UT_URL_ENCODING)

require
a_string_not_void: a_string /= Void
ensure
unescaped_string_not_void: Result /= Void
unescaped_string_cannot_be_larger: Result.count <= a_string.count
unescape_utf8 (a_string: STRING): STRING

-- Unescape a_string, and convert UTF8 encoded result to string.

-- (From UT_URL_ENCODING)

require
a_string_not_void: a_string /= Void
ensure
unescape_utf8_not_void: Result /= Void
unescape_utf8_cannot_be_larger: Result.count <= a_string.count

feature -- File systems

file_system: KL_FILE_SYSTEM

-- Underlying file system

-- (From KL_SHARED_FILE_SYSTEM)

ensure
file_system_not_void: Result /= Void
current_file_system: Result.is_current_file_system
unix_file_system: KL_UNIX_FILE_SYSTEM

-- Unix-like file system

-- (From KL_SHARED_FILE_SYSTEM)

ensure
file_system_not_void: Result /= Void
windows_backslash_only_file_system: KL_WINDOWS_FILE_SYSTEM

-- Windows-like file system which accepts only \ as
-- directory separator

-- (From KL_SHARED_FILE_SYSTEM)

ensure
file_system_not_void: Result /= Void
windows_file_system: KL_WINDOWS_FILE_SYSTEM

-- Windows-like file system which accepts both
-- \ and / as directory separator

-- (From KL_SHARED_FILE_SYSTEM)

ensure
file_system_not_void: Result /= Void

feature {XM_STRING_MODE} -- Implementation

string_mode: INTEGER

-- STRING/UC_STRING mode

-- (From XM_STRING_MODE)

invariant

local_catalog_files_not_void: local_catalog_files /= Void
system_rewrite_rules_not_void: system_rewrite_rules /= Void
uri_rewrite_rules_not_void: uri_rewrite_rules /= Void
uri_delegates_not_void: uri_delegates /= Void
system_delegates_not_void: system_delegates /= Void
public_delegates_not_void: public_delegates /= Void
base_uri_not_void: base_uri /= Void
system_id_not_void: system_id /= Void
mixed_mode: is_string_mode_mixed
attribute_triples: attribute_namespaces /= Void implies attribute_local_parts /= Voidand then attribute_values /= Void and then attribute_values.count = attribute_local_parts.countand then attribute_local_parts.count = attribute_namespaces.count
system_entries_not_void: system_entries /= Void
uri_entries_not_void: uri_entries /= Void
public_entries_not_void: public_entries /= Void
prefer_public_entries_not_void: prefer_public_entries /= Void
element_name_stack_not_void: element_name_stack /= Void

-- From ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)

mode_set: BOOLEAN_.nxor (<<is_string_mode_ascii, is_string_mode_mixed, is_string_mode_unicode, is_string_mode_latin1>>)

end