BC17 - Creating XML Node namespace from code

dreezdreez Member Posts: 16
Hi,

I want to make an XML File from code in AL. I am using XMLDoc and its related data types. I have made a codeunit that handles almost everything what I need.

I have a problem when I am setting attributes to the XmlElement. This whole thing is not working if attribute name contains ":" (colon). I know that colon means namespace, but how can I add a namespace to the XmlElement?

I was trying to do something with XMLNamespaceManager, but it didn't help.

Here's my attempt:
var
    Root: XmlElement;
    XMLDoc: XmlDocument;
    XmlNSMgt: XmlNamespaceManager;
begin
    Root.GetDocument(XMLDoc);
    XmlNSMgt.NameTable(XmlDoc.NameTable);
    XmlNsMgt.AddNameSpace('abc','xyz'); 
end;
but it didn't affect the resultant file...

Any help will be appreciated!

Best Answer

  • dreezdreez Member Posts: 16
    Accepted Answer
    Ok... I've just solved the issue. I have used XmlAttribute instead.
    Thanks for inspiring me anyway!

Answers

  • dreezdreez Member Posts: 16
    Accepted Answer
    Ok... I've just solved the issue. I have used XmlAttribute instead.
    Thanks for inspiring me anyway!
Sign In or Register to comment.