From 33e2ab7ee64fbb13cfb15f90ae58be48639e1d07 Mon Sep 17 00:00:00 2001 From: Jon Clausen Date: Wed, 22 Jan 2025 19:16:48 -0500 Subject: [PATCH] BL-970 Resolve - add handling for legacy method signature --- .../runtime/bifs/global/xml/XMLElemNew.java | 7 +++++++ .../bifs/global/xml/XMLElemNewTest.java | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/main/java/ortus/boxlang/runtime/bifs/global/xml/XMLElemNew.java b/src/main/java/ortus/boxlang/runtime/bifs/global/xml/XMLElemNew.java index e477330a1..6aa5d71f3 100644 --- a/src/main/java/ortus/boxlang/runtime/bifs/global/xml/XMLElemNew.java +++ b/src/main/java/ortus/boxlang/runtime/bifs/global/xml/XMLElemNew.java @@ -39,6 +39,7 @@ import ortus.boxlang.runtime.types.Argument; import ortus.boxlang.runtime.types.XML; import ortus.boxlang.runtime.types.exceptions.BoxRuntimeException; +import ortus.boxlang.runtime.util.ValidationUtil; @BoxBIF public class XMLElemNew extends BIF { @@ -74,6 +75,12 @@ public Object _invoke( IBoxContext context, ArgumentsScope arguments ) { Node documentNode = xmlObject.getNode(); + // Backward compat for the weird ACF and Lucee method signature + if ( ValidationUtil.isValidURL( childName ) ) { + childName = namespace; + namespace = arguments.getAsString( Key.childname ); + } + if ( documentNode == null ) { String xmlString = null; try { diff --git a/src/test/java/ortus/boxlang/runtime/bifs/global/xml/XMLElemNewTest.java b/src/test/java/ortus/boxlang/runtime/bifs/global/xml/XMLElemNewTest.java index 6dec31dad..004a5c3d4 100644 --- a/src/test/java/ortus/boxlang/runtime/bifs/global/xml/XMLElemNewTest.java +++ b/src/test/java/ortus/boxlang/runtime/bifs/global/xml/XMLElemNewTest.java @@ -130,6 +130,25 @@ public void testNodeReturn() { } + @DisplayName( "It can accept namespace arg as second argument" ) + @Test + public void testNameSpaceTwo() { + instance.executeSource( + """ + envelope = xmlParse( "" ); + soapBody = envelope.xmlRoot[ "soapenv:Body" ]; + result = xmlElemNew( + soapBody, + "http://services.rccl.com/Interfaces/GroupList", + "getGroupList" + ); + """, + context ); + assertTrue( variables.get( result ) instanceof XML ); + // assertEquals( "BoxLang", variables.getAsString( result ) ); + + } + @DisplayName( "Tests some typing and abstraction of XML objects" ) @Test @Disabled