Skip to main content

Hi, I'm trying to write XML files using copybooks generated from XSD files.

Generating the copybook repeats the "namespace is" phrase for all elements.

            06 group identified by "group".
             07 Item1 PIC X(30) identified by "line1" namespace is "http://.......".
             07 Item2 PIC X(30) identified by "line2" namespace is "http://.......".
             07 Item3 PIC X(30) identified by "line3" namespace is "http://.......".
             07 Item4 PIC X(30) identified by "line4" namespace is "http://.......".

The resultant XML file includes repetitions of xmlns="http://......."> for all subordinate elements.

<group>
   <Item1 xmlns="http://.......">Text 1</Item1>
   <Item2 xmlns="http://.......">Text 2</Item2>
   <Item3 xmlns="http://.......">Text 3</Item3>
   <Item4 xmlns="http://.......">Text 4</Item4>
</group>

Is there any way to result in placement of the namespace in the group with a prefix included in subordinate items;

<group xmlns:ins="http://.......">
   <ins:Item1>Text 1</Item1>
   <ins:Item2>Text 2</Item2>
   <ins:Item3>Text 3</Item3>
   <ins:Item4>Text 4</Item4>
</group>

Thanks, Rob.

 


#ServerExpress
#COBOL
#netexpress

Hi, I'm trying to write XML files using copybooks generated from XSD files.

Generating the copybook repeats the "namespace is" phrase for all elements.

            06 group identified by "group".
             07 Item1 PIC X(30) identified by "line1" namespace is "http://.......".
             07 Item2 PIC X(30) identified by "line2" namespace is "http://.......".
             07 Item3 PIC X(30) identified by "line3" namespace is "http://.......".
             07 Item4 PIC X(30) identified by "line4" namespace is "http://.......".

The resultant XML file includes repetitions of xmlns="http://......."> for all subordinate elements.

<group>
   <Item1 xmlns="http://.......">Text 1</Item1>
   <Item2 xmlns="http://.......">Text 2</Item2>
   <Item3 xmlns="http://.......">Text 3</Item3>
   <Item4 xmlns="http://.......">Text 4</Item4>
</group>

Is there any way to result in placement of the namespace in the group with a prefix included in subordinate items;

<group xmlns:ins="http://.......">
   <ins:Item1>Text 1</Item1>
   <ins:Item2>Text 2</Item2>
   <ins:Item3>Text 3</Item3>
   <ins:Item4>Text 4</Item4>
</group>

Thanks, Rob.

 


#ServerExpress
#COBOL
#netexpress

Hi Rob,

Simply move the namespace clause to the group item so it looks like:

       06 group identified by "group" namespace is "http://.......".
            07 Item1 PIC X(30) identified by "line1".
            07 Item2 PIC X(30) identified by "line2".
            07 Item3 PIC X(30) identified by "line3".
            07 Item4 PIC X(30) identified by "line4" .