fix(xml): make sure we include xml preamble for consistency
MODIFY
packages/appium-plugins/packages/universal-xml/lib/source.js
packages/appium-plugins/packages/universal-xml/lib/source.js
@@ -29,7 +29,8 @@ export function transformSourceXml (xmlStr, platform, {metadata = {}, addIndexPa
const xmlObj = parser.parse(xmlStr, PARSE_OPTS);
const unknowns = transformNode(xmlObj, platform, {metadata, addIndexPath, parentPath: ''});
const jParser = new j2xParser(GEN_OPTS);
- const transformedXml = jParser.parse(xmlObj).trim();
+ let transformedXml = jParser.parse(xmlObj).trim();
+ transformedXml = `<?xml version="1.0" encoding="UTF-8"?>\n${transformedXml}`;
return {xml: transformedXml, unknowns};
}

MODIFY
packages/appium-plugins/packages/universal-xml/test/fixtures/android-transformed-path.xml
packages/appium-plugins/packages/universal-xml/test/fixtures/android-transformed-path.xml
+<?xml version="1.0" encoding="UTF-8"?>
<UI width="1080" height="1920" indexPath="/0">
<View text="" indexPath="/0/0" x="0" y="0" width="1080" height="1920" visible="true">
<View text="" indexPath="/0/0/0" x="0" y="0" width="1080" height="1920" visible="true">

MODIFY
packages/appium-plugins/packages/universal-xml/test/fixtures/android-transformed.xml
packages/appium-plugins/packages/universal-xml/test/fixtures/android-transformed.xml
+<?xml version="1.0" encoding="UTF-8"?>
<UI width="1080" height="1920">
<View text="" x="0" y="0" width="1080" height="1920" visible="true">
<View text="" x="0" y="0" width="1080" height="1920" visible="true">

MODIFY
packages/appium-plugins/packages/universal-xml/test/fixtures/ios-transformed-edge.xml
packages/appium-plugins/packages/universal-xml/test/fixtures/ios-transformed-edge.xml
+<?xml version="1.0" encoding="UTF-8"?>
<UI>
<App visible="true" x="0" y="0" width="414" height="896" axId="TheApp" text="TheApp">
<SomeRandoElement oddAttribute="odd"></SomeRandoElement>

MODIFY
packages/appium-plugins/packages/universal-xml/test/fixtures/ios-transformed-path.xml
packages/appium-plugins/packages/universal-xml/test/fixtures/ios-transformed-path.xml
+<?xml version="1.0" encoding="UTF-8"?>
<UI indexPath="/0">
<App visible="true" x="0" y="0" width="414" height="896" indexPath="/0/0" axId="TheApp" text="TheApp">
<Window visible="true" x="0" y="0" width="414" height="896" indexPath="/0/0/0">

MODIFY
packages/appium-plugins/packages/universal-xml/test/fixtures/ios-transformed.xml
packages/appium-plugins/packages/universal-xml/test/fixtures/ios-transformed.xml
+<?xml version="1.0" encoding="UTF-8"?>
<UI>
<App visible="true" x="0" y="0" width="414" height="896" axId="TheApp" text="TheApp">
<Window visible="true" x="0" y="0" width="414" height="896">

fix(xml): make sure we include xml preamble for consistency