Skip to content

foxy_xml_writer ​

FoXy XML writer class: stream well-formed XML to a file, a unit or memory.

The document is written sequentially, element by element: start opens an element (its start tag stays pending, so attributes can be added, until its first content), end closes it (written self closing if it has no content). The writer keeps the stack of the open elements, escapes text and attribute values and writes each piece as soon as it is complete: the memory used does not depend on the document size (a memory target grows its buffer geometrically).

Layout: with indent>0 (default 2) every element holding elements has its start and end tags on their own lines, indented by depth; an element holding text is written inline (<a>text</a>), as its children; a block payload (raw(..., is_block=.true.)) is written on its own line. With indent=0 no blank is added.

Errors are sticky: the first one (an I/O error, or a misuse reported as XML_MALFORMED) is kept, every following call does nothing; each call can return it (iostat, iomsg), close always does: called without iostat, close stops the program on an error never returned to the caller, so that no error is lost.

Only well-formed XML is written: element and attribute names are checked (XML names), a duplicate attribute is an error, ]]> is escaped in text and attribute values.

Source: src/lib/foxy_xml_writer.f90

Dependencies

Contents ​

Variables ​

NameTypeAttributesDescription
INITIAL_BUFFER_LENinteger(kind=I8P)parameterInitial length of the memory buffer, doubled when full.
INITIAL_DEPTHinteger(kind=I4P)parameterInitial capacity of the open elements stack, doubled when full.

Derived Types ​

open_element ​

An open element.

Components ​

NameTypeAttributesDescription
namecharacter(len=:)allocatableElement name.
is_inlinelogicalIt holds text: its content and end tag are written inline.
in_inlinelogicalIt is inside an inline element: no layout around it.

xml_writer ​

XML writer.

Components ​

NameTypeAttributesDescription
unitintegerOutput unit (file or unit target).
is_memorylogicalThe target is memory.
is_openlogicalThe writer is open.
is_unit_ownedlogicalThe unit is opened (and closed) by the writer.
buffercharacter(len=:)allocatableMemory target buffer.
ninteger(kind=I8P)Used length of the memory buffer.
indentinteger(kind=I4P)Spaces per indentation level, 0 for no layout.
stacktype(open_element)allocatableOpen elements.
depthinteger(kind=I4P)Number of open elements.
pendingcharacter(len=:)allocatablePending start tag (<name attributes), unallocated if none.
pending_namescharacter(len=:)allocatableAttributes names of the pending start tag, a b.
is_emptylogicalNothing written yet.
rootsinteger(kind=I4P)Root elements started (a document has one).
errorinteger(kind=I4P)First error status, 0 if none.
error_messagecharacter(len=:)allocatableFirst error message.
is_reportedlogicalThe error has been returned to the caller.

Type-Bound Procedures ​

NameAttributesDescription
attributeAdd an attribute to the pending start tag.
cdatapass(self)Write a CDATA section.
closepass(self)Close all the open elements and the writer.
commentpass(self)Write a comment.
declarationpass(self)Write the XML declaration.
endpass(self)Close the innermost open element.
flushpass(self)Complete the pending start tag, for direct writes to the unit.
openpass(self)Open the writer on a file, a unit or memory.
pipass(self)Write a processing instruction.
rawpass(self)Write characters as they are.
startpass(self)Open an element.
stringpass(self)Return the memory target content.
textWrite character data (escaped), a number, a logical or a list.
attribute_characterpass(self)Add a character attribute.
attribute_i1ppass(self)Add an integer attribute.
attribute_i2ppass(self)Add an integer attribute.
attribute_i4ppass(self)Add an integer attribute.
attribute_i8ppass(self)Add an integer attribute.
attribute_r4ppass(self)Add a real attribute.
attribute_r8ppass(self)Add a real attribute.
attribute_logicalpass(self)Add a logical attribute.
attribute_i1p_1pass(self)Add a list attribute.
attribute_i2p_1pass(self)Add a list attribute.
attribute_i4p_1pass(self)Add a list attribute.
attribute_i8p_1pass(self)Add a list attribute.
attribute_r4p_1pass(self)Add a list attribute.
attribute_r8p_1pass(self)Add a list attribute.
text_characterpass(self)Write escaped character data.
text_i1ppass(self)Write a number.
text_i2ppass(self)Write a number.
text_i4ppass(self)Write a number.
text_i8ppass(self)Write a number.
text_r4ppass(self)Write a number.
text_r8ppass(self)Write a number.
text_logicalpass(self)Write a logical.
text_i1p_1pass(self)Write a list of numbers.
text_i2p_1pass(self)Write a list of numbers.
text_i4p_1pass(self)Write a list of numbers.
text_i8p_1pass(self)Write a list of numbers.
text_r4p_1pass(self)Write a list of numbers.
text_r8p_1pass(self)Write a list of numbers.
failpass(self)Record the first error.
flush_pendingpass(self)Complete the pending start tag.
is_writablepass(self)Check that the writer is open and without errors.
markup_linepass(self)Write a comment or PI.
putpass(self)Write characters to the target.
reportpass(self)Return the error status.
start_contentpass(self)Prepare the innermost element for inline content.

