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

xml.tree

Class XM_ATTRIBUTE


Direct ancestors

XM_NAMED_NODE, XM_MARKUP_CONSTANTS, KL_IMPORTED_STRING_ROUTINES

Creation

Features

Invariants

indexing

description

XML attribute nodes

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.23 $

class

XM_ATTRIBUTE

inherit

XM_NAMED_NODE

create

make (a_name: like name; a_ns: like namespace; a_value: like value; a_parent: XM_ELEMENT)

-- Create a new attribute.

require
a_name_not_void: a_name /= Void
a_ns_not_void: a_ns /= Void
a_name_not_empty: a_name.count > 0
a_value_not_void: a_value /= Void
a_parent_not_void: a_parent /= Void
ensure
parent_set: parent = a_parent
name_set: name = a_name
ns_prefix_set: namespace = a_ns
value_set: value = a_value
make_last (a_name: like name; a_ns: like namespace; a_value: like value; a_parent: XM_ELEMENT)

-- Create a new attribute,
-- and add it to parent..

require
a_name_not_void: a_name /= Void
a_ns_not_void: a_ns /= Void
a_name_not_empty: a_name.count > 0
a_value_not_void: a_value /= Void
a_parent_not_void: a_parent /= Void
ensure
parent_set: parent = a_parent
in_parent: parent.last = Current
name_set: name = a_name
ns_prefix_set: namespace = a_ns
value_set: value = a_value

feature -- Access

string_: KL_STRING_ROUTINES

-- Routines that ought to be in class STRING

-- (From KL_IMPORTED_STRING_ROUTINES)

ensure
string_routines_not_void: Result /= Void
name: STRING

-- Name

-- (From XM_NAMED_NODE)

namespace: XM_NAMESPACE

-- Namespace of the name of current node

-- (From XM_NAMED_NODE)

namespace_declaration: XM_NAMESPACE

-- Namespace corresponding to the declaration
-- (Create a new object at each call)

require
is_namespace_declaration: is_namespace_declaration
ensure
namespace_not_void: Result /= Void
ns_prefix: STRING

-- Namespace prefix used to declare the namespace of the
-- name of current node

-- (From XM_NAMED_NODE)

require
has_ns: has_namespace
ensure
definition: Result = namespace.ns_prefix
ns_uri: STRING

-- URI of namespace.

-- (From XM_NAMED_NODE)

require
has_ns: has_namespace
ensure
definition: Result = namespace.uri
parent: XM_COMPOSITE

-- Parent of current node;
-- Void if current node is root

-- (From XM_NODE)

value: STRING

-- Value

feature -- Status report

has_namespace: BOOLEAN

-- Has the name of current node been defined with namespace?

-- (From XM_NAMED_NODE)

ensure
definition: Result = (namespace /= Void)
has_prefix: BOOLEAN

-- Has a prefix been used to define the namespace?
-- (It could also be that the namespace used was the default namespace)

-- (From XM_NAMED_NODE)

ensure
definition: Result = (ns_prefix /= Void and then ns_prefix.count > 0)
has_qualified_name (a_uri: STRING; a_name: STRING): BOOLEAN

-- Does this node match the qualified name?

-- (From XM_NAMED_NODE)

require
a_uri_not_void: a_uri /= Void
a_name_not_void: a_name /= Void
ensure
definition: Result = (STRING_.same_string (a_uri, namespace.uri)and STRING_.same_string (a_name, name))
is_first: BOOLEAN

-- Is this node the first in its parent's child list,
-- or the root node?

-- (From XM_NODE)

ensure
definition: Result = (is_root_node or else (parent.first = Current))
is_last: BOOLEAN

-- Is this node the last in its parent's child list,
-- or the root node?

-- (From XM_NODE)

ensure
definition: Result = (is_root_node or else (parent.last = Current))
is_namespace_declaration: BOOLEAN

-- Is current attribute a namespace declaration?

is_root_node: BOOLEAN

-- Is current node the root node?

-- (From XM_NODE)

ensure
definition: Result = (parent = Void)
level: INTEGER

-- Depth at which current node appears relative to its root
-- (The root node has the level 1.)

-- (From XM_NODE)

ensure
root_level: is_root_node implies (Result = 1)
parent_element: XM_ELEMENT

-- Parent element.

-- (From XM_NODE)

require
not_root_node: not is_root_node
not_root_element: not parent.is_root_node
ensure
result_not_void: Result /= Void
root_node: XM_DOCUMENT

-- Root node of current node

-- (From XM_NODE)

ensure
result_not_void: Result /= Void
same_name (other: XM_NAMED_NODE): BOOLEAN

-- Has current node same name and namespace as other?

-- (From XM_NAMED_NODE)

require
other_not_void: other /= Void
ensure
definition: Result = (same_namespace (other) and same_name (other))
same_namespace (other: XM_NAMED_NODE): BOOLEAN

-- Has current node same namespace as other?

-- (From XM_NAMED_NODE)

require
other_not_void: other /= Void
ensure
equal_namespaces: Result implies (((not has_namespace) and (not other.has_namespace))or else namespace.is_equal (other.namespace))

feature {XM_COMPOSITE} -- Element change

node_set_parent (a_parent: like parent)

-- Set parent to a_parent.

-- (From XM_NODE)

ensure
parent_set: parent = a_parent
set_name (a_name: like name)

-- Set name to a_name.

-- (From XM_NAMED_NODE)

require
a_name_not_void: a_name /= Void
a_name_not_empty: a_name.count > 0
ensure
name_set: name = a_name
set_namespace (a_namespace: like namespace)

-- Set namespace to a_namespace.

-- (From XM_NAMED_NODE)

require
a_namespace_not_void: a_namespace /= Void
ensure
namespace_set: namespace = a_namespace
set_parent (a_parent: like parent)

-- Set parent to a_parent.

-- (From XM_NODE)

require
a_parent_not_void: a_parent /= Void
not_root_node: not is_root_node
ensure
parent_set: parent = a_parent

feature -- Duplication

cloned_object: like Current

-- Clone of current object

-- (From KL_CLONABLE)

ensure
cloned_not_void: Result /= Void
same_type: ANY_.same_types (Result, Current)
is_equal: Result.is_equal (Current)

feature -- Setting

set_value (a_value: like value)

-- Set a_value to value.

require
a_value_not_void: a_value /= Void
ensure
value_set: value = a_value

feature -- Processing

process (a_processor: XM_NODE_PROCESSOR)

-- Process current node with a_processor.

-- (From XM_NODE)

require
a_processor_not_void: a_processor /= Void

invariant

value_not_void: value /= Void

name_not_void: name /= Void
name_not_empty: name.count > 0
has_namespace: has_namespace


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

end