Menu

#961 Nested Elements Mishandled Despite 'with attributes' Specification

GC 3.x
open
5 - default
2024-05-26
2024-04-04
No

Summary

The attached COBOL program incorrectly generates XML for nested elements even when the "with attributes" phrase is specified. In the correct generation, every child should be treated as an attribute, not an element.
The attached example is copied from IBM's programmer guide, see here

Steps to reproduce

$ cobc -x XGFX.cbl && ./XGFX

Actual output

<G A="aaa" E="eee"><B><C>ccc</C><D>ddd</D></B></G>

Expected output

<G A="aaa" E="eee"><B C="ccc" D="ddd"></B></G>

Test environment

$ cobc --version
cobc (GnuCOBOL) 3.3-dev.0
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Keisuke Nishida, Roger While, Ron Norman, Simon Sobisch, Edward Hart
Built     Apr 04 2024 22:42:48
Packaged  Apr 03 2024 20:03:09 UTC
C version "13.2.1 20230801"

Notes

This bug was first mentioned here by @sf-mensch

1 Attachments

Related

Discussion: XML GENERATE

Discussion


Log in to post a comment.