File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -113,6 +113,7 @@ public final class TypeConverter {
113113 public static final String ERROR_MESSAGE_UNION_START = "{" ;
114114 public static final String ERROR_MESSAGE_UNION_END = "}" ;
115115 public static final String ERROR_MESSAGE_UNION_SEPARATOR = "or" ;
116+ public static final String XML_START_ELEMENT = "<" ;
116117
117118 public static Object convertValues (Type targetType , Object inputValue ) {
118119 Type inputType = TypeChecker .getType (inputValue );
@@ -973,8 +974,11 @@ public static BDecimal stringToDecimal(String value) throws NumberFormatExceptio
973974 }
974975
975976 public static BXml stringToXml (String value ) throws BError {
976- BXml item = XmlUtils .parse ("<root>" + value + "</root>" );
977- return item .children ();
977+ String xml = value .trim ();
978+ if (!xml .startsWith (XML_START_ELEMENT )) {
979+ return XmlUtils .parse ("<root>" + value + "</root>" ).children ();
980+ }
981+ return XmlUtils .parse (xml );
978982 }
979983
980984 public static RegExpValue stringToRegExp (String value ) throws BError {
You can’t perform that action at this time.
0 commit comments