Skip to content

foxy_xml_index ​

FoXy XML index class: scan a file once and read the content of its tags on demand.

The index stores, for each tag of a file, its name, attributes, hierarchy and the positions of its markup in the file, never its content: the memory used does not depend on the data held in the file, which is read in chunks. The content is read afterwards, on demand. The scan can stop after the start tag of a given tag (e.g. AppendedData of VTK files, whose content is raw binary). The queries are the same as xml_file ones (find, find_all, children, ...).

Source: src/lib/foxy_xml_index.f90

Dependencies

Contents ​

Variables ​

NameTypeAttributesDescription
FILE_CHUNK_SIZEinteger(kind=I8P)parameterDefault size of the chunks read from the file (64 KiB).
INITIAL_CAPACITYinteger(kind=I4P)parameterInitial capacity of the tags arrays, doubled when full.

Derived Types ​

xml_index ​

Index of the tags of an XML file.

Components ​

NameTypeAttributesDescription
tagtype(xml_tag)allocatableTags (no content): name, attributes, hierarchy, positions.
lastinteger(kind=I8P)allocatablePosition of the last character of each tag (>), 0 if unclosed.
ntinteger(kind=I4P)Number of tags.
filenamecharacter(len=:)allocatableIndexed file name.
stop_posinteger(kind=I8P)Position after the start tag where the scan stopped, 0 if none.

Type-Bound Procedures ​

