FoXy XML file class.
XML file class.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(xml_tag), | private, | allocatable | :: | tag(:) |
XML tags array. |
||
integer(kind=I4P), | private | :: | nt | = | 0_I4P |
Number of XML tags. |
final :: finalize | Free dynamic memory when finalizing. |
procedure, public, pass(self) :: add_tag | Add tag to XML file. |
procedure, public, pass(self) :: content | Return tag content of tag named name. |
procedure, public, pass(self) :: delete_tag | Add tag from XML file. |
procedure, public, pass(self) :: free | Free dynamic memory. |
procedure, public, pass(self) :: parse | Parse xml file. |
procedure, public, pass(self) :: stringify | Convert the whole file data into a string. |
procedure, private, pass(self) :: add_child | Add child ID to tag children list. |
procedure, private, pass(self) :: parse_from_string | Parse xml data from string. |
procedure, private, pass(self) :: stringify_recursive | Convert recursively tags with children into a string. |
Return tag content of tag named name.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(xml_file), | intent(in) | :: | self |
XML file. |
||
character(len=*), | intent(in) | :: | name |
Tag name. |
Tag content.
Convert the whole file data into a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(xml_file), | intent(in) | :: | self |
XML file. |
||
logical, | intent(in), | optional | :: | linearize |
Return a "linearized" string of tags without the XML hieararchy. |
Output string containing the whole xml file.
Load file contents and store as single characters stream.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | filename |
File name. |
||
character(len=*), | intent(in), | optional | :: | delimiter_start |
Delimiter from which start the stream. |
|
character(len=*), | intent(in), | optional | :: | delimiter_end |
Delimiter to which end the stream. |
|
logical, | intent(in), | optional | :: | fast_read |
Flag for activating efficient reading with one single read. |
|
integer(kind=I4P), | intent(out), | optional | :: | iostat |
IO error. |
|
character(len=*), | intent(out), | optional | :: | iomsg |
IO error message. |
Output string containing the file data as a single stream.
Delete tag from XML file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(xml_file), | intent(inout) | :: | self |
XML file. |
||
character(len=*), | intent(in) | :: | name |
XML tag name. |
Free dynamic memory.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(xml_file), | intent(inout) | :: | self |
XML file. |
Parse xml data from string or file. XML data is linearized, a DOM structured is used.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(xml_file), | intent(inout) | :: | self |
XML file. |
||
character(len=*), | intent(in), | optional | :: | string |
String containing xml data. |
|
character(len=*), | intent(in), | optional | :: | filename |
File name containing xml data. |
Add child ID to tag children list.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(xml_file), | intent(inout) | :: | self |
XML file handler. |
||
integer(kind=I4P), | intent(in) | :: | parent_id |
Parent ID. |
||
integer(kind=I4P), | intent(in) | :: | child_id |
Child ID. |
Parse xml data from a chunk of source string (file stringified for IO on device).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(xml_file), | intent(inout) | :: | self |
XML file handler. |
||
character(len=*), | intent(in) | :: | source_string |
String containing xml data. |
Convert recursively tags with children into a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(xml_file), | intent(in) | :: | self |
XML file. |
||
type(xml_tag), | intent(in) | :: | tag |
XML tag with children. |
||
logical, | intent(inout) | :: | is_done(:) |
List of stringified tags. |
||
character(len=:), | intent(inout), | allocatable | :: | tag_string |
Output string containing the current tag. |
Free dynamic memory when finalizing.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(xml_file), | intent(inout) | :: | self |
XML file. |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | source |
Source containing tag content. |
||
integer(kind=I4P), | intent(in) | :: | start_pos |
Start tag content position. |
||
character(len=*), | intent(in) | :: | tag_name |
Tag name. |
||
integer(kind=I4P), | intent(out) | :: | end_pos |
End tag position. |
Get tag content.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | source |
Source containing tag content. |
||
character(len=*), | intent(in) | :: | tag_name |
Tag name. |
||
integer, | intent(in) | :: | start_pos |
Start tag content position. |
||
character(len=:), | intent(out), | allocatable | :: | content |
Extracted tag content. |
|
integer(kind=I4P), | intent(out), | optional | :: | end_pos |
End tag content position. |
Parse current tag, only name and attributes.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | tag_str |
Tag string. |
||
character(len=:), | intent(out), | allocatable | :: | tag_name |
Parsed tag name. |
|
character(len=:), | intent(out), | allocatable | :: | attributes_str |
Parsed attributes list. |
|
logical, | intent(out) | :: | is_closing |
Sentinel for closing tag. |
||
logical, | intent(out) | :: | is_self_closing |
Sentinel for self closing tag. |