Skip to content

foxy_xml_file ​

FoXy XML file class.

Source: src/lib/foxy_xml_file.f90

Dependencies

Contents ​

Variables ​

NameTypeAttributesDescription
XML_MALFORMEDinteger(kind=I4P)parameteriostat of parse for malformed XML input.
INITIAL_CAPACITYinteger(kind=I4P)parameterInitial capacity of the tags array, doubled when full.
INITIAL_BUFFER_LENinteger(kind=I8P)parameterInitial length of the stringify buffer, doubled when full.
FILE_CHUNK_SIZEinteger(kind=I8P)parameterDefault size of the chunks read from a file (1 MiB).
BLANKScharacter(len=*)parameterXML blanks: space, tab, new line, CR.
XML_DECLARATIONcharacter(len=*)parameterXML declaration written by save.

Derived Types ​

xml_file ​

XML file class.

Components ​

NameTypeAttributesDescription
tagtype(xml_tag)allocatableXML tags array.
ntinteger(kind=I4P)Number of XML tags.
prologcharacter(len=:)allocatableMarkup before the root tag (XML declaration, DOCTYPE, comments, PIs),

Type-Bound Procedures ​

NameAttributesDescription
add_tagpass(self)Add tag to XML file.
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.
contentReturn tag content, by tag name or ID.
delete_attributepass(self)Delete an attribute of the tag with a given ID.
delete_tagpass(self)Delete a tag (by name or ID) with its subtree.
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.
parsepass(self)Parse xml file.
savepass(self)Save the whole file data into a file.
set_attributeSet an attribute of a tag (text, number, list).
set_contentSet the content of a tag (text, number, list).
set_namepass(self)Rename the tag with a given ID.
stringifypass(self)Convert the whole file data into a string.
tags_numberpass(self)Return the number of tags.
append_inlinepass(self)Append a tag with its subtree, without layout.
set_attribute_characterpass(self)
set_attribute_I1Ppass(self)
set_attribute_I2Ppass(self)
set_attribute_I4Ppass(self)
set_attribute_I8Ppass(self)
set_attribute_R4Ppass(self)
set_attribute_R8Ppass(self)
set_attribute_logicalpass(self)
set_attribute_I1P_1pass(self)
set_attribute_I2P_1pass(self)
set_attribute_I4P_1pass(self)
set_attribute_I8P_1pass(self)
set_attribute_R4P_1pass(self)
set_attribute_R8P_1pass(self)
set_content_characterpass(self)
set_content_I1Ppass(self)
set_content_I2Ppass(self)
set_content_I4Ppass(self)
set_content_I8Ppass(self)
set_content_R4Ppass(self)
set_content_R8Ppass(self)
set_content_logicalpass(self)
set_content_I1P_1pass(self)
set_content_I2P_1pass(self)
set_content_I4P_1pass(self)
set_content_I8P_1pass(self)
set_content_R4P_1pass(self)
set_content_R8P_1pass(self)
delete_subtreepass(self)Delete a tag and its subtree, renumbering the others.
last_in_subtreepass(self)Return the greatest ID of a subtree.
make_roompass(self)Move the tags from an ID on by one place.
append_inline_bodypass(self)Append a tag text, children and their tails, without layout.
direct_textpass(self)Return a tag text plus its children tails (raw).
is_mixedpass(self)Check if a tag has mixed content.
raw_textpass(self)Return a tag stored text (raw).
content_by_idpass(self)Return tag content of the tag with a given ID.
content_by_namepass(self)Return tag content of tag named name.
parse_from_filepass(self)Parse xml data from a file, read in chunks.
parse_from_stringpass(self)Parse xml data from string.
stringify_recursivepass(self)Convert recursively tags with children into a string.
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)

dom_builder ​

Builder of the DOM of an XML file, driven by the tokenizer.

The text of a tag ends at its first child or at its end tag; the tail of a tag (mixed content) is the character data after its end tag, up to the next sibling or the parent end tag. Tails and the text of a tag with children are stored raw (they are written back verbatim by mixed content tags), the text of a leaf tag is trimmed of spaces. CDATA sections, comments and processing instructions are part of the text; the markup before the first tag is the prolog.

