foxy_test_create_tag Program

Uses

  • program~~foxy_test_create_tag~~UsesGraph program~foxy_test_create_tag foxy_test_create_tag module~foxy foxy program~foxy_test_create_tag->module~foxy module~foxy_xml_file foxy_xml_file module~foxy->module~foxy_xml_file module~foxy_xml_tag foxy_xml_tag module~foxy->module~foxy_xml_tag penf penf module~foxy->penf module~foxy_xml_file->module~foxy_xml_tag module~foxy_xml_file->penf module~foxy_xml_tag->penf stringifor stringifor module~foxy_xml_tag->stringifor

FoXy test.


Calls

program~~foxy_test_create_tag~~CallsGraph program~foxy_test_create_tag foxy_test_create_tag proc~parse xml_tag%parse program~foxy_test_create_tag->proc~parse proc~set xml_tag%set program~foxy_test_create_tag->proc~set proc~stringify xml_tag%stringify program~foxy_test_create_tag->proc~stringify is_allocated is_allocated proc~parse->is_allocated proc~get xml_tag%get proc~parse->proc~get proc~parse_attributes_names xml_tag%parse_attributes_names proc~parse->proc~parse_attributes_names proc~parse_tag_name xml_tag%parse_tag_name proc~parse->proc~parse_tag_name proc~add_multiple_attributes xml_tag%add_multiple_attributes proc~set->proc~add_multiple_attributes proc~add_single_attribute xml_tag%add_single_attribute proc~set->proc~add_single_attribute proc~add_stream_attributes xml_tag%add_stream_attributes proc~set->proc~add_stream_attributes chars chars proc~stringify->chars proc~stringify->is_allocated proc~end_tag xml_tag%end_tag proc~stringify->proc~end_tag proc~self_closing_tag xml_tag%self_closing_tag proc~stringify->proc~self_closing_tag proc~start_tag xml_tag%start_tag proc~stringify->proc~start_tag proc~add_multiple_attributes->proc~add_single_attribute proc~alloc_attributes xml_tag%alloc_attributes proc~add_single_attribute->proc~alloc_attributes proc~add_stream_attributes->proc~add_single_attribute fill fill proc~add_stream_attributes->fill partition partition proc~add_stream_attributes->partition slice slice proc~add_stream_attributes->slice proc~get_attributes xml_tag%get_attributes proc~get->proc~get_attributes proc~get_value xml_tag%get_value proc~get->proc~get_value proc~parse_attributes_names->proc~alloc_attributes

Variables

Type Attributes Name Initial
character(len=:), allocatable :: source

String containing the source XML data.

character(len=:), allocatable :: parsed

String containing the parsed XML data.

type(xml_tag) :: a_tag

XML tag handler.

logical :: test_passed(4)

List of passed tests.


Source Code

program foxy_test_create_tag
!< FoXy test.
use foxy, only: xml_tag

implicit none
character(len=:), allocatable :: source         !< String containing the source XML data.
character(len=:), allocatable :: parsed         !< String containing the parsed XML data.
type(xml_tag)                 :: a_tag          !< XML tag handler.
logical                       :: test_passed(4) !< List of passed tests.

test_passed = .false.

! create using xml_tag overloaded procedures
print "(A)", 'source'
source = '<first x="1" y="c" z="2">lorem ipsum...</first>'
print "(A)", source
print "(A)", 'created'
a_tag = xml_tag(name='first', content='lorem ipsum...', attributes=reshape([['x', '1'], ['y', 'c'], ['z', '2']], [2,3]))
parsed = a_tag%stringify()
test_passed(1) = trim(source)==trim(parsed)
print "(A,L1)", parsed//'Is correct? ', test_passed(1)

print "(A)", 'source'
source = '<second x="1" y="c" z="2"/>'
print "(A)", source
print "(A)", 'created'
a_tag = xml_tag(name='second', attributes=reshape([['x', '1'], ['y', 'c'], ['z', '2']], [2,3]), is_self_closing=.true.)
parsed = a_tag%stringify()
test_passed(2) = trim(source)==trim(parsed)
print "(A,L1)", parsed//' Is correct? ', test_passed(2)

! create parsing a source
print "(A)", 'source'
source = '<third x="1" y="c" z="2"/>'
print "(A)", source
print "(A)", 'created'
call a_tag%set(name='third')
call a_tag%parse(source=source)
parsed = a_tag%stringify()
test_passed(3) = trim(source)==trim(parsed)
print "(A,L1)", parsed//' Is correct? ', test_passed(3)

print "(A)", 'source'
source = '<fourth x="1" y="c" z="2"></fourth>'
print "(A)", source
print "(A)", 'created'
call a_tag%set(name='fourth')
call a_tag%parse(source=source)
parsed = a_tag%stringify()
test_passed(4) = trim(source)==trim(parsed)
print "(A,L1)", parsed//' Is correct? ', test_passed(4)

print "(A,L1)", new_line('a')//'Are all tests passed? ', all(test_passed)
endprogram foxy_test_create_tag