File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -113,7 +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 = "<" ;
116+ public static final String XML_DECLARATION = "<?xml " ;
117117
118118 public static Object convertValues (Type targetType , Object inputValue ) {
119119 Type inputType = TypeChecker .getType (inputValue );
@@ -975,10 +975,10 @@ public static BDecimal stringToDecimal(String value) throws NumberFormatExceptio
975975
976976 public static BXml stringToXml (String value ) throws BError {
977977 String xml = value .trim ();
978- if (! xml .startsWith (XML_START_ELEMENT )) {
979- return XmlUtils .parse ("<root>" + value + "</root>" ). children ( );
978+ if (xml .startsWith (XML_DECLARATION )) {
979+ return XmlUtils .parse (xml );
980980 }
981- return XmlUtils .parse (xml );
981+ return XmlUtils .parse ("<root>" + value + "</root>" ). children ( );
982982 }
983983
984984 public static RegExpValue stringToRegExp (String value ) throws BError {
You can’t perform that action at this time.
0 commit comments