All files / src/web/flowable/roundTrip xmlSerialization.ts

100% Statements 6/6
100% Branches 2/2
100% Functions 1/1
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13        106x 106x 330x 106x   224x   106x  
import type { Document as XmlDocument } from '@xmldom/xmldom';
import { isXmlDeclarationNode, serializeXmlNode } from './xmlSerializationHelpers';
 
export function serializeXmlDocument(document: XmlDocument): string {
	let xml = '<?xml version="1.0" encoding="UTF-8"?>\n';
	for (const child of Array.from(document.childNodes)) {
		if (isXmlDeclarationNode(child)) {
			continue;
		}
		xml += serializeXmlNode(child, 0);
	}
	return xml;
}