Subroutines ​

cdata ​

Write a CDATA section (]]> in string is split across two sections).

fortran
subroutine cdata(self, string, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
stringcharacter(len=*)inCharacters.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

close ​

Close all the open elements and the writer (a file opened by the writer is closed, a unit passed is left open; the memory target content stays available to string); without iostat, an error not yet returned to the caller stops the program.

fortran
subroutine close(self, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
iostatinteger(kind=I4P)outoptionalIO status: 0, the runtime I/O error code or XML_MALFORMED.
iomsgcharacter(len=*)inoutoptionalIO message, unchanged if no error.

Call graph

comment ​

Write a comment (<!--string-->); string cannot contain -- nor end with -.

fortran
subroutine comment(self, string, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
stringcharacter(len=*)inComment.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

declaration ​

Write the XML declaration, only as the first thing of the document.

fortran
subroutine declaration(self, version, encoding, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
versioncharacter(len=*)inoptionalXML version (default 1.0).
encodingcharacter(len=*)inoptionalEncoding (not written if not passed): UTF-8 (any alias) only.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

end ​

Close the innermost open element (self closing if it has no content); name, if passed, must be its name.

fortran
subroutine end(self, name, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
namecharacter(len=*)inoptionalName of the element to close.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

flush ​

Complete the pending start tag of the innermost element as for block content (a new line follows), so that the caller can write directly to the unit (e.g. binary data); the element end tag is then written on its own line.

fortran
subroutine flush(self, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

open ​

Open the writer: on a file (created, replaced if it exists), on a unit (already open for stream unformatted access, left open by close) or, if neither is passed, on memory (see string).

fortran
subroutine open(self, filename, unit, indent, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
filenamecharacter(len=*)inoptionalFile name.
unitintegerinoptionalUnit, open for stream unformatted access.
indentinteger(kind=I4P)inoptionalSpaces per indentation level (default 2), 0 for no layout.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

pi ​

Write a processing instruction (<?target string?>): target is an XML name other than xml (any case), string cannot contain ?>.

fortran
subroutine pi(self, target, string, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
targetcharacter(len=*)inPI target.
stringcharacter(len=*)inoptionalPI content.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

raw ​

Write characters as they are (e.g. pre-formatted numbers, base64 data): inline, or with is_block on their own line (indented, the end tag of the element on its own line too). Large data can be written in pieces, with many calls.

fortran
subroutine raw(self, string, is_block, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
stringcharacter(len=*)inCharacters.
is_blocklogicalinoptionalWrite on their own line.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

start ​

Open an element: its start tag stays pending (attributes can be added) up to its first content or its end.

fortran
subroutine start(self, name, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
namecharacter(len=*)inElement name.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

text_character ​

Write character data, escaped (&, <, >, ", '); the element is written inline.

fortran
subroutine text_character(self, string, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
stringcharacter(len=*)inCharacter data.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

attribute_character ​

Add an attribute to the pending start tag (the value is escaped, tab, new line and CR as references: it reads back exactly).

fortran
subroutine attribute_character(self, name, value, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
namecharacter(len=*)inAttribute name.
valuecharacter(len=*)inAttribute value.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

attribute_i1p ​

Add a integer attribute: integers with their digits (a sign only if negative), or as formatted by fmt.

fortran
subroutine attribute_i1p(self, name, value, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
namecharacter(len=*)inAttribute name.
valueinteger(kind=I1P)inAttribute value.
fmtcharacter(len=*)inoptionalFormat, e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

attribute_i2p ​

Add a integer attribute: integers with their digits (a sign only if negative), or as formatted by fmt.

fortran
subroutine attribute_i2p(self, name, value, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
namecharacter(len=*)inAttribute name.
valueinteger(kind=I2P)inAttribute value.
fmtcharacter(len=*)inoptionalFormat, e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

attribute_i4p ​

Add a integer attribute: integers with their digits (a sign only if negative), or as formatted by fmt.

fortran
subroutine attribute_i4p(self, name, value, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
namecharacter(len=*)inAttribute name.
valueinteger(kind=I4P)inAttribute value.
fmtcharacter(len=*)inoptionalFormat, e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

attribute_i8p ​

Add a integer attribute: integers with their digits (a sign only if negative), or as formatted by fmt.

fortran
subroutine attribute_i8p(self, name, value, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
namecharacter(len=*)inAttribute name.
valueinteger(kind=I8P)inAttribute value.
fmtcharacter(len=*)inoptionalFormat, e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

attribute_r4p ​

Add a real attribute: the shortest text that reads back exactly (StringiFor shortest), or as formatted by fmt.

fortran
subroutine attribute_r4p(self, name, value, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
namecharacter(len=*)inAttribute name.
valuereal(kind=R4P)inAttribute value.
fmtcharacter(len=*)inoptionalFormat, e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

attribute_r8p ​

Add a real attribute: the shortest text that reads back exactly (StringiFor shortest), or as formatted by fmt.

fortran
subroutine attribute_r8p(self, name, value, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
namecharacter(len=*)inAttribute name.
valuereal(kind=R8P)inAttribute value.
fmtcharacter(len=*)inoptionalFormat, e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

attribute_logical ​

Add a logical attribute, as true or false.

fortran
subroutine attribute_logical(self, name, value, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
namecharacter(len=*)inAttribute name.
valuelogicalinAttribute value.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

attribute_i1p_1 ​

Add an attribute holding a list of integer values, separated by one space (each as the scalar attribute).

fortran
subroutine attribute_i1p_1(self, name, values, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
namecharacter(len=*)inAttribute name.
valuesinteger(kind=I1P)inAttribute values.
fmtcharacter(len=*)inoptionalFormat of each value, e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

attribute_i2p_1 ​

Add an attribute holding a list of integer values, separated by one space (each as the scalar attribute).

fortran
subroutine attribute_i2p_1(self, name, values, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
namecharacter(len=*)inAttribute name.
valuesinteger(kind=I2P)inAttribute values.
fmtcharacter(len=*)inoptionalFormat of each value, e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

attribute_i4p_1 ​

Add an attribute holding a list of integer values, separated by one space (each as the scalar attribute).

fortran
subroutine attribute_i4p_1(self, name, values, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
namecharacter(len=*)inAttribute name.
valuesinteger(kind=I4P)inAttribute values.
fmtcharacter(len=*)inoptionalFormat of each value, e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

attribute_i8p_1 ​

Add an attribute holding a list of integer values, separated by one space (each as the scalar attribute).

fortran
subroutine attribute_i8p_1(self, name, values, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
namecharacter(len=*)inAttribute name.
valuesinteger(kind=I8P)inAttribute values.
fmtcharacter(len=*)inoptionalFormat of each value, e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

attribute_r4p_1 ​

Add an attribute holding a list of real values, separated by one space (each as the scalar attribute).

fortran
subroutine attribute_r4p_1(self, name, values, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
namecharacter(len=*)inAttribute name.
valuesreal(kind=R4P)inAttribute values.
fmtcharacter(len=*)inoptionalFormat of each value, e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

attribute_r8p_1 ​

Add an attribute holding a list of real values, separated by one space (each as the scalar attribute).

fortran
subroutine attribute_r8p_1(self, name, values, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
namecharacter(len=*)inAttribute name.
valuesreal(kind=R8P)inAttribute values.
fmtcharacter(len=*)inoptionalFormat of each value, e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

text_i1p ​

Write a integer value as character data (as attribute); the element is written inline.

fortran
subroutine text_i1p(self, value, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
valueinteger(kind=I1P)inValue.
fmtcharacter(len=*)inoptionalFormat, e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

text_i1p_1 ​

Write a list of integer values, separated by one space, as character data (as attribute); the element is written inline.

fortran
subroutine text_i1p_1(self, values, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
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

text_i2p ​

Write a integer value as character data (as attribute); the element is written inline.

fortran
subroutine text_i2p(self, value, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
valueinteger(kind=I2P)inValue.
fmtcharacter(len=*)inoptionalFormat, e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

text_i2p_1 ​

Write a list of integer values, separated by one space, as character data (as attribute); the element is written inline.

fortran
subroutine text_i2p_1(self, values, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
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

text_i4p ​

Write a integer value as character data (as attribute); the element is written inline.

fortran
subroutine text_i4p(self, value, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
valueinteger(kind=I4P)inValue.
fmtcharacter(len=*)inoptionalFormat, e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

text_i4p_1 ​

Write a list of integer values, separated by one space, as character data (as attribute); the element is written inline.

fortran
subroutine text_i4p_1(self, values, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
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

text_i8p ​

Write a integer value as character data (as attribute); the element is written inline.

fortran
subroutine text_i8p(self, value, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
valueinteger(kind=I8P)inValue.
fmtcharacter(len=*)inoptionalFormat, e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

text_i8p_1 ​

Write a list of integer values, separated by one space, as character data (as attribute); the element is written inline.

fortran
subroutine text_i8p_1(self, values, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
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

text_r4p ​

Write a real value as character data (as attribute); the element is written inline.

fortran
subroutine text_r4p(self, value, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
valuereal(kind=R4P)inValue.
fmtcharacter(len=*)inoptionalFormat, e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

text_r4p_1 ​

Write a list of real values, separated by one space, as character data (as attribute); the element is written inline.

fortran
subroutine text_r4p_1(self, values, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
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

text_r8p ​

Write a real value as character data (as attribute); the element is written inline.

fortran
subroutine text_r8p(self, value, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
valuereal(kind=R8P)inValue.
fmtcharacter(len=*)inoptionalFormat, e.g. (F6.3).
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

text_r8p_1 ​

Write a list of real values, separated by one space, as character data (as attribute); the element is written inline.

fortran
subroutine text_r8p_1(self, values, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
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

text_logical ​

Write a logical value as character data, true or false; the element is written inline.

fortran
subroutine text_logical(self, value, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
valuelogicalinValue.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

fail ​

Record an error, if it is the first one.

fortran
subroutine fail(self, error, message)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
errorinteger(kind=I4P)inError status.
messagecharacter(len=*)inError message.

Call graph

flush_pending ​

Complete the pending start tag of the innermost element, before its first content (a new line follows, unless the element is inline).

fortran
subroutine flush_pending(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.

Call graph

markup_line ​

Write a comment or PI: on its own line, or inline inside an inline element.

fortran
subroutine markup_line(self, markup)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
markupcharacter(len=*)inMarkup.

Call graph

put ​

Write characters to the target (unit or memory).

fortran
subroutine put(self, string)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
stringcharacter(len=*)inCharacters.

Call graph

report ​

Return the error status (iomsg only if there is an error), through iostat if passed.

fortran
subroutine report(self, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.

Call graph

Functions ​

string ​

Return the content of the memory target (empty for a file or unit target).

Attributes: pure

Returns: character(len=:)

fortran
function string(self) result(content)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inXML writer.

is_writable ​

Check that the writer is open and without errors (a call on a writer not open is an error).

Returns: logical

fortran
function is_writable(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.

Call graph

start_content ​

Prepare the innermost element for inline content (text, data, CDATA): its start tag is completed, it becomes inline.

Returns: logical

fortran
function start_content(self, what) result(is_ready)

Arguments

NameTypeIntentAttributesDescription
selfclass(xml_writer)inoutXML writer.
whatcharacter(len=*)inContent kind, for the error message.

Call graph

is_xml_target ​

Return true if a PI target is xml in any case, reserved by XML 1.0 (2.6) for the XML declaration.

Attributes: pure

Returns: logical

fortran
function is_xml_target(target) result(is_xml)

Arguments

NameTypeIntentAttributesDescription
targetcharacter(len=*)inPI target.

Call graph

indentation ​

Return the indentation of a depth.

Attributes: pure

Returns: character(len=:)

fortran
function indentation(self, depth) result(blanks)

Arguments

NameTypeIntentAttributesDescription
selftype(xml_writer)inXML writer.
depthinteger(kind=I4P)inDepth.

Call graph

new_line_ ​

Return a new line, or nothing without layout.

Attributes: pure

Returns: character(len=:)

fortran
function new_line_(self) result(nl)

Arguments

NameTypeIntentAttributesDescription
selftype(xml_writer)inXML writer.

Call graph