Writes beginning pair tag.
XMLWriter $writer: Writer that writes the output.
DOMElement $node: Current node.
$id: Current node id.
protected function writeBPT(\XMLWriter $writer, \DOMElement $node, $id) {
$beginning_tag = '<' . $node->nodeName;
if ($node
->hasAttributes()) {
$attributes = array();
/** @var DOMAttr $attribute */
foreach ($node->attributes as $attribute) {
$attributes[] = $attribute->name . '="' . $attribute->value . '"';
}
$beginning_tag .= ' ' . implode(' ', $attributes);
}
$beginning_tag .= '>';
$writer
->startElement('bpt');
$writer
->writeAttribute('id', $id);
$writer
->text($beginning_tag);
$writer
->endElement();
}