NameAttributesDescription
attributepass(self)Return the value of an attribute of the tag with a given ID.
attribute_namepass(self)Return the name of the attribute with a given index of a tag.
attributes_numberpass(self)Return the number of attributes of the tag with a given ID.
childrenpass(self)Return the IDs of the children of the tag with a given ID.
contentpass(self)Return the content of the tag with a given ID, read from the file.
content_rangepass(self)Return the positions in the file of the content of a tag.
findpass(self)Return the ID of the first tag matching a name or a path.
find_allpass(self)Return the IDs of all tags matching a name or a path.
selectpass(self)Return the IDs of the tags selected by a path expression.
freepass(self)Free dynamic memory.
get_attributeGet the value of an attribute as number(s) or logical.
get_contentGet the content of a tag as number(s) or logical.
levelpass(self)Return the level of the tag with a given ID.
local_namepass(self)Return the local name of the tag with a given ID.
matchingpass(self)Filter tags by a regular expression (name, content, attribute).
namepass(self)Return the name of the tag with a given ID.
namespacepass(self)Return the namespace of the tag with a given ID.
parentpass(self)Return the parent ID of the tag with a given ID.
prefixpass(self)Return the name prefix of the tag with a given ID.
scanpass(self)Scan a file, indexing its tags (procedure renamed: nvfortran links
stop_positionpass(self)Return the position after the start tag where the scan stopped.
tags_numberpass(self)Return the number of tags.
text_rangepass(self)Return the positions in the file of the text of a tag.
attribute_textpass(self)Return an attribute value, reporting a missing one.
content_textpass(self)Return a tag content, reporting a missing tag.
get_attribute_I1Ppass(self)
get_attribute_I2Ppass(self)
get_attribute_I4Ppass(self)
get_attribute_I8Ppass(self)
get_attribute_R4Ppass(self)
get_attribute_R8Ppass(self)
get_attribute_logicalpass(self)
get_attribute_I1P_1pass(self)
get_attribute_I2P_1pass(self)
get_attribute_I4P_1pass(self)
get_attribute_I8P_1pass(self)
get_attribute_R4P_1pass(self)
get_attribute_R8P_1pass(self)
get_content_I1Ppass(self)
get_content_I2Ppass(self)
get_content_I4Ppass(self)
get_content_I8Ppass(self)
get_content_R4Ppass(self)
get_content_R8Ppass(self)
get_content_logicalpass(self)
get_content_I1P_1pass(self)
get_content_I2P_1pass(self)
get_content_I4P_1pass(self)
get_content_I8P_1pass(self)
get_content_R4P_1pass(self)
get_content_R8P_1pass(self)

index_builder ​

Builder of the index, driven by the tokenizer: character data are not stored.

Inheritance

Extends: xml_builder

Components ​

NameTypeAttributesDescription
is_stoppedlogicalSet by the builder to stop the tokenizer (checked after each complete start or end tag).
tagtype(xml_tag)allocatableTags.
lastinteger(kind=I8P)allocatablePosition of the last character of each tag.
ntinteger(kind=I4P)Number of tags.
sanitizelogicalTrim leading and trailing spaces of attribute values.
stop_atcharacter(len=:)allocatableName of the tag after whose start tag the scan stops.
stop_posinteger(kind=I8P)Position after the start tag where the scan stopped.
first_problemcharacter(len=:)allocatableFirst problem of malformed input, unallocated if none.
problem_posinteger(kind=I8P)Position of the first problem.

Type-Bound Procedures ​

NameAttributesDescription
start_tagpass(self)A start tag begins.
attributepass(self)An attribute of the current start tag.
start_tag_endpass(self)The current start tag is complete.
end_tagpass(self)An open tag is closed by its end tag.
datapass(self)Character data or other markup: not stored.
problempass(self)A problem of malformed input.

Subroutines ​

content_range ​

Return the positions in the file of the content of the tag with ID id (between its start and end tags, children included); last < first if it is empty (also for a self closing or unclosed tag, or if the tag does not exist).

Attributes: elemental

fortran
subroutine content_range(self, id, first, last)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.
firstinteger(kind=I8P)outFirst position.
lastinteger(kind=I8P)outLast position.

Call graph

free ​

Free dynamic memory.

Attributes: elemental

fortran
subroutine free(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inoutXML index.

scan_file ​

Scan a file, indexing its tags; the file is read in chunks (default 64 KiB), its content is not stored.

@note If stop_at is passed, the scan stops after the start tag of the first tag with that name (the tags still open stay unclosed, without content); stop_position returns the position after it. @note As xml_file%parse: the scan is tolerant; iostat returns 0 on success, the runtime I/O error code if the file cannot be read, XML_MALFORMED if the input is malformed (iomsg, unchanged on success, describes the first problem with its line); attribute values are trimmed unless sanitize_attributes_value is false.

fortran
subroutine scan_file(self, filename, stop_at, chunk_size, iostat, iomsg, sanitize_attributes_value)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inoutXML index.
filenamecharacter(len=*)inFile name.
stop_atcharacter(len=*)inoptionalName of the tag after whose start tag the scan stops.
chunk_sizeinteger(kind=I8P)inoptionalSize of the chunks read from the file.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.
sanitize_attributes_valuelogicalinoptionalTrim attribute values spaces (default .true.).

Call graph

text_range ​

Return the positions in the file of the text of the tag with ID id: from its start tag to its first child (or to its end tag); last < first if it is empty (also for a self closing or unclosed tag, or if the tag does not exist).

Attributes: elemental

fortran
subroutine text_range(self, id, first, last)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.
firstinteger(kind=I8P)outFirst position.
lastinteger(kind=I8P)outLast position.

Call graph

attribute_text ​

Return the value of the attribute named name of the tag with ID id; iostat is XML_NOT_FOUND if the tag or the attribute does not exist.

fortran
subroutine attribute_text(self, id, name, text, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.
namecharacter(len=*)inAttribute name.
textcharacter(len=:)outallocatableAttribute value.
iostatinteger(kind=I4P)outIO status.
iomsgcharacter(len=:)outallocatableIO message.

Call graph

content_text ​

Return the content of the tag with ID id, read from the file (see content); iostat is XML_NOT_FOUND if the tag does not exist, the runtime one if the file cannot be read.

fortran
subroutine content_text(self, id, text, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.
textcharacter(len=:)outallocatableTag content.
iostatinteger(kind=I4P)outIO status.
iomsgcharacter(len=:)outallocatableIO message.

Call graph

get_attribute_I1P ​

Get the attribute named name of the tag with ID id as a integer(I1P) value.

fortran
subroutine get_attribute_I1P(self, id, name, value, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.
namecharacter(len=*)inAttribute name.
valueinteger(kind=I1P)inoutValue, unchanged on error.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

get_attribute_I2P ​

Get the attribute named name of the tag with ID id as a integer(I2P) value.

fortran
subroutine get_attribute_I2P(self, id, name, value, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.
namecharacter(len=*)inAttribute name.
valueinteger(kind=I2P)inoutValue, unchanged on error.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

get_attribute_I4P ​

Get the attribute named name of the tag with ID id as a integer(I4P) value.

fortran
subroutine get_attribute_I4P(self, id, name, value, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.
namecharacter(len=*)inAttribute name.
valueinteger(kind=I4P)inoutValue, unchanged on error.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

get_attribute_I8P ​

Get the attribute named name of the tag with ID id as a integer(I8P) value.

fortran
subroutine get_attribute_I8P(self, id, name, value, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.
namecharacter(len=*)inAttribute name.
valueinteger(kind=I8P)inoutValue, unchanged on error.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

get_attribute_R4P ​

Get the attribute named name of the tag with ID id as a real(R4P) value.

fortran
subroutine get_attribute_R4P(self, id, name, value, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.
namecharacter(len=*)inAttribute name.
valuereal(kind=R4P)inoutValue, unchanged on error.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

get_attribute_R8P ​

Get the attribute named name of the tag with ID id as a real(R8P) value.

fortran
subroutine get_attribute_R8P(self, id, name, value, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.
namecharacter(len=*)inAttribute name.
valuereal(kind=R8P)inoutValue, unchanged on error.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

get_attribute_logical ​

Get the attribute named name of the tag with ID id as a logical value.

fortran
subroutine get_attribute_logical(self, id, name, value, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.
namecharacter(len=*)inAttribute name.
valuelogicalinoutValue, unchanged on error.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

get_attribute_I1P_1 ​

Get the attribute named name of the tag with ID id as a list of integer(I1P) values (blank separated).

fortran
subroutine get_attribute_I1P_1(self, id, name, values, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.
namecharacter(len=*)inAttribute name.
valuesinteger(kind=I1P)outallocatableValues, empty on error.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

get_attribute_I2P_1 ​

Get the attribute named name of the tag with ID id as a list of integer(I2P) values (blank separated).

fortran
subroutine get_attribute_I2P_1(self, id, name, values, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.
namecharacter(len=*)inAttribute name.
valuesinteger(kind=I2P)outallocatableValues, empty on error.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

get_attribute_I4P_1 ​

Get the attribute named name of the tag with ID id as a list of integer(I4P) values (blank separated).

fortran
subroutine get_attribute_I4P_1(self, id, name, values, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.
namecharacter(len=*)inAttribute name.
valuesinteger(kind=I4P)outallocatableValues, empty on error.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

get_attribute_I8P_1 ​

Get the attribute named name of the tag with ID id as a list of integer(I8P) values (blank separated).

fortran
subroutine get_attribute_I8P_1(self, id, name, values, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.
namecharacter(len=*)inAttribute name.
valuesinteger(kind=I8P)outallocatableValues, empty on error.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

get_attribute_R4P_1 ​

Get the attribute named name of the tag with ID id as a list of real(R4P) values (blank separated).

fortran
subroutine get_attribute_R4P_1(self, id, name, values, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.
namecharacter(len=*)inAttribute name.
valuesreal(kind=R4P)outallocatableValues, empty on error.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

get_attribute_R8P_1 ​

Get the attribute named name of the tag with ID id as a list of real(R8P) values (blank separated).

fortran
subroutine get_attribute_R8P_1(self, id, name, values, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.
namecharacter(len=*)inAttribute name.
valuesreal(kind=R8P)outallocatableValues, empty on error.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

get_content_I1P ​

Get the content of the tag with ID id as a integer(I1P) value.

fortran
subroutine get_content_I1P(self, id, value, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.
valueinteger(kind=I1P)inoutValue, unchanged on error.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

get_content_I2P ​

Get the content of the tag with ID id as a integer(I2P) value.

fortran
subroutine get_content_I2P(self, id, value, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.
valueinteger(kind=I2P)inoutValue, unchanged on error.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

get_content_I4P ​

Get the content of the tag with ID id as a integer(I4P) value.

fortran
subroutine get_content_I4P(self, id, value, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.
valueinteger(kind=I4P)inoutValue, unchanged on error.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

get_content_I8P ​

Get the content of the tag with ID id as a integer(I8P) value.

fortran
subroutine get_content_I8P(self, id, value, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.
valueinteger(kind=I8P)inoutValue, unchanged on error.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

get_content_R4P ​

Get the content of the tag with ID id as a real(R4P) value.

fortran
subroutine get_content_R4P(self, id, value, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.
valuereal(kind=R4P)inoutValue, unchanged on error.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

get_content_R8P ​

Get the content of the tag with ID id as a real(R8P) value.

fortran
subroutine get_content_R8P(self, id, value, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.
valuereal(kind=R8P)inoutValue, unchanged on error.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

get_content_logical ​

Get the content of the tag with ID id as a logical value.

fortran
subroutine get_content_logical(self, id, value, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.
valuelogicalinoutValue, unchanged on error.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

get_content_I1P_1 ​

Get the content of the tag with ID id as a list of integer(I1P) values (blank separated).

fortran
subroutine get_content_I1P_1(self, id, values, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.
valuesinteger(kind=I1P)outallocatableValues, empty on error.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

get_content_I2P_1 ​

Get the content of the tag with ID id as a list of integer(I2P) values (blank separated).

fortran
subroutine get_content_I2P_1(self, id, values, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.
valuesinteger(kind=I2P)outallocatableValues, empty on error.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

get_content_I4P_1 ​

Get the content of the tag with ID id as a list of integer(I4P) values (blank separated).

fortran
subroutine get_content_I4P_1(self, id, values, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.
valuesinteger(kind=I4P)outallocatableValues, empty on error.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

get_content_I8P_1 ​

Get the content of the tag with ID id as a list of integer(I8P) values (blank separated).

fortran
subroutine get_content_I8P_1(self, id, values, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.
valuesinteger(kind=I8P)outallocatableValues, empty on error.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

get_content_R4P_1 ​

Get the content of the tag with ID id as a list of real(R4P) values (blank separated).

fortran
subroutine get_content_R4P_1(self, id, values, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.
valuesreal(kind=R4P)outallocatableValues, empty on error.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

get_content_R8P_1 ​

Get the content of the tag with ID id as a list of real(R8P) values (blank separated).

fortran
subroutine get_content_R8P_1(self, id, values, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.
valuesreal(kind=R8P)outallocatableValues, empty on error.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

index_start_tag ​

A start tag begins: a new tag is added.

Attributes: pure

fortran
subroutine index_start_tag(self, id, parent_id, level, name, start)

Arguments

NameTypeIntentAttributesDescription
selfclass(index_builder)inoutIndex builder.
idinteger(kind=I4P)inTag ID (start tags count).
parent_idinteger(kind=I4P)inParent tag ID, 0 for a root tag.
levelinteger(kind=I4P)inTag level, 1 for a root tag.
namecharacter(len=*)inTag name.
startinteger(kind=I8P)inPosition of <.

Call graph

index_attribute ​

An attribute of the current start tag.

Attributes: pure

fortran
subroutine index_attribute(self, id, name, value)

Arguments

NameTypeIntentAttributesDescription
selfclass(index_builder)inoutIndex builder.
idinteger(kind=I4P)inTag ID.
namecharacter(len=*)inAttribute name.
valuecharacter(len=*)inAttribute value.

Call graph

index_start_tag_end ​

The current start tag is complete; the scan stops here if the tag is the stop_at one.

Attributes: pure

fortran
subroutine index_start_tag_end(self, id, start, open_end, is_self_closing)

Arguments

NameTypeIntentAttributesDescription
selfclass(index_builder)inoutIndex builder.
idinteger(kind=I4P)inTag ID.
startinteger(kind=I8P)inPosition of <.
open_endinteger(kind=I8P)inPosition of >.
is_self_closinglogicalinThe tag is self closing.

Call graph

index_end_tag ​

An open tag is closed by its end tag.

Attributes: pure

fortran
subroutine index_end_tag(self, id, start, open_end, end_start, end_end)

Arguments

NameTypeIntentAttributesDescription
selfclass(index_builder)inoutIndex builder.
idinteger(kind=I4P)inTag ID.
startinteger(kind=I8P)inPosition of the start tag <.
open_endinteger(kind=I8P)inPosition of the start tag >.
end_startinteger(kind=I8P)inPosition of the end tag <.
end_endinteger(kind=I8P)inPosition of the end tag >.

Call graph

index_data ​

Character data or other markup: not stored (the content is read on demand).

Attributes: pure

fortran
subroutine index_data(self, kind, chars, first)

Arguments

NameTypeIntentAttributesDescription
selfclass(index_builder)inoutIndex builder.
kindinteger(kind=I4P)inData kind, DATA_*.
charscharacter(len=*)inCharacters, as in the source.
firstinteger(kind=I8P)inPosition of the first character.

index_problem ​

A problem of malformed input: only the first one is kept.

Attributes: pure

fortran
subroutine index_problem(self, pos, message)

Arguments

NameTypeIntentAttributesDescription
selfclass(index_builder)inoutIndex builder.
posinteger(kind=I8P)inPosition of the problem.
messagecharacter(len=*)inProblem description.

Functions ​

attribute_name ​

Return the name of the attribute with index a (source order) of the tag with ID id (as xml_file%attribute_name).

Attributes: pure

Returns: character(len=:)

fortran
function attribute_name(self, id, a) result(name)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.
ainteger(kind=I4P)inAttribute index.

Call graph

attributes_number ​

Return the number of attributes of the tag with ID id, 0 if it does not exist.

Attributes: pure

Returns: integer(kind=I4P)

fortran
function attributes_number(self, id) result(number)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.

Call graph

tags_number ​

Return the number of tags indexed (IDs are 1 to the number of tags).

Attributes: elemental

Returns: integer(kind=I4P)

fortran
function tags_number(self) result(number)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.

attribute ​

Return the value of the attribute named name of the tag with ID id (as xml_file%attribute).

Attributes: pure

Returns: character(len=:)

fortran
function attribute(self, id, name) result(value)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.
namecharacter(len=*)inAttribute name.

Call graph

children ​

Return the IDs of the direct children of the tag with ID id, in document order (0: the root tags).

Attributes: pure

Returns: integer(kind=I4P)

fortran
function children(self, id) result(ids)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.

Call graph

content ​

Return the content of the tag with ID id, read from the file (as xml_file%content: the tag text plus its children tails, layout blanks stripped, references decoded, CDATA literal, comments and PIs removed).

@note An empty string is returned if the tag does not exist, is self closing or unclosed (e.g. after a stopped scan), or the file cannot be read (reported by iostat and iomsg, if passed).

Returns: character(len=:)

fortran
function content(self, id, iostat, iomsg) result(value)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

find ​

Return the ID of the first tag (in document order) matching name or path, 0 if there is none.

@note See xml_file%find_all for the matching rules.

Attributes: pure

Returns: integer(kind=I4P)

fortran
function find(self, name, path, parent, namespaces) result(id)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
namecharacter(len=*)inoptionalTag name.
pathcharacter(len=*)inoptionalTags path, e.g. Piece/PointData/DataArray.
parentinteger(kind=I4P)inoptionalParent tag ID, 0 for the document root.
namespacescharacter(len=*)inoptionalDeclarations of the names prefixes.

Call graph

find_all ​

Return the IDs of all tags (in document order) matching name or path (see xml_file%find_all).

Attributes: pure

Returns: integer(kind=I4P)

fortran
function find_all(self, name, path, parent, namespaces) result(ids)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
namecharacter(len=*)inoptionalTag name.
pathcharacter(len=*)inoptionalTags path, e.g. Piece/PointData/DataArray.
parentinteger(kind=I4P)inoptionalParent tag ID, 0 for the document root.
namespacescharacter(len=*)inoptionalDeclarations of the names prefixes.

Call graph

select ​

Return the IDs (in document order) of the tags selected by the path expression, an XPath subset:

  • steps separated by / (direct children) or // (descendants at any depth); a leading / anchors the first step to the root tags, a leading // or none searches it at any depth (as find_all with a path);
  • a step is a name (* for any, {uri}local, prefixes resolved by namespaces as find_all) and predicates: [@a] (the attribute exists), [@a="v"] (its decoded value is v), [@a~="re"] (its value matches the regular expression re anywhere), [n] (the n-th among its siblings that passed the previous predicates).

A malformed expression selects nothing and returns iostat=XML_MALFORMED, iomsg giving the problem and its column.

@note Not pure (the regular expressions are compiled): find and find_all are the pure lookups.

Returns: integer(kind=I4P)

fortran
function select(self, expression, namespaces, iostat, iomsg) result(ids)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
expressioncharacter(len=*)inPath expression, e.g. //event[@type="x"]/origin.
namespacescharacter(len=*)inoptionalNamespaces declarations of the names prefixes.
iostatinteger(kind=I4P)outoptionalIO status, XML_MALFORMED for a malformed expression.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

level ​

Return the level of the tag with ID id (1 for a root tag), 0 if it does not exist.

Attributes: pure

Returns: integer(kind=I4P)

fortran
function level(self, id) result(level_)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.

Call graph

local_name ​

Return the local name (without prefix) of the tag with ID id, an empty string if it does not exist.

Attributes: pure

Returns: character(len=:)

fortran
function local_name(self, id) result(local_name_)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.

Call graph

matching ​

Return the IDs of the tags (of ids, in their order, or all of them) whose name, content or attribute value matches the compiled regular expression re (StringiFor regex): a part of the text, or the whole of it with whole.

@note on is name (default) or attribute (implied by attribute); the index holds no content. Names are matched as written, contents and attribute values decoded (as content and attribute return them); a tag without the attribute never matches; a regex not compiled matches nothing.

Attributes: pure

Returns: integer(kind=I4P)

fortran
function matching(self, re, ids, on, attribute, whole) result(matched)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
retype(regex)inCompiled regular expression.
idsinteger(kind=I4P)inoptionalTags IDs to filter (default: all the tags).
oncharacter(len=*)inoptionalWhat is matched.
attributecharacter(len=*)inoptionalAttribute name.
wholelogicalinoptionalMatch the whole text.

Call graph

name ​

Return the name of the tag with ID id, an empty string if it does not exist.

Attributes: pure

Returns: character(len=:)

fortran
function name(self, id) result(name_)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.

Call graph

namespace ​

Return the namespace of the tag with ID id (see xml_file%namespace).

Attributes: pure

Returns: character(len=:)

fortran
function namespace(self, id) result(namespace_)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.

Call graph

parent ​

Return the parent ID of the tag with ID id (0 for a root tag or if the tag does not exist).

Attributes: pure

Returns: integer(kind=I4P)

fortran
function parent(self, id) result(parent_)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.

Call graph

prefix ​

Return the name prefix of the tag with ID id, an empty string if it has none or it does not exist.

Attributes: pure

Returns: character(len=:)

fortran
function prefix(self, id) result(prefix_)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.
idinteger(kind=I4P)inTag ID.

Call graph

stop_position ​

Return the position in the file after the start tag where the scan stopped (stop_at), 0 if it did not stop.

Attributes: elemental

Returns: integer(kind=I8P)

fortran
function stop_position(self) result(pos)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_index)inXML index.