Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Suggested answer

xml attribute prefix

Posted on by 215
Hello,
 
I want to create in AL an xml document with a custom prefix attribute in the root tag, like this :
 
<root xsi:schemaLocation=/http://myschemaurl/>
...
</root>
 
How can I do that in a codeunit in AL ? I tried different methods on XmlElement variables, but couldn't have the above result.
 
Thank you.
Categories:
  • gdrenteria Profile Picture
    gdrenteria 8,784 Most Valuable Professional on at
    xml attribute prefix
    Hi
    I haven't come across this topic, I found this. I keep searching and I share with you.
    Best Regards
    Gerardo 
  • Magicrevette Profile Picture
    Magicrevette 215 on at
    xml attribute prefix
    I'm not using xmlport to create my xml. I'm using a codeunit, with XmlDocument.Create and XmlElement.Create() methods. SO I can't use namespace prefix property in this case.
     
    With what you suggested me, I could have done something like this :
     
    <root XMLNS:prefix=/http://myschemaurl/>
    ...
    </root>
     
    But what I want is to set an attribute in my root tag something different from xmlns, like this :
     
    <root XSI:prefix=/http://myschemaurl/>
    ...
    </root>
     
    Since the attribute name is not 'XMLNS', it is not a namespace anymore, just an attribute.
     
    Any idea how i can do that in AL ?
     
    Thank you
  • Suggested answer
    gdrenteria Profile Picture
    gdrenteria 8,784 Most Valuable Professional on at

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,326 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,166 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans