XML SelectSingleNode with empty namespace isn't working
Describe the bug The function XMLDocument.SelectNodes('//Property', XMLNamespaceManager, lXmlNodeList) with a empty Namespace don't work.
To Reproduce I have a XML File
<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<GetEntities xmlns="http://xxx-service.de">
<request xmlns:a="http://schemas.datacontract.org/2004/07/xxx.Interface.WebServices" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:Entities>
<a:xxxEntity>
<a:EntityType>
Material
</a:EntityType>
<a:Properties>
<a:Property i:type="a:StringProperty">
<a:Name>
Number
</a:Name>
<a:Value>
123
</a:Value>
</a:Property>
</a:Properties>
</a:xxxEntity>
</request>
</GetEntities>
</a:Body>
</a:Envelope>
AL programming
`
XMLNamespaceManager.NameTable(piDocXML.NameTable());
XMLNamespaceManager.AddNamespace('', 'http://xxx-service.de');
XMLNamespaceManager.AddNamespace('s', 'http://schemas.xmlsoap.org/soap/envelope/');
XMLNamespaceManager.AddNamespace('a', 'http://schemas.datacontract.org/2004/07/xxx.Interface.WebServices');
XMLNamespaceManager.AddNamespace('i', 'http://www.w3.org/2001/XMLSchema-instance');
docXml.SelectSingleNode('//GetEntities', XMLNamespaceManager, XmlNodeList); `
Expected behavior I got the message The XPath query '//GetEntities' does not match any nodes.
the following statemant is working- ` XMLNamespaceManager.NameTable(piDocXML.NameTable()); XMLNamespaceManager.AddNamespace('', 'http://xxx-service.de'); XMLNamespaceManager.AddNamespace('s', 'http://schemas.xmlsoap.org/soap/envelope/'); XMLNamespaceManager.AddNamespace('a', 'http://schemas.datacontract.org/2004/07/xxx.Interface.WebServices'); XMLNamespaceManager.AddNamespace('i', 'http://www.w3.org/2001/XMLSchema-instance');
docXml.SelectSingleNode('//a:Entities', XMLNamespaceManager, XmlNodeList); `
Versions:
- AL Langauge: 2.1.97331
- Business Central: 14.0.27940.0 (14.0.27940.0)
@atoader do you know when this is planned to be resolved?
Same issue here as well.. Any news related to this topic ?
This still seems to be not working.
This is a runtime issue. For a faster investigation a Request For Hotfix should be created using the appropriate channels.
After 6 months, perhaps fix it instead?