Inheritance

Extends: xml_builder

Components ​

NameTypeAttributesDescription
is_stoppedlogicalSet by the builder to stop the tokenizer (checked after each complete start or end tag).
doctype(xml_file)Document being built.
sanitizelogicalTrim leading and trailing spaces of attribute values.
ownerinteger(kind=I4P)ID of the tag owning the current character data, 0 if none.
is_taillogicalThe current character data is the owner tail, not its text.
textcharacter(len=:)allocatableCurrent character data (buffer).
text_ninteger(kind=I8P)Length of the current character data.
prologcharacter(len=:)allocatableMarkup before the first tag (buffer).
prolog_ninteger(kind=I8P)Length of the markup before the first tag.
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.
problempass(self)A problem of malformed input.
finishpass(self)Complete the DOM at the source end.
flushpass(self)Store the current character data into its owner.

Subroutines ​

add_tag ​

Add tag to XML file: as the last child of the tag with ID parent or, if parent is not passed (or 0), as a root tag; with before (or after), as the sibling right before (after) the tag with that ID. Its own children (if any) are not kept.

@note Tags IDs are the tags indexes into the tags array. Appended, the tag gets the new number of tags as ID: in a built document IDs follow the insertion order. Inserted (before, after), it takes the place of the sibling (or the place after the sibling subtree) and the following tags are renumbered, so that a parsed document keeps the document order; a child ID is always greater than its parent one, as delete_tag requires. @note The tags array capacity is doubled when full, thus adding n tags costs O(n) tags copies, not O(n^2): only the first nt elements are tags, the others are spare capacity. @note The tag is not added (id is 0) if parent is not a tag ID, if before (or after) is not a tag ID or not a child of parent (when passed), or if both before and after are passed.

Attributes: elemental

fortran
subroutine add_tag(self, tag, parent, id, before, after)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.
tagtype(xml_tag)inXML tag.
parentinteger(kind=I4P)inoptionalParent tag ID, 0 for a root tag.
idinteger(kind=I4P)outoptionalID of the added tag, 0 if not added.
beforeinteger(kind=I4P)inoptionalID of the sibling the tag is inserted before.
afterinteger(kind=I4P)inoptionalID of the sibling the tag is inserted after.

Call graph

make_room ​

Move the tags from ID k on by one place, renumbering every reference to them (IDs, parents, children lists).

Attributes: pure

fortran
subroutine make_room(self, k)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file (with spare capacity for one more tag).
kinteger(kind=I4P)inFirst ID moved.

Call graph

insert_child ​

Insert child in the children list of parent, before (or after) the child with ID at.

Attributes: pure

fortran
subroutine insert_child(parent, child, at, is_before)

Arguments

NameTypeIntentAttributesDescription
parenttype(xml_tag)inoutParent tag.
childinteger(kind=I4P)inChild ID.
atinteger(kind=I4P)inID of the sibling.
is_beforelogicalinInsert before the sibling, otherwise after.

Call graph

delete_tag ​

Delete from XML file the first tag named name or, if id is passed, the tag with ID id, together with its whole subtree (nothing is deleted if there is no such tag).

@note Tags IDs are the tags indexes into the tags array: the remaining tags are renumbered, parent and children IDs included (the IDs before the deleted tag do not change).

Attributes: elemental

fortran
subroutine delete_tag(self, name, id)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.
namecharacter(len=*)inoptionalXML tag name.
idinteger(kind=I4P)inoptionalXML tag ID.

Call graph

delete_attribute ​

Delete the attribute named name of the tag with ID id.

@note iostat is XML_NOT_FOUND if the tag or the attribute does not exist (iomsg unchanged on success).

Attributes: pure

