NetTalk Central

Author Topic: Setting XML Attribute Using Extended Name Attributes  (Read 4169 times)

EdwardLoh

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
Setting XML Attribute Using Extended Name Attributes
« on: February 28, 2025, 02:51:46 PM »
Could some one tell me what I am doing wrong?

I trying to output the following XML tag:

         <return xmlns="">
               <licenseNumber>0282500615</licenseNumber>
         </return>


I tried the following Clarion Group Declarations:

ReturnG              GROUP,PRE(),NAME('return')
xmlns                     CSTRING(32),NAME('xmlns | attribute(return)')
LicenseNumber        CSTRING(64),NAME('licenseNumber')
                          END


ReturnG              GROUP,PRE(),NAME('return')
xmlns                     CSTRING(32),NAME('xmlns | attribute')
LicenseNumber        CSTRING(64),NAME('licenseNumber')
                          END


Both of them resulted in the following:

<return><xmlns/><licenseNumber>0282500615</licenseNumber></return>


The is part of the return parameters in a WebServiceMethod Template.  I cannot tell what I am doing wrong because I was able to set the xmlns attribute in another service method.

Regards,

Edward

EdwardLoh

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
Re: Setting XML Attribute Using Extended Name Attributes
« Reply #1 on: March 01, 2025, 11:22:44 PM »
Hello Again,

Just a quick update and a correction on my previous post.  I was not paying attention to my previous tests.

The Clarion Group Declaration:

ReturnG              GROUP,PRE(),NAME('return')
xmlns                     CSTRING(32),NAME('xmlns | attribute')
LicenseNumber        CSTRING(64),NAME('licenseNumber')
                          END

Generated the following:

<return>
    < xmlns="">
    <licenseNumber>001YY10020</licenseNumber>
</return>


While the following declaration:

ReturnG              GROUP,PRE(),NAME('return')
xmlns                     CSTRING(32),NAME('xmlns | attribute(return)')
LicenseNumber        CSTRING(64),NAME('licenseNumber')
                          END


Generated the following:

<return>
    <xmlns/>
    <licenseNumber>001YY10020</licenseNumber>
</return>


Now I am beginning to think that something is not quite right with the XML generation using Extended Naming Attribute.

I will keep looking.

Edward


Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11297
    • View Profile
Re: Setting XML Attribute Using Extended Name Attributes
« Reply #2 on: March 03, 2025, 11:21:20 PM »
I suspect the issue is your SAVE call.

the Save should be;


   xml.save(ReturnG, strxmlout, '', 'return')
or
   xml.save(ReturnG, strxmlout, 'return')
not

   xml.save(ReturnG, strxmlout, 'return','')



EdwardLoh

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
Re: Setting XML Attribute Using Extended Name Attributes
« Reply #3 on: March 04, 2025, 05:53:44 PM »
Thanks Bruce,

Worked perfectly.

Edward