AL icon indicating copy to clipboard operation
AL copied to clipboard

XML SelectSingleNode with empty namespace isn't working

Open FSchneiderYav opened this issue 7 years ago • 5 comments

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)

FSchneiderYav avatar Mar 08 '19 09:03 FSchneiderYav

@atoader do you know when this is planned to be resolved?

angela2389 avatar Aug 30 '19 08:08 angela2389

Same issue here as well.. Any news related to this topic ?

testbuddy avatar Oct 25 '19 09:10 testbuddy

This still seems to be not working.

hougaard avatar May 09 '21 07:05 hougaard

This is a runtime issue. For a faster investigation a Request For Hotfix should be created using the appropriate channels.

kalberes avatar Nov 30 '21 12:11 kalberes

After 6 months, perhaps fix it instead?

hougaard avatar Nov 30 '21 16:11 hougaard