Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

xml attribute prefix

(0) ShareShare
ReportReport
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.
  • gdrenteria Profile Picture
    gdrenteria 12,929 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 12,929 Most Valuable Professional on at

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,661 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,379 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans