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

xml.formatter

Class XM_UNIQUE_NAMESPACE_PREFIXES


Direct ancestors

XM_NODE_PROCESSOR, XM_MARKUP_CONSTANTS, KL_IMPORTED_STRING_ROUTINES

Features

Invariants

indexing

description

Infer a unique set of namespace prefixes for a document tree

library

Gobo Eiffel XML Library

copyright

Copyright (c) 2003, Eric Bezault and others

license

Eiffel Forum License v2 (see forum.txt)

date

$Date: 2005/06/04 22:34:59 $

revision

$Revision: 1.11 $

class

XM_UNIQUE_NAMESPACE_PREFIXES

inherit

XM_NODE_PROCESSOR

feature -- Node processor.

process_attribute (a_node: XM_ATTRIBUTE)

-- Collect namespaces.

-- (From XM_NODE_PROCESSOR)

require
att_not_void: att /= Void
process_document (a_node: XM_DOCUMENT)

-- Process document.

-- (From XM_NODE_PROCESSOR)

require
doc_not_void: doc /= Void
process_element (a_node: XM_ELEMENT)

-- Collect namespaces.

-- (From XM_NODE_PROCESSOR)

require
e_not_void: e /= Void

feature -- Processing

process_attributes (e: XM_ELEMENT)

-- Process attributes of element e.

-- (From XM_NODE_PROCESSOR)

require
e_not_void: e /= Void
process_character_data (c: XM_CHARACTER_DATA)

-- Process character data c.

-- (From XM_NODE_PROCESSOR)

require
c_not_void: c /= Void
process_comment (com: XM_COMMENT)

-- Process comment com.

-- (From XM_NODE_PROCESSOR)

require
com_not_void: com /= Void
process_processing_instruction (a_pi: XM_PROCESSING_INSTRUCTION)

-- Process processing instruction a_pi.

-- (From XM_NODE_PROCESSOR)

require
a_pi_not_void: a_pi /= Void

feature -- State

namespaces: DS_HASH_TABLE [XM_NAMESPACE, STRING]

-- All of the document namespaces with
-- explicit prefixes (indexed by URI).
-- ensure prefixes are unique.

feature -- Result

has_namespace (a_ns: XM_NAMESPACE): BOOLEAN

-- Is this namespace known (has an allocated prefix)?

require
a_ns_not_void: a_ns /= Void
namespace_declaration (a_ns: XM_NAMESPACE): STRING

-- Single xmlns declaration.

require
a_ns_not_void: a_ns /= Void
ns_prefix (a_ns: XM_NAMESPACE): STRING

-- Prefix for a non default NS.

require
a_ns_not_void: a_ns /= Void
has: has_namespace (a_ns)
item_has_prefix: namespaces.has (a_ns.uri) implies namespaces.item (a_ns.uri).has_prefix
ensure
result_not_void: Result /= Void
result_not_empty: Result.count > 0
top_level_declaration: STRING

-- Top level declaration of all xml namespaces within
-- the document.

require
namespaces_not_void: namespaces /= Void
ensure
not_void_result: Result /= Void

invariant

namespaces_with_prefixes: namespaces /= Void implies prefixes /= Void

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

end