MONC
|
A SAX parser for XML files. This is used to parse the description of the data and rules. Being a SAX parser it works in a callback fashion, as these often do, and will call the start and end subroutines along with tag details. It still requires some additional stability work to handle ill formatted XML and error checking. More...
Data Types | |
interface | end_element_callback_interface |
The end element callback interface (on closing of XML tag, this is not called if an opening tag self closes) More... | |
interface | start_element_callback_interface |
The start element callback interface (on opening of XML tag) More... | |
Functions/Subroutines | |
subroutine, public | xml_parse (raw_contents, start_element_callback, end_element_callback) |
Parses some raw XML raw_contents The raw (unparsed) XML string start_element_callback Subroutine to call for each XML start element end_element_callback Subroutine to call for each XML end element. More... | |
subroutine | process_individual_tag (raw_contents, start_element_callback, end_element_callback, start_index, end_index) |
Processes an individual XML tag. This deduces whether it is a start or end tag, the name and any additional attributes. More... | |
integer function | get_attribute (contents, start_index, attribute_names, attribute_values, attribute_index) |
Retrieves the "next" attribute from the XML tag and returns the position after this attribute to search from next. This contains some additional complexities to deal with a number of different formatted tags. More... | |
integer function | occurances_of_substring (string, substring) |
Returns the number of times a specific substring can be found in a string. More... | |
A SAX parser for XML files. This is used to parse the description of the data and rules. Being a SAX parser it works in a callback fashion, as these often do, and will call the start and end subroutines along with tag details. It still requires some additional stability work to handle ill formatted XML and error checking.
|
private |
Retrieves the "next" attribute from the XML tag and returns the position after this attribute to search from next. This contains some additional complexities to deal with a number of different formatted tags.
contents | The XML string |
start_index | The index to start from when getting the next attribute |
attribute_names | Collection of attribute names that the extraced name is appended to |
attribute_values | Collection of attribute values that the extacted value is appended to |
attribute_index | The index to write the name and value of this attribute into |
Definition at line 120 of file saxparser.F90.
|
private |
Returns the number of times a specific substring can be found in a string.
string | The whole string to search |
substring | The substring to search for and count the number occurances of |
Definition at line 173 of file saxparser.F90.
|
private |
Processes an individual XML tag. This deduces whether it is a start or end tag, the name and any additional attributes.
raw_contents | The raw XML string |
start_element_callback | Subroutine to call on XML element opening tags |
end_element_callback | Subroutine to call on XML element closing tags |
start_index | The start index in the raw contents to go from (the start of this tag) |
end_index | The end index in the raw contents to parse to (the end of this tag) |
Definition at line 68 of file saxparser.F90.
subroutine, public sax_xml_parser_mod::xml_parse | ( | character, dimension(:), intent(in) | raw_contents, |
procedure(start_element_callback_interface) | start_element_callback, | ||
procedure(end_element_callback_interface) | end_element_callback | ||
) |
Parses some raw XML raw_contents The raw (unparsed) XML string start_element_callback Subroutine to call for each XML start element end_element_callback Subroutine to call for each XML end element.
Definition at line 36 of file saxparser.F90.