Avoid xml validation at root level

This commit is contained in:
JuanCarlos 2019-01-09 17:36:26 +01:00
parent efdd7c3930
commit 8b088b9d7b

View File

@ -16,7 +16,7 @@ import { uiModules } from 'ui/modules';
const app = uiModules.get('app/wazuh', []);
app.directive('wzXmlFileEditor', function() {
app.directive('wzXmlFileEditor', function () {
return {
restrict: 'E',
scope: {
@ -30,7 +30,7 @@ app.directive('wzXmlFileEditor', function() {
try {
const parser = new DOMParser(); // eslint-disable-line
const xml = $scope.xmlCodeBox.getValue();
const xmlDoc = parser.parseFromString(xml, 'text/xml');
const xmlDoc = parser.parseFromString('<file>' + xml + '</file>', 'text/xml');
$scope.validFn({
valid: !!xmlDoc.getElementsByTagName('parsererror').length
});