foxy_xml_tag
FoXy XML tag class.
Source: src/lib/foxy_xml_tag.F90
Dependencies
Contents
- xml_tag
- attribute_pair
- tag_builder
- xml_tag
- add_child_id
- free
- get_content
- parse
- set
- write_tag
- add_single_attribute
- add_attribute_value
- add_multiple_attributes
- add_stream_attributes
- delete_content
- delete_single_attribute
- delete_multiple_attributes
- scan_tag
- tag_content
- tag_start_tag
- tag_attribute
- tag_start_tag_end
- tag_end_tag
- tag_data
- tag_problem
- assign_tag
- finalize
- create_tag_flat
- create_tag_nested
- attributes
- end_tag
- get_attribute_name
- get_attributes_number
- get_attribute
- get_id
- get_tail
- get_parent_id
- get_indent
- get_level
- get_pos
- is_attribute_present
- is_parsed
- is_content_markup
- is_named
- name
- self_closing_tag
- start_tag
- stringify
Derived Types
xml_tag
XML tag class.
A valid XML tag must have the following syntax for a tag without a content (with only attributes):
<Tag_Name att#1_Name="att#1_val" att#2_Name="att#2_val"... att#Nt_Name="att#Nt_val"/>while a tag with a content must have the following syntax:
<Tag_Name att#1_Name="att#1_val" att#2_Name="att#2_val"... att#Nt_Name="att#Nt_val">Tag_Content</Tag_Name>It is worth noting that the syntax is case sensitive and that the attributes are optional. Sources (parse, get_content, attributes streams) are read by the document tokenizer: attribute values are single or double quoted, blanks are allowed around =.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
tag_name | type(string) | Tag name. | |
tag_content | type(string) | Tag content. | |
tag_tail | type(string) | Text after the end tag, up to the next sibling or the | |
pos | integer(kind=I8P) | Characters position (in source) indexes (start, content, end). | |
attribute | type(string) | allocatable | Attributes names/values pairs, [1:2, 1:]. |
attributes_number | integer(kind=I4P) | Number of defined attributes. | |
indent | integer(kind=I4P) | Number of indent-white-spaces. | |
is_self_closing | logical | Self closing tag flag. | |
level | integer(kind=I4P) | Tag hierarchy level. | |
id | integer(kind=I4P) | Uniq tag ID. | |
parent_id | integer(kind=I4P) | Uniq ID of parent tag. | |
children_number | integer(kind=I4P) | Number of children tags. | |
child_id | integer(kind=I4P) | allocatable | Uniq ID of children tags. |
Type-Bound Procedures
| Name | Attributes | Description |
|---|---|---|
add_attributes | Add attributes name/value pairs. | |
add_child_id | pass(self) | Add child ID to children IDs list. |
attributes | pass(self) | Return attributes name/value pairs as string. |
delete_attributes | Delete attributes name/value pairs. | |
delete_content | pass(self) | Delete tag conent. |
end_tag | pass(self) | Return `` end tag. |
free | pass(self) | Free (reset) tag. |
get_content | pass(self) | Return tag content. |
get_attribute | pass(self) | Return the value of the attribute named name. |
get_attribute_name | pass(self) | Return the name of the attribute with a given index. |
get_attributes_number | pass(self) | Return the number of attributes. |
get_id | pass(self) | Return tag uniq ID. |
get_indent | pass(self) | Return tag indentation. |
get_level | pass(self) | Return tag hierarchy level. |
get_parent_id | pass(self) | Return parent tag uniq ID. |
get_pos | pass(self) | Return tag positions in the source. |
get_tail | pass(self) | Return the text after the end tag. |
is_attribute_present | pass(self) | Return .true. it the queried attribute name is defined. |
is_named | pass(self) | Return .true. if the tag is named name. |
is_content_markup | pass(self) | Return .true. if the content may hold markup. |
is_parsed | pass(self) | Check is tag is correctly parsed, i.e. its tag_name is allocated. |
name | pass(self) | Return tag name. |
parse | pass(self) | Parse the tag contained into a source string. |
self_closing_tag | pass(self) | Return `` self closing tag. |
set | pass(self) | Set tag data. |
start_tag | pass(self) | Return `` start tag. |
stringify | pass(self) | Convert the whole tag into a string. |
write | pass(self) | Write tag to unit file. |
assignment(=) | Assignment operator overloading. | |
add_single_attribute | pass(self) | Add one attribute name/value pair. |
add_attribute_value | pass(self) | Add one attribute, value stored exactly. |
add_multiple_attributes | pass(self) | Add list of attributes name/value pairs. |
add_stream_attributes | pass(self) | Add list of attributes name/value pairs passed as stream. |
delete_single_attribute | pass(self) | Delete one attribute name/value pair. |
delete_multiple_attributes | pass(self) | Delete list of attributes name/value pairs. |
assign_tag | pass(lhs) | Assignment between two tags. |
attribute_pair
An attribute of the found tag.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
name | character(len=:) | allocatable | Attribute name. |
value | character(len=:) | allocatable | Attribute value. |
tag_builder
Builder of a single tag of a source, driven by the tokenizer: the first tag or, if name is allocated, the first tag with that name (tags inside CDATA sections, comments and PIs excluded); the tokenizer stops once it is complete.
@note The found tag is held by plain components, not by an xml_tag: nvfortran corrupts a local builder holding one.
Inheritance
Extends: xml_builder
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
is_stopped | logical | Set by the builder to stop the tokenizer (checked after each complete start or end tag). | |
name | character(len=:) | allocatable | Name of the searched tag, unallocated for the first tag. |
sanitize | logical | Trim leading and trailing spaces of attribute values. | |
tag_name | character(len=:) | allocatable | Found tag name. |
pairs | type(attribute_pair) | allocatable | Found tag attributes. |
na | integer(kind=I4P) | Number of attributes of the found tag. | |
id | integer(kind=I4P) | Tokenizer ID of the found tag, 0 if none. | |
start | integer(kind=I8P) | Position of the start tag <. | |
open_end | integer(kind=I8P) | Position of the start tag >, 0 if unterminated. | |
end_start | integer(kind=I8P) | Position of the end tag <, 0 if none. | |
end_end | integer(kind=I8P) | Position of the end tag >, 0 if none. | |
is_self_closing | logical | The found tag is self closing. |
Type-Bound Procedures
| Name | Attributes | Description |
|---|---|---|
start_tag | pass(self) | A start tag begins. |
attribute | pass(self) | An attribute of the current start tag. |
start_tag_end | pass(self) | The current start tag is complete. |
end_tag | pass(self) | An open tag is closed by its end tag. |
data | pass(self) | Character data or other markup: ignored. |
problem | pass(self) | A problem of malformed input: ignored. |
Interfaces
xml_tag
Overload xml_tag with creator procedures.
Module procedures: create_tag_flat, create_tag_nested
Subroutines
add_child_id
Add child ID to children IDs list.
Attributes: pure
subroutine add_child_id(self, child_id)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_tag) | inout | XML tag. | |
child_id | integer(kind=I4P) | in | Child ID. |
Call graph
free
Free (reset) tag.
Attributes: elemental
subroutine free(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_tag) | inout | XML tag. |
get_content
Return tag content of self (or its nested tags) if named name.
@note A nested tag is the first tag named name in the content string (tags inside CDATA sections, comments and PIs excluded); its content is returned raw, as in the string. @note If there is no value, the content string is returned deallocated.
Attributes: pure
subroutine get_content(self, name, content)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_tag) | in | XML tag. | |
name | character(len=*) | in | Searched tag name. | |
content | character(len=:) | out | allocatable | Tag content. |
Call graph
parse
Parse the first tag contained into a source string: its name, attributes (values as in the source) and content (raw, nested tags included); the other tags eventually present are omitted.
Valid syntax are:
<tag_name att1="att1 val" att2='att2 val'...>...</tag_name><tag_name att1="att1 val" att2='att2 val'.../>
@note The source is read by the document tokenizer: <, >, = and the other quote kind are allowed in attribute values, the content ends at the matching end tag (nested tags with the same name included) or, if the tag is unclosed, at the source end. The tag positions pos are set; the name, attributes and content are replaced (the name is unallocated if there is no tag).
Attributes: elemental
subroutine parse(self, source, tstart, tend)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_tag) | inout | XML tag. | |
source | character(len=*) | in | String containing the input. | |
tstart | integer(kind=I8P) | out | optional | Starting index of tag inside the string, 0 if there is no tag. |
tend | integer(kind=I8P) | out | optional | Ending index of tag inside the string, 0 if there is no tag. |
Call graph
set
Set tag data.
Attributes: pure
subroutine set(self, name, attribute, attributes, attributes_stream, sanitize_attributes_value, content, pos, indent, is_content_indented, is_self_closing, id, level, parent_id, attributes_stream_alloc, content_alloc, tail, attribute_name, attribute_value)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_tag) | inout | XML tag. | |
name | character(len=*) | in | optional | Tag name. |
attribute | character(len=*) | in | optional | Attribute name/value pair [1:2]. |
attributes | character(len=*) | in | optional | Attributes list of name/value pairs [1:2,1:]. |
attributes_stream | character(len=*) | in | optional | Attributes list of name/value pairs as stream. |
sanitize_attributes_value | logical | in | optional | Sanitize attributes value. |
content | character(len=*) | in | optional | Tag value. |
pos | integer(kind=I8P) | in | optional | Characters position (in source) indexes. |
indent | integer(kind=I4P) | in | optional | Number of indent-white-spaces. |
is_content_indented | logical | in | optional | Activate value indentation. |
is_self_closing | logical | in | optional | The tag is self closing. |
id | integer(kind=I4P) | in | optional | Uniq ID. |
level | integer(kind=I4P) | in | optional | Tag hierarchy level. |
parent_id | integer(kind=I4P) | in | optional | Parent uniq ID. |
attributes_stream_alloc | character(len=:) | in | allocatable, optional | Attributes list stream, allocatable input. |
content_alloc | character(len=:) | in | allocatable, optional | Tag value, allocatable input. |
tail | character(len=*) | in | optional | Text after the end tag. |
attribute_name | character(len=*) | in | optional | Attribute name, with attribute_value. |
attribute_value | character(len=*) | in | optional | Attribute value, stored exactly (unless |
Call graph
write_tag
Write tag to unit file.
@note form is 'UNFORMATTED' (the default, a stream unit) or 'FORMATTED', in any case: another one writes nothing, iostat is XML_BAD_VALUE. @note Without iostat, an error (a bad form, a failed write) stops the program with its message, as Fortran I/O statements do.
subroutine write_tag(self, unit, is_indented, is_content_indented, form, end_record, only_start, only_content, only_end, iostat, iomsg)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_tag) | in | XML tag. | |
unit | integer(kind=I4P) | in | File unit. | |
is_indented | logical | in | optional | Activate content indentation. |
is_content_indented | logical | in | optional | Activate content indentation. |
form | character(len=*) | in | optional | Format. |
end_record | character(len=*) | in | optional | Ending record. |
only_start | logical | in | optional | Write only start tag. |
only_content | logical | in | optional | Write only content. |
only_end | logical | in | optional | Write only end tag. |
iostat | integer(kind=I4P) | out | optional | IO status. |
iomsg | character(len=*) | out | optional | IO message. |
Call graph
add_single_attribute
Add one attribute name/value pair.
@note Leading and trailing white spaces are trimmed out by attribute's name. @note The pair elements have the same length: a value shorter than the name is padded with trailing spaces (use add_attribute_value to store a value exactly).
Attributes: pure
subroutine add_single_attribute(self, attribute, sanitize_value)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_tag) | inout | XML tag. | |
attribute | character(len=*) | in | Attribute name/value pair [1:2]. | |
sanitize_value | logical | in | optional | Sanitize attribute value. |
Call graph
add_attribute_value
Add one attribute, or update its value if already present; the value is stored exactly, unless sanitized (leading and trailing spaces trimmed).
Attributes: pure
subroutine add_attribute_value(self, name, value, sanitize_value)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_tag) | inout | XML tag. | |
name | character(len=*) | in | Attribute name. | |
value | character(len=*) | in | Attribute value. | |
sanitize_value | logical | in | optional | Sanitize attribute value. |
Call graph
add_multiple_attributes
Add list of attributes name/value pairs.
Attributes: pure
subroutine add_multiple_attributes(self, attributes, sanitize_values)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_tag) | inout | XML tag. | |
attributes | character(len=*) | in | Attribute name/value pair list [1:2,1:]. | |
sanitize_values | logical | in | optional | Sanitize attribute values. |
Call graph
add_stream_attributes
Add list of attributes name/value pairs passed as stream, e.g. x="1" y='a > b'.
@note The stream is read by the document tokenizer as the attributes of a start tag: values are single or double quoted (<, >, = and the other quote kind allowed), blanks are allowed around =; values are stored as in the stream (unless sanitized), an existing attribute is updated.
Attributes: pure
subroutine add_stream_attributes(self, attributes_stream, sanitize_values)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_tag) | inout | XML tag. | |
attributes_stream | character(len=*) | in | Attribute name/value pair list passed as stream. | |
sanitize_values | logical | in | optional | Sanitize attribute values. |
Call graph
delete_content
Delete tag content.
Attributes: pure
subroutine delete_content(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_tag) | inout | XML tag. |
delete_single_attribute
Delete one attribute name/value pair.
Attributes: pure
subroutine delete_single_attribute(self, name)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_tag) | inout | XML tag. | |
name | character(len=*) | in | Attribute name. |
Call graph
delete_multiple_attributes
Delete list of attributes name/value pairs.
Attributes: pure
subroutine delete_multiple_attributes(self, name)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_tag) | inout | XML tag. | |
name | character(len=*) | in | Attributes names. |
Call graph
scan_tag
Scan a source for its first tag or, if name is passed, its first tag with that name.
Attributes: pure
subroutine scan_tag(source, sanitize, builder, name)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
source | character(len=*) | in | Source. | |
sanitize | logical | in | Trim leading and trailing spaces of attribute values. | |
builder | type(tag_builder) | out | Single tag builder, the found tag. | |
name | character(len=*) | in | optional | Name of the searched tag. |
Call graph
tag_content
Return the content (raw) of the tag found by a builder: up to its end tag or, if unclosed, to the source end; unallocated if it is self closing or empty.
Attributes: pure
subroutine tag_content(source, builder, content)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
source | character(len=*) | in | Source. | |
builder | type(tag_builder) | in | Single tag builder, the found tag. | |
content | character(len=:) | out | allocatable | Tag content. |
Call graph
tag_start_tag
A start tag begins: it is the found tag if none is found yet and it is the searched one.
Attributes: pure
subroutine tag_start_tag(self, id, parent_id, level, name, start)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(tag_builder) | inout | Single tag builder. | |
id | integer(kind=I4P) | in | Tag ID (start tags count). | |
parent_id | integer(kind=I4P) | in | Parent tag ID, 0 for a root tag. | |
level | integer(kind=I4P) | in | Tag level, 1 for a root tag. | |
name | character(len=*) | in | Tag name. | |
start | integer(kind=I8P) | in | Position of <. |
tag_attribute
An attribute of the current start tag: stored if it is of the found tag.
Attributes: pure
subroutine tag_attribute(self, id, name, value)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(tag_builder) | inout | Single tag builder. | |
id | integer(kind=I4P) | in | Tag ID. | |
name | character(len=*) | in | Attribute name. | |
value | character(len=*) | in | Attribute value. |
tag_start_tag_end
The current start tag is complete: a found self closing tag is complete, the tokenizer stops.
Attributes: pure
subroutine tag_start_tag_end(self, id, start, open_end, is_self_closing)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(tag_builder) | inout | Single tag builder. | |
id | integer(kind=I4P) | in | Tag ID. | |
start | integer(kind=I8P) | in | Position of <. | |
open_end | integer(kind=I8P) | in | Position of >. | |
is_self_closing | logical | in | The tag is self closing. |
tag_end_tag
An open tag is closed by its end tag: the found tag is complete, the tokenizer stops.
Attributes: pure
subroutine tag_end_tag(self, id, start, open_end, end_start, end_end)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(tag_builder) | inout | Single tag builder. | |
id | integer(kind=I4P) | in | Tag ID. | |
start | integer(kind=I8P) | in | Position of the start tag <. | |
open_end | integer(kind=I8P) | in | Position of the start tag >. | |
end_start | integer(kind=I8P) | in | Position of the end tag <. | |
end_end | integer(kind=I8P) | in | Position of the end tag >. |
tag_data
Character data or other markup: ignored (the content is cut from the source).
Attributes: pure
subroutine tag_data(self, kind, chars, first)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(tag_builder) | inout | Single tag builder. | |
kind | integer(kind=I4P) | in | Data kind, DATA_*. | |
chars | character(len=*) | in | Characters, as in the source. | |
first | integer(kind=I8P) | in | Position of the first character. |
tag_problem
A problem of malformed input: ignored (parsing is tolerant).
Attributes: pure
subroutine tag_problem(self, pos, message)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(tag_builder) | inout | Single tag builder. | |
pos | integer(kind=I8P) | in | Position of the problem. | |
message | character(len=*) | in | Problem description. |
assign_tag
Assignment between two tags.
Attributes: elemental
subroutine assign_tag(lhs, rhs)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
lhs | class(xml_tag) | inout | Left hand side. | |
rhs | type(xml_tag) | in | Right hand side. |
finalize
Free dynamic memory when finalizing.
Attributes: elemental
subroutine finalize(tag)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
tag | type(xml_tag) | inout | XML tag. |
Functions
create_tag_flat
Return an instance of xml tag.
Attributes: pure
Returns: type(xml_tag)
function create_tag_flat(name, attribute, attributes, attributes_stream, sanitize_attributes_value, pos, content, indent, is_content_indented, is_self_closing, id, level, parent_id, attributes_stream_alloc, content_alloc) result(tag)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
name | character(len=*) | in | Tag name. | |
attribute | character(len=*) | in | optional | Attribute name/value pair [1:2]. |
attributes | character(len=*) | in | optional | Attributes list of name/value pairs [1:2,1:]. |
attributes_stream | character(len=*) | in | optional | Attributes list as single stream. |
sanitize_attributes_value | logical | in | optional | Sanitize attributes value. |
pos | integer(kind=I8P) | in | optional | Characters position (in source) indexes. |
content | character(len=*) | in | optional | Tag value. |
indent | integer(kind=I4P) | in | optional | Number of indent-white-spaces. |
is_content_indented | logical | in | optional | Activate content indentation. |
is_self_closing | logical | in | optional | The tag is self closing. |
id | integer(kind=I4P) | in | optional | Uniq ID. |
level | integer(kind=I4P) | in | optional | Tag hierarchy level. |
parent_id | integer(kind=I4P) | in | optional | Parent uniq ID. |
attributes_stream_alloc | character(len=:) | in | allocatable, optional | Attributes list stream, allocatable input. |
content_alloc | character(len=:) | in | allocatable, optional | Tag value, allocatable input. |
Call graph
create_tag_nested
Return an instance of xml tag with value being a nested tag.
Attributes: pure
Returns: type(xml_tag)
function create_tag_nested(name, content, attribute, attributes, attributes_stream, sanitize_attributes_value, pos, indent, is_content_indented, id, level, parent_id, attributes_stream_alloc, content_alloc) result(tag)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
name | character(len=*) | in | Tag name. | |
content | type(xml_tag) | in | Tag value as nested tag.. | |
attribute | character(len=*) | in | optional | Attribute name/value pair [1:2]. |
attributes | character(len=*) | in | optional | Attributes list of name/value pairs [1:2,1:]. |
attributes_stream | character(len=*) | in | optional | Attributes list as single stream. |
sanitize_attributes_value | logical | in | optional | Sanitize attributes value. |
pos | integer(kind=I8P) | in | optional | Characters position (in source) indexes. |
indent | integer(kind=I4P) | in | optional | Number of indent-white-spaces. |
is_content_indented | logical | in | optional | Activate value indentation. |
id | integer(kind=I4P) | in | optional | Uniq ID. |
level | integer(kind=I4P) | in | optional | Tag hierarchy level. |
parent_id | integer(kind=I4P) | in | optional | Parent uniq ID. |
attributes_stream_alloc | character(len=:) | in | allocatable, optional | Attributes list stream, allocatable input. |
content_alloc | character(len=:) | in | allocatable, optional | Tag value, allocatable input. |
Call graph
attributes
Return attributes name/value pairs as string, '' if the tag has none.
Attributes: pure
Returns: character(len=:)
function attributes(self) result(att_)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_tag) | in | XML tag. |
Call graph
end_tag
Return </tag_name> end tag.
Attributes: pure
Returns: character(len=:)
function end_tag(self, is_indented) result(tag_)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_tag) | in | XML tag. | |
is_indented | logical | in | optional | Activate content indentation. |
Call graph
get_attribute_name
Return the name of the attribute with index a (1 for the first one, in source order), empty if it does not exist.
Attributes: pure
Returns: character(len=:)
function get_attribute_name(self, a) result(name)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_tag) | in | XML tag. | |
a | integer(kind=I4P) | in | Attribute index. |
Call graph
get_attributes_number
Return the number of attributes.
Attributes: elemental
Returns: integer(kind=I4P)
function get_attributes_number(self) result(number)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_tag) | in | XML tag. |
Call graph
get_attribute
Return the value of the attribute named name.
@note If the attribute is not defined (or has no value), an empty string is returned. The value is normalized as by XML 1.0 (3.3.3), for attributes of CDATA type: each literal blank (tab, new line, carriage return, a CR LF pair as one) becomes a space, then character references are decoded (blanks written as references are kept).
Attributes: pure
Returns: character(len=:)
function get_attribute(self, name) result(value)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_tag) | in | XML tag. | |
name | character(len=*) | in | Attribute name. |
Call graph
get_id
Return tag uniq ID.
Attributes: elemental
Returns: integer(kind=I4P)
function get_id(self) result(id)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_tag) | in | XML tag. |
Call graph
get_tail
Return the text after the end tag (mixed content), an empty string if none.
Attributes: pure
Returns: character(len=:)
function get_tail(self) result(tail)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_tag) | in | XML tag. |
Call graph
get_parent_id
Return parent tag uniq ID.
Attributes: elemental
Returns: integer(kind=I4P)
function get_parent_id(self) result(parent_id)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_tag) | in | XML tag. |
Call graph
get_indent
Return tag indentation (number of spaces).
Attributes: elemental
Returns: integer(kind=I4P)
function get_indent(self) result(indent)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_tag) | in | XML tag. |
Call graph
get_level
Return tag hierarchy level.
Attributes: elemental
Returns: integer(kind=I4P)
function get_level(self) result(level)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_tag) | in | XML tag. |
Call graph
get_pos
Return tag positions in the source: start tag <, start tag >, end tag < (-1 if self closing, 0 if unclosed).
Attributes: pure
Returns: integer(kind=I8P)
function get_pos(self) result(pos)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_tag) | in | XML tag. |
Call graph
is_attribute_present
Return .true. it the queried attribute name is defined, .false. otherwise.
Attributes: pure
Returns: logical
function is_attribute_present(self, name) result(is_present)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_tag) | in | XML tag. | |
name | character(len=*) | in | Attribute name. |
Call graph
is_parsed
Check is tag is correctly parsed, i.e. its tag_name is allocated.
Attributes: elemental
Returns: logical
function is_parsed(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_tag) | in | XML tag. |
is_content_markup
Return true if the content holds a < (it may hold markup, e.g. nested tags), without copying it.
Attributes: elemental
Returns: logical
function is_content_markup(self) result(is_markup)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_tag) | in | XML tag. |
Call graph
is_named
Return true if the tag is named name (no copy of the name, for lookups).
Attributes: elemental
Returns: logical
function is_named(self, name) result(is_match)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_tag) | in | XML tag. | |
name | character(len=*) | in | Name. |
Call graph
name
Return tag name.
Attributes: pure
Returns: character(len=:)
function name(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_tag) | in | XML tag. |
Call graph
self_closing_tag
Return <tag_name.../> self closing tag.
Attributes: pure
Returns: character(len=:)
function self_closing_tag(self, is_indented) result(tag_)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_tag) | in | XML tag. | |
is_indented | logical | in | optional | Flag to check if tag is indented. |
Call graph
start_tag
Return <tag_name...> start tag.
Attributes: pure
Returns: character(len=:)
function start_tag(self, is_indented) result(tag_)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_tag) | in | XML tag. | |
is_indented | logical | in | optional | Flag to check if tag is indented. |
Call graph
stringify
Convert the whole tag into a string.
Attributes: pure
Returns: character(len=:)
function stringify(self, is_indented, is_content_indented, only_start, only_content, only_end, linearize) result(stringed)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_tag) | in | XML tag. | |
is_indented | logical | in | optional | Activate content indentation. |
is_content_indented | logical | in | optional | Activate content indentation. |
only_start | logical | in | optional | Write only start tag. |
only_content | logical | in | optional | Write only content. |
only_end | logical | in | optional | Write only end tag. |
linearize | logical | in | optional | Return a "linearized" string of tags without the XML hieararchy. |
Call graph