20 #ifndef MAX_PROP_LENGTH 21 #define MAX_PROP_LENGTH 100 33 character(len=MAX_PROP_LENGTH) :: name
35 character(len=MAX_PROP_LENGTH) :: value
44 character(len=MAX_PROP_LENGTH) :: localname
46 integer :: subnodelevel
48 TYPE(
attrib ),
pointer :: attrs(:) => null()
50 TYPE(
xmlnode ),
pointer :: subnodes(:) => null()
52 TYPE(
xmlnode ),
pointer :: parentnode => null()
54 character(len=:),
pointer ::
value => null()
76 if (
ASSOCIATED(cxmlnode%subnodes))
then 96 if (
ASSOCIATED(node%subnodes))
then 97 deallocate(node%subnodes)
100 if (
ASSOCIATED(node%attrs))
then 101 deallocate(node%attrs)
104 if (
ASSOCIATED(node%parentnode))
then 105 deallocate(node%parentnode)
108 if (
ASSOCIATED(node%value))
then 109 deallocate(node%value)
125 if (
ASSOCIATED(source%attrs))
then 126 dest%attrs => source%attrs
129 if (
ASSOCIATED(source%subnodes))
then 130 dest%subnodes => source%subnodes
133 if (
ASSOCIATED(source%parentnode))
then 134 dest%parentnode => source%parentnode
137 if (
ASSOCIATED(source%value))
then 138 dest%value => source%value
141 dest%subnodelevel = source%subnodelevel
142 dest%localname = source%localname
161 if (
ASSOCIATED(node%subnodes))
then 163 print *,
"The node has no subnodes." 182 print *,
"**********************" 183 print *,
"Printing content of an XML node" 184 print *,
"localname: ", trim(node%localname)
185 print *,
"subnodelevel: ", node%subnodelevel
187 if (
ASSOCIATED(node%attrs))
then 188 print *,
"attributes:" 189 do idx = 1,
SIZE(node%attrs, 1)
190 print *, idx,
" ", trim(node%attrs(idx)%name),
": ", trim(node%attrs(idx)%value)
194 if (
ASSOCIATED(node%value))
then 195 print *,
"The value stored in the node: ", trim(node%value)
198 if (
ASSOCIATED(node%subnodes))
then 199 print *,
"Number of subnodes: ",
SIZE(node%subnodes, 1)
200 do idx = 1,
SIZE(node%subnodes, 1)
219 TYPE(
xmlnode ),
pointer :: subnodes_tmp(:)
223 if (.not.
ASSOCIATED(node%subnodes))
then 224 allocate(node%subnodes(1))
225 call copynode(subnode, node%subnodes(1))
230 elementnum =
SIZE( node%subnodes, 1)
231 allocate( subnodes_tmp(elementnum) )
233 do idx = 1, elementnum
234 call copynode(node%subnodes(idx), subnodes_tmp(idx))
237 deallocate( node%subnodes )
238 allocate( node%subnodes(elementnum+1) )
239 do idx = 1, elementnum
240 call copynode(subnodes_tmp(idx), node%subnodes(idx))
243 deallocate( subnodes_tmp )
245 call copynode(subnode, node%subnodes(elementnum+1))
subroutine addsubnode(node, subnode)
subroutine deallocatenode(node)
subroutine printnode(node)
logical function hassubnodes(cXMLnode)
subroutine copynode(source, dest)
subroutine printnodewithsubnodes(node)