fortran
subroutine delete_attribute(self, id, name, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.
idinteger(kind=I4P)inTag ID.
namecharacter(len=*)inAttribute name.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

set_attribute_character ​

Set the attribute named name of the tag with ID id: added (last) or, if present, its value replaced; value is escaped (markup characters, tab, new line and CR), attribute returns it as passed.

@note iostat is XML_NOT_FOUND if the tag does not exist, XML_MALFORMED if name is not an XML name (nothing is set); iomsg is unchanged on success.

Attributes: pure

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

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.
idinteger(kind=I4P)inTag ID.
namecharacter(len=*)inAttribute name.
valuecharacter(len=*)inAttribute value.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

set_content_character ​

Set the content of the tag with ID id: its children (with their subtrees) are deleted, content becomes its whole content (a self closing tag gets an end tag).

@note As for xml_tag contents, content is stored as it is (it may hold markup): character data from the user must be escaped first with xml_escape. The children deleted renumber the following tags, as delete_tag. @note iostat is XML_NOT_FOUND if the tag does not exist (iomsg unchanged on success).

Attributes: pure

fortran
subroutine set_content_character(self, id, content, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.
idinteger(kind=I4P)inTag ID.
contentcharacter(len=*)inTag content.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

set_attribute_I1P ​

Set the attribute named name of the tag with ID id to integer(I1P) value (as to_text).

Attributes: pure

fortran
subroutine set_attribute_I1P(self, id, name, value, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.
idinteger(kind=I4P)inTag ID.
namecharacter(len=*)inAttribute name.
valueinteger(kind=I1P)inValue.
fmtcharacter(len=*)inoptionalFormat (of each value), e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

set_attribute_I2P ​

Set the attribute named name of the tag with ID id to integer(I2P) value (as to_text).

Attributes: pure

fortran
subroutine set_attribute_I2P(self, id, name, value, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.
idinteger(kind=I4P)inTag ID.
namecharacter(len=*)inAttribute name.
valueinteger(kind=I2P)inValue.
fmtcharacter(len=*)inoptionalFormat (of each value), e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

set_attribute_I4P ​

Set the attribute named name of the tag with ID id to integer(I4P) value (as to_text).

Attributes: pure

fortran
subroutine set_attribute_I4P(self, id, name, value, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.
idinteger(kind=I4P)inTag ID.
namecharacter(len=*)inAttribute name.
valueinteger(kind=I4P)inValue.
fmtcharacter(len=*)inoptionalFormat (of each value), e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

set_attribute_I8P ​

Set the attribute named name of the tag with ID id to integer(I8P) value (as to_text).

Attributes: pure

fortran
subroutine set_attribute_I8P(self, id, name, value, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.
idinteger(kind=I4P)inTag ID.
namecharacter(len=*)inAttribute name.
valueinteger(kind=I8P)inValue.
fmtcharacter(len=*)inoptionalFormat (of each value), e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

set_attribute_R4P ​

Set the attribute named name of the tag with ID id to real(R4P) value (as to_text).

Attributes: pure

fortran
subroutine set_attribute_R4P(self, id, name, value, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.
idinteger(kind=I4P)inTag ID.
namecharacter(len=*)inAttribute name.
valuereal(kind=R4P)inValue.
fmtcharacter(len=*)inoptionalFormat (of each value), e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

set_attribute_R8P ​

Set the attribute named name of the tag with ID id to real(R8P) value (as to_text).

Attributes: pure

fortran
subroutine set_attribute_R8P(self, id, name, value, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.
idinteger(kind=I4P)inTag ID.
namecharacter(len=*)inAttribute name.
valuereal(kind=R8P)inValue.
fmtcharacter(len=*)inoptionalFormat (of each value), e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

set_attribute_logical ​

Set the attribute named name of the tag with ID id to logical value (as to_text).

Attributes: pure

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

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.
idinteger(kind=I4P)inTag ID.
namecharacter(len=*)inAttribute name.
valuelogicalinValue.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

set_attribute_I1P_1 ​

Set the attribute named name of the tag with ID id to a list of integer(I1P) values (as to_text).

Attributes: pure

fortran
subroutine set_attribute_I1P_1(self, id, name, values, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.
idinteger(kind=I4P)inTag ID.
namecharacter(len=*)inAttribute name.
valuesinteger(kind=I1P)inValues.
fmtcharacter(len=*)inoptionalFormat (of each value), e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

set_attribute_I2P_1 ​

Set the attribute named name of the tag with ID id to a list of integer(I2P) values (as to_text).

Attributes: pure

fortran
subroutine set_attribute_I2P_1(self, id, name, values, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.
idinteger(kind=I4P)inTag ID.
namecharacter(len=*)inAttribute name.
valuesinteger(kind=I2P)inValues.
fmtcharacter(len=*)inoptionalFormat (of each value), e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

set_attribute_I4P_1 ​

Set the attribute named name of the tag with ID id to a list of integer(I4P) values (as to_text).

Attributes: pure

fortran
subroutine set_attribute_I4P_1(self, id, name, values, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.
idinteger(kind=I4P)inTag ID.
namecharacter(len=*)inAttribute name.
valuesinteger(kind=I4P)inValues.
fmtcharacter(len=*)inoptionalFormat (of each value), e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

set_attribute_I8P_1 ​

Set the attribute named name of the tag with ID id to a list of integer(I8P) values (as to_text).

Attributes: pure

fortran
subroutine set_attribute_I8P_1(self, id, name, values, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.
idinteger(kind=I4P)inTag ID.
namecharacter(len=*)inAttribute name.
valuesinteger(kind=I8P)inValues.
fmtcharacter(len=*)inoptionalFormat (of each value), e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

set_attribute_R4P_1 ​

Set the attribute named name of the tag with ID id to a list of real(R4P) values (as to_text).

Attributes: pure

fortran
subroutine set_attribute_R4P_1(self, id, name, values, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.
idinteger(kind=I4P)inTag ID.
namecharacter(len=*)inAttribute name.
valuesreal(kind=R4P)inValues.
fmtcharacter(len=*)inoptionalFormat (of each value), e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

set_attribute_R8P_1 ​

Set the attribute named name of the tag with ID id to a list of real(R8P) values (as to_text).

Attributes: pure

fortran
subroutine set_attribute_R8P_1(self, id, name, values, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.
idinteger(kind=I4P)inTag ID.
namecharacter(len=*)inAttribute name.
valuesreal(kind=R8P)inValues.
fmtcharacter(len=*)inoptionalFormat (of each value), e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

set_content_I1P ​

Set the content of the tag with ID id to integer(I1P) value (as to_text: integers with their digits, reals the shortest text that reads back, logicals true/false, lists separated by a space), replacing its children.

Attributes: pure

fortran
subroutine set_content_I1P(self, id, value, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.
idinteger(kind=I4P)inTag ID.
valueinteger(kind=I1P)inValue.
fmtcharacter(len=*)inoptionalFormat (of each value), e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

set_content_I2P ​

Set the content of the tag with ID id to integer(I2P) value (as to_text: integers with their digits, reals the shortest text that reads back, logicals true/false, lists separated by a space), replacing its children.

Attributes: pure

fortran
subroutine set_content_I2P(self, id, value, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.
idinteger(kind=I4P)inTag ID.
valueinteger(kind=I2P)inValue.
fmtcharacter(len=*)inoptionalFormat (of each value), e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

set_content_I4P ​

Set the content of the tag with ID id to integer(I4P) value (as to_text: integers with their digits, reals the shortest text that reads back, logicals true/false, lists separated by a space), replacing its children.

Attributes: pure

fortran
subroutine set_content_I4P(self, id, value, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.
idinteger(kind=I4P)inTag ID.
valueinteger(kind=I4P)inValue.
fmtcharacter(len=*)inoptionalFormat (of each value), e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

set_content_I8P ​

Set the content of the tag with ID id to integer(I8P) value (as to_text: integers with their digits, reals the shortest text that reads back, logicals true/false, lists separated by a space), replacing its children.

Attributes: pure

fortran
subroutine set_content_I8P(self, id, value, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.
idinteger(kind=I4P)inTag ID.
valueinteger(kind=I8P)inValue.
fmtcharacter(len=*)inoptionalFormat (of each value), e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

set_content_R4P ​

Set the content of the tag with ID id to real(R4P) value (as to_text: integers with their digits, reals the shortest text that reads back, logicals true/false, lists separated by a space), replacing its children.

Attributes: pure

fortran
subroutine set_content_R4P(self, id, value, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.
idinteger(kind=I4P)inTag ID.
valuereal(kind=R4P)inValue.
fmtcharacter(len=*)inoptionalFormat (of each value), e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

set_content_R8P ​

Set the content of the tag with ID id to real(R8P) value (as to_text: integers with their digits, reals the shortest text that reads back, logicals true/false, lists separated by a space), replacing its children.

Attributes: pure

fortran
subroutine set_content_R8P(self, id, value, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.
idinteger(kind=I4P)inTag ID.
valuereal(kind=R8P)inValue.
fmtcharacter(len=*)inoptionalFormat (of each value), e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

set_content_logical ​

Set the content of the tag with ID id to logical value (as to_text: integers with their digits, reals the shortest text that reads back, logicals true/false, lists separated by a space), replacing its children.

Attributes: pure

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

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.
idinteger(kind=I4P)inTag ID.
valuelogicalinValue.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

set_content_I1P_1 ​

Set the content of the tag with ID id to a list of integer(I1P) values (as to_text: integers with their digits, reals the shortest text that reads back, logicals true/false, lists separated by a space), replacing its children.

Attributes: pure

fortran
subroutine set_content_I1P_1(self, id, values, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.
idinteger(kind=I4P)inTag ID.
valuesinteger(kind=I1P)inValues.
fmtcharacter(len=*)inoptionalFormat (of each value), e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

set_content_I2P_1 ​

Set the content of the tag with ID id to a list of integer(I2P) values (as to_text: integers with their digits, reals the shortest text that reads back, logicals true/false, lists separated by a space), replacing its children.

Attributes: pure

fortran
subroutine set_content_I2P_1(self, id, values, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.
idinteger(kind=I4P)inTag ID.
valuesinteger(kind=I2P)inValues.
fmtcharacter(len=*)inoptionalFormat (of each value), e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

set_content_I4P_1 ​

Set the content of the tag with ID id to a list of integer(I4P) values (as to_text: integers with their digits, reals the shortest text that reads back, logicals true/false, lists separated by a space), replacing its children.

Attributes: pure

fortran
subroutine set_content_I4P_1(self, id, values, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.
idinteger(kind=I4P)inTag ID.
valuesinteger(kind=I4P)inValues.
fmtcharacter(len=*)inoptionalFormat (of each value), e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

set_content_I8P_1 ​

Set the content of the tag with ID id to a list of integer(I8P) values (as to_text: integers with their digits, reals the shortest text that reads back, logicals true/false, lists separated by a space), replacing its children.

Attributes: pure

fortran
subroutine set_content_I8P_1(self, id, values, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.
idinteger(kind=I4P)inTag ID.
valuesinteger(kind=I8P)inValues.
fmtcharacter(len=*)inoptionalFormat (of each value), e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

set_content_R4P_1 ​

Set the content of the tag with ID id to a list of real(R4P) values (as to_text: integers with their digits, reals the shortest text that reads back, logicals true/false, lists separated by a space), replacing its children.

Attributes: pure

fortran
subroutine set_content_R4P_1(self, id, values, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.
idinteger(kind=I4P)inTag ID.
valuesreal(kind=R4P)inValues.
fmtcharacter(len=*)inoptionalFormat (of each value), e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

set_content_R8P_1 ​

Set the content of the tag with ID id to a list of real(R8P) values (as to_text: integers with their digits, reals the shortest text that reads back, logicals true/false, lists separated by a space), replacing its children.

Attributes: pure

fortran
subroutine set_content_R8P_1(self, id, values, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.
idinteger(kind=I4P)inTag ID.
valuesreal(kind=R8P)inValues.
fmtcharacter(len=*)inoptionalFormat (of each value), e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

set_name ​

Rename the tag with ID id (its end tag follows); its namespace is resolved again from the new prefix.

@note iostat is XML_NOT_FOUND if the tag does not exist, XML_MALFORMED if name is not an XML name (nothing is changed); iomsg is unchanged on success.

Attributes: pure

fortran
subroutine set_name(self, id, name, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.
idinteger(kind=I4P)inTag ID.
namecharacter(len=*)inNew name.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

free ​

Free dynamic memory.

Attributes: elemental

fortran
subroutine free(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.

parse ​

Parse xml data from string or file. XML data is linearized, a DOM structured is used.

@note Self data are free before trying to parse new xml data: all previously parsed data are lost. @note Parsing is tolerant: malformed input is parsed as far as possible. If iostat is passed, it 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 error, for malformed input the first problem found with its line. @note Leading and trailing spaces of attribute values are trimmed (default), unless sanitize_attributes_value is false: then values are kept as in the source (XML data). @note A file is read in chunks of chunk_size characters (default 1 MiB): it is never loaded whole in memory.

fortran
subroutine parse(self, string, filename, iostat, iomsg, sanitize_attributes_value, chunk_size)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.
stringcharacter(len=*)inoptionalString containing xml data.
filenamecharacter(len=*)inoptionalFile name containing xml data.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.
sanitize_attributes_valuelogicalinoptionalTrim attribute values spaces (default .true.).
chunk_sizeinteger(kind=I8P)inoptionalSize of the chunks read from a file.

Call graph

save ​

Save the whole file data into a file: the prolog and the tags (as stringify), ended by a new line.

@note If is_declared is true and the prolog does not start with an XML declaration (e.g. a document built in code), the declaration <?xml version="1.0"?> is written first. @note If iostat is passed, it returns 0 on success, the runtime I/O error code, or XML_MALFORMED for a document with more root tags (not well-formed XML, written anyway), and iomsg (unchanged on success) describes the error; without iostat an I/O error stops the program, as Fortran I/O statements do (more root tags are not reported).

fortran
subroutine save(self, filename, is_declared, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inXML file.
filenamecharacter(len=*)inFile name.
is_declaredlogicalinoptionalWrite the XML declaration, if missing.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

append_inline ​

Append to buffer a tag with its whole subtree as in the source, without added layout (mixed content).

Attributes: pure, recursive

fortran
subroutine append_inline(self, t, is_done, buffer, n)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inXML file.
tinteger(kind=I4P)inTag ID.
is_donelogicalinoutList of stringified tags.
buffercharacter(len=:)inoutallocatableOutput buffer.
ninteger(kind=I8P)inoutUsed length of the buffer.

Call graph

append_inline_body ​

Append to buffer the text of a tag, then each child (inline) followed by its tail.

Attributes: pure, recursive

fortran
subroutine append_inline_body(self, t, is_done, buffer, n)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inXML file.
tinteger(kind=I4P)inTag ID.
is_donelogicalinoutList of stringified tags.
buffercharacter(len=:)inoutallocatableOutput buffer.
ninteger(kind=I8P)inoutUsed length of the buffer.

Call graph

delete_subtree ​

Delete the subtree of the tag with ID id (the tag included if is_root_deleted), renumbering the other tags.

@note A child index is always greater than its parent one (document order for parsed tags, insertion order for added ones), thus the subtree is collected by a single forward sweep.

Attributes: pure

fortran
subroutine delete_subtree(self, id, is_root_deleted)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file.
idinteger(kind=I4P)inTag ID.
is_root_deletedlogicalinThe tag itself is deleted too.

Call graph

parse_from_file ​

Parse xml data from a file, read in chunks: the tokenizer drives the DOM builder, the file is never loaded whole.

@note The first problem of malformed input is returned; iostat and iomsg report the file errors (the document is left empty).

fortran
subroutine parse_from_file(self, filename, sanitize, chunk_size, problem, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file handler.
filenamecharacter(len=*)inFile name.
sanitizelogicalinTrim leading and trailing spaces of attribute values.
chunk_sizeinteger(kind=I8P)inSize of the chunks read from the file.
problemcharacter(len=:)outallocatableFirst problem of malformed input, unallocated if none.
iostatinteger(kind=I4P)outIO status.
iomsgcharacter(len=*)inoutIO message.

Call graph

parse_from_string ​

Parse xml data from a string: the tokenizer drives the DOM builder. The first problem of malformed input is returned.

fortran
subroutine parse_from_string(self, source_string, sanitize, problem)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inoutXML file handler.
source_stringcharacter(len=*)inString containing xml data.
sanitizelogicalinTrim leading and trailing spaces of attribute values.
problemcharacter(len=:)outallocatableFirst problem of malformed input, unallocated if none.

Call graph

stringify_recursive ​

Append to buffer, recursively, a (nested) tag with its children, each line preceded by a new line.

Attributes: pure, recursive

fortran
subroutine stringify_recursive(self, tag, is_done, buffer, n)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inXML file.
tagtype(xml_tag)inXML tag.
is_donelogicalinoutList of stringified tags.
buffercharacter(len=:)inoutallocatableOutput buffer.
ninteger(kind=I8P)inoutUsed length of the buffer.

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_file)inXML file.
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 (see content); iostat is XML_NOT_FOUND if the tag does not exist.

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

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inXML file.
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_file)inXML file.
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_file)inXML file.
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_file)inXML file.
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_file)inXML file.
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_file)inXML file.
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_file)inXML file.
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_file)inXML file.
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_file)inXML file.
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_file)inXML file.
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_file)inXML file.
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_file)inXML file.
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_file)inXML file.
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_file)inXML file.
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_file)inXML file.
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_file)inXML file.
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_file)inXML file.
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_file)inXML file.
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_file)inXML file.
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_file)inXML file.
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_file)inXML file.
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_file)inXML file.
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_file)inXML file.
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_file)inXML file.
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_file)inXML file.
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_file)inXML file.
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_file)inXML file.
idinteger(kind=I4P)inTag ID.
valuesreal(kind=R8P)outallocatableValues, empty on error.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

finalize ​

Free dynamic memory when finalizing.

fortran
subroutine finalize(self)

Arguments

NameTypeIntentAttributesDescription
selftype(xml_file)inoutXML file.

dom_start_tag ​

A start tag begins: the text so far ends, a new tag is added.

Attributes: pure

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

Arguments

NameTypeIntentAttributesDescription
selfclass(dom_builder)inoutDOM 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

dom_attribute ​

An attribute of the current start tag.

Attributes: pure

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

Arguments

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

Call graph

dom_start_tag_end ​

The current start tag is complete: the following character data are its text (its tail if self closing).

Attributes: pure

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

Arguments

NameTypeIntentAttributesDescription
selfclass(dom_builder)inoutDOM 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

dom_end_tag ​

An open tag is closed: the text so far ends, the following character data are its tail.

Attributes: pure

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

Arguments

NameTypeIntentAttributesDescription
selfclass(dom_builder)inoutDOM 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

dom_data ​

Character data or other markup: part of the prolog before the first tag, of the owner text afterwards (CDATA, comments and PIs included, declarations and ignored markup excluded).

Attributes: pure

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

Arguments

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

Call graph

dom_problem ​

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

Attributes: pure

fortran
subroutine dom_problem(self, pos, message)

Arguments

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

dom_finish ​

Complete the DOM at the source end: store the last character data, build the children lists.

Attributes: pure

fortran
subroutine dom_finish(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(dom_builder)inoutDOM builder.

Call graph

dom_flush ​

Store the current character data into its owner tag, if any, and reset them.

Attributes: pure

fortran
subroutine dom_flush(self, is_parent)

Arguments

NameTypeIntentAttributesDescription
selfclass(dom_builder)inoutDOM builder.
is_parentlogicalinThe text ends because the owner first child starts.

Call graph

append ​

Append a piece to a buffer of used length n, doubling its capacity when full.

Attributes: pure

fortran
subroutine append(buffer, n, piece)

Arguments

NameTypeIntentAttributesDescription
buffercharacter(len=:)inoutallocatableBuffer.
ninteger(kind=I8P)inoutUsed length of the buffer.
piececharacter(len=*)inPiece to append.

Call graph

Functions ​

last_in_subtree ​

Return the greatest ID of the subtree of the tag with ID id (the tag included): children IDs are greater than their parent one, so a forward sweep collects the subtree.

Attributes: pure

Returns: integer(kind=I4P)

fortran
function last_in_subtree(self, id) result(last)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inXML file.
idinteger(kind=I4P)inTag ID.

Call graph

attribute ​

Return the value of the attribute named name of the tag with ID id.

@note If the tag or the attribute does not exist, an empty string is returned.

Attributes: pure

Returns: character(len=:)

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

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inXML file.
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.

@note The ID 0 is the document root: its children are the root tags.

Attributes: pure

Returns: integer(kind=I4P)

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

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inXML file.
idinteger(kind=I4P)inTag ID.

Call graph

content_by_id ​

Return tag content of the tag with ID id.

@note Only the tag own content is returned, without leading and trailing blanks and with character references decoded; if the tag does not exist or has no content, an empty string is returned.

Attributes: pure

Returns: character(len=:)

fortran
function content_by_id(self, id) result(content)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inXML file.
idinteger(kind=I4P)inTag ID.

Call graph

find ​

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

@note See 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_file)inXML file.
namecharacter(len=*)inoptionalTag name.
pathcharacter(len=*)inoptionalTags path, e.g. origin/latitude/value.
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.

Matching rules:

  • name: tags named name at any depth or, if parent is passed, only the direct children of parent;
  • path: /-separated tags names; the first one is matched as name, each following one must be a direct child of the previous one; all the tags matching a segment are explored, thus repeated parents are handled.

@note If both name and path are passed, path is used; if none is passed, no tag is returned.

Attributes: pure

Returns: integer(kind=I4P)

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

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inXML file.
namecharacter(len=*)inoptionalTag name.
pathcharacter(len=*)inoptionalTags path, e.g. origin/latitude/value.
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_file)inXML file.
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

content_by_name ​

Return tag content of tag named name.

@note If there is no value, the tag_content string is returned empty, but allocated. @note Leading and trailing blanks (new lines included) are layout, not data: they are stripped from the returned content, while the stored content keeps them for a faithful stringify. @note Character references are decoded in the returned content, the stored content keeps them.

Attributes: pure

Returns: character(len=:)

fortran
function content_by_name(self, name) result(content)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inXML file.
namecharacter(len=*)inTag name.

Call graph

attribute_name ​

Return the name of the attribute with index a (1 for the first one, in source order) of the tag with ID id, an empty string if it does not exist; with attributes_number, the attributes of a tag can be listed.

Attributes: pure

Returns: character(len=:)

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

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inXML file.
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_file)inXML file.
idinteger(kind=I4P)inTag ID.

Call graph

tags_number ​

Return the number of tags (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_file)inXML file.

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_file)inXML file.
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_file)inXML file.
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), content or attribute (implied by attribute). 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_file)inXML file.
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_file)inXML file.
idinteger(kind=I4P)inTag ID.

