Skip to main content
Dominique Sacre
Rocketeer
Mar 9, 2022 10:40 AM UTC

the XML PARSE won't accept empty attributes

Dear all,

We just converted our zOS cobol version 4 into Micro Focus COBOL  V6.0 revision 000 on Linux.   the XML PARSE won't accept empty attributes. Do we need to test for xml-text length, or is there a setting to tell the parser to ignore empty attributes?

Thanks James

    5 replies

    Chris Glazier
    Moderator
    Mar 9, 2022 6:43 PM UTC

    Dear all,

    We just converted our zOS cobol version 4 into Micro Focus COBOL  V6.0 revision 000 on Linux.   the XML PARSE won't accept empty attributes. Do we need to test for xml-text length, or is there a setting to tell the parser to ignore empty attributes?

    Thanks James

    What is the error condition that you are experiencing?

    Can you please provide an example for this problem? 

    Dominique Sacre
    Rocketeer
    Mar 9, 2022 6:59 PM UTC

    What is the error condition that you are experiencing?

    Can you please provide an example for this problem? 

    Thanks Chris. 

    As an example, when the following piece of XML containing file="", doc-number="" and appl-type="" is parsed by Microfocus XML PARSE function:

    <ep-national-search-request lang="fr" dtd-version="v1.5" file="" country="FR" doc-number="" id="2113300">
       <fr-bibliographic-data>
          <application-reference appl-type="">
             <document-id>
                <country>FR</country>
    ...
    

    The three attributes with an empty string as value are added as elements to the adm-xml-tag array, as can be seen at the following displays:

    Start tag : fr-bibliographic-data
    Start tag : application-reference
    Attr Name : appl-type
    Start tag : document-id
    Start tag : country
    Content (s) : FR
    *------ Element depth ----------*
    (1) ep-national-search-request
    (2) file
    (3) doc-number
    (4) fr-bibliographic-data
    (5) application-reference
    (6) appl-type
    (7) document-id
    (8) country
    

    When it should be something like the following:

    Start tag : fr-bibliographic-data
    Start tag : application-reference
    Start tag : document-id
    Start tag : country
    Content (s) : FR
    *------ Element depth ----------*
    (1) ep-national-search-request
    (2) fr-bibliographic-data
    (3) application-reference
    (4) document-id
    (5) country
    

    As happens at the mainframe: ( i am trying to attach a png image here to show how it looked on zOS)  

    Dominique Sacre
    Rocketeer
    Mar 9, 2022 7:00 PM UTC

    What is the error condition that you are experiencing?

    Can you please provide an example for this problem? 

    compiler option XLMSS  not COMPAT

    Dominique Sacre
    Rocketeer
    Mar 9, 2022 7:02 PM UTC

    What is the error condition that you are experiencing?

    Can you please provide an example for this problem? 

    my EPO colleague raised this with MF support last night.  ticket number is : 02190419

    Chris Glazier
    Moderator
    Mar 9, 2022 8:21 PM UTC

    my EPO colleague raised this with MF support last night.  ticket number is : 02190419

    So on the mainframe when there is an empty attribute then it will not even generate the ATTRIBUTE-NAME event for it but in Micro Focus it generates the ATTRIBUTE-NAME event but not the ATTRIBUTE-CHARACTERS event.

    Yes, I can reproduce this behavior that you are reporting.

    If I change the directive to xmlparse"compat" then it behaves differently in that both the ATTRIBUTE-NAME and ATTRIBUTE-CHARACTERS events are generated and XML-TEXT contains spaces for ATTRIBUTE-CHARACTERS.

    Since you already have an incident open with support you should work directly with the engineer assigned to the case. Chances are that this will have to be raised as a defect and fixed in a subsequent version.