delete_attributes Program

program~~delete_attributes~~UsesGraph program~delete_attributes delete_attributes module~foxy foxy module~foxy->program~delete_attributes module~foxy_xml_tag foxy_xml_tag module~foxy_xml_tag->module~foxy module~foxy_xml_file foxy_xml_file module~foxy_xml_tag->module~foxy_xml_file module~foxy_xml_file->module~foxy module~penf penf module~penf->module~foxy module~penf->module~foxy_xml_tag module~penf->module~foxy_xml_file module~stringifor stringifor module~penf->module~stringifor module~stringifor_string_t stringifor_string_t module~penf->module~stringifor_string_t module~befor64 befor64 module~penf->module~befor64 module~befor64_pack_data_m befor64_pack_data_m module~penf->module~befor64_pack_data_m module~stringifor->module~foxy_xml_tag module~stringifor_string_t->module~stringifor module~befor64->module~stringifor_string_t module~befor64_pack_data_m->module~befor64 module~penf_global_parameters_variables penf_global_parameters_variables module~penf_global_parameters_variables->module~penf module~penf_b_size penf_b_size module~penf_global_parameters_variables->module~penf_b_size module~penf_stringify penf_stringify module~penf_global_parameters_variables->module~penf_stringify module~penf_b_size->module~penf module~penf_b_size->module~penf_stringify module~penf_stringify->module~penf iso_fortran_env iso_fortran_env iso_fortran_env->module~penf_stringify
Help


FoXy test.

Calls

program~~delete_attributes~~CallsGraph program~delete_attributes delete_attributes interface~xml_tag xml_tag program~delete_attributes->interface~xml_tag proc~create_tag_flat create_tag_flat interface~xml_tag->proc~create_tag_flat proc~create_tag_nested create_tag_nested interface~xml_tag->proc~create_tag_nested
Help

Variables

Type AttributesNameInitial
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 delete_attributes
!-----------------------------------------------------------------------------------------------------------------------------------
!< 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.

print "(A)", 'source'
source = '<first x="1" y="c" z="2">lorem ipsum...</first>'
print "(A)", source

print "(A)", 'delete "y" attribute'
a_tag = xml_tag(name='first', content='lorem ipsum...', attributes=reshape([['x', '1'], ['y', 'c'], ['z', '2']], [2,3]))
call a_tag%delete_attributes(name="y")
parsed = a_tag%stringify()
source = '<first x="1" z="2">lorem ipsum...</first>'
test_passed(1) = trim(adjustl(source))==trim(adjustl(parsed))
print "(A,L1)", parsed//' Is correct? ', test_passed(1)

print "(A)", 'delete "x" attribute'
a_tag = xml_tag(name='first', content='lorem ipsum...', attributes=reshape([['x', '1'], ['y', 'c'], ['z', '2']], [2,3]))
call a_tag%delete_attributes(name="x")
parsed = a_tag%stringify()
source = '<first y="c" z="2">lorem ipsum...</first>'
test_passed(2) = trim(adjustl(source))==trim(adjustl(parsed))
print "(A,L1)", parsed//' Is correct? ', test_passed(2)

print "(A)", 'delete "z" attribute'
a_tag = xml_tag(name='first', content='lorem ipsum...', attributes=reshape([['x', '1'], ['y', 'c'], ['z', '2']], [2,3]))
call a_tag%delete_attributes(name="z")
parsed = a_tag%stringify()
source = '<first x="1" y="c">lorem ipsum...</first>'
test_passed(3) = trim(adjustl(source))==trim(adjustl(parsed))
print "(A,L1)", parsed//' Is correct? ', test_passed(3)

print "(A)", 'delete "x" "z" attributes'
a_tag = xml_tag(name='first', content='lorem ipsum...', attributes=reshape([['x', '1'], ['y', 'c'], ['z', '2']], [2,3]))
call a_tag%delete_attributes(name=["z", "x"])
parsed = a_tag%stringify()
source = '<first y="c">lorem ipsum...</first>'
test_passed(4) = trim(adjustl(source))==trim(adjustl(parsed))
print "(A,L1)", parsed//' Is correct? ', test_passed(4)

print "(A,L1)", new_line('a')//'Are all tests passed? ', all(test_passed)
stop
!-----------------------------------------------------------------------------------------------------------------------------------
endprogram delete_attributes