Call graph

namespace ​

Return the namespace of the tag with ID id, declared by the nearest xmlns:prefix (xmlns for an unprefixed name) attribute of the tag or of its ancestors.

@note An empty string is returned for a tag in no namespace, for a prefix not declared (a prefixed tag without namespace) and if the tag does not exist; the xml prefix is bound to its namespace.

Attributes: pure

Returns: character(len=:)

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

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inXML file.
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_file)inXML file.
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_file)inXML file.
idinteger(kind=I4P)inTag ID.

Call graph

stringify ​

Convert the whole file data into a string.

Attributes: pure

Returns: character(len=:)

fortran
function stringify(self, linearize) result(string)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inXML file.
linearizelogicalinoptionalReturn a "linearized" string of tags without the XML hieararchy.

Call graph

direct_text ​

Return the direct (raw) text of a tag: its text plus the tails of its children, the children text excluded.

Attributes: pure

Returns: character(len=:)

fortran
function direct_text(self, t) result(text)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inXML file.
tinteger(kind=I4P)inTag ID.

Call graph

is_mixed ​

Return .true. if a tag has mixed content: children and not blank text or children tails.

Attributes: pure

Returns: logical

fortran
function is_mixed(self, t) result(is_mixed_)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inXML file.
tinteger(kind=I4P)inTag ID.

Call graph

raw_text ​

Return the stored (raw) text of a tag, an empty string if none.

Attributes: pure

Returns: character(len=:)

fortran
function raw_text(self, t) result(text)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_file)inXML file.
tinteger(kind=I4P)inTag ID.

Call graph

starts_with_declaration ​

Check if a prolog starts with the XML declaration (<?xml followed by a blank, not a PI named xml-...).

Attributes: pure

Returns: logical

fortran
function starts_with_declaration(prolog) result(is_declaration)

Arguments

NameTypeIntentAttributesDescription
prologcharacter(len=*)inProlog.

Call graph