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

xml.tree

Class XM_NAMESPACE


Direct ancestors

HASHABLE, KL_IMPORTED_STRING_ROUTINES

Creation

Features

Invariants

indexing

description

XML namespace declaration, equality and hashable based on uri only

library

Gobo Eiffel XML Library

copyright

Copyright (c) 2001, Andreas Leitner and others

license

Eiffel Forum License v2 (see forum.txt)

date

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

revision

$Revision: 1.25 $

class

XM_NAMESPACE

inherit

HASHABLE

create

make (a_prefix: like ns_prefix; a_uri: like uri)

-- Create a new namespace declaration.

require
uri_not_void: a_uri /= Void
ensure
ns_prefix_set: ns_prefix = a_prefix
uri_set: uri = a_uri
make_default

-- Make default namespace (empty URI)

ensure
no_prefix: not has_prefix
default_namespace: uri.count = 0

feature -- Access

ns_prefix: STRING

-- Prefix of current namespace

uri: STRING

-- Namespace URI

feature -- Status report

has_prefix: BOOLEAN

-- Is there an explicit prefix?
-- (not a default namespace declaration)

ensure
definition: Result = (ns_prefix /= Void and then ns_prefix.count > 0)
hash_code: INTEGER

-- Hash code of URI.

-- (From HASHABLE)

ensure
good_hash_value: Result >= 0
is_equal (other: like Current): BOOLEAN

-- Are the two namespaces equal?

-- (From ANY)

require
other_not_void: other /= Void
ensure
symmetric: Result implies other.is_equal (Current)
consistent: standard_is_equal (other) implies Result
ensure then
definition: Result = STRING_.same_string (uri, other.uri)
is_hashable: BOOLEAN

-- May current object be hashed?
-- (True if it is not its type's default.)

-- (From HASHABLE)

ensure
ok_if_not_default: Result implies (Current /= default)
out: STRING

-- Out.

-- (From ANY)

same_prefix (other: XM_NAMESPACE): BOOLEAN

-- Same

ensure
equal: Result implies is_equal (other)
same_prefix: Result implies(ns_prefix = other.ns_prefix or else STRING_.same_string (ns_prefix, other.ns_prefix))

invariant

uri_not_void: uri /= Void

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

end