Skip to content

Commit

Permalink
Removed trimming node values in Writer
Browse files Browse the repository at this point in the history
  • Loading branch information
ruff committed Jun 6, 2024
1 parent affdb5d commit 51a8944
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/XmlConverterCiiToUbl.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ function () use ($invoiceHeaderAgreement) {
$invoiceHeaderAgreement,
function ($sellerOrderReferencedDocumentNode) {
$this->destination->startElement('cac:OrderReference');
$this->destination->element('cbc:ID', 'Dummy');
$this->destination->element('cbc:SalesOrderID', $sellerOrderReferencedDocumentNode->nodeValue);
$this->destination->endElement();
}
Expand Down
15 changes: 14 additions & 1 deletion src/XmlDocumentWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function startElement(string $tag, string $value = ''): XmlDocumentWriter
$this->splitNamespaceAndTag($tag, $newNameSpace, $newTag);

if ($value) {
$value = trim($value);
//$value = trim($value);
$value = htmlspecialchars($value);
}

Expand Down Expand Up @@ -145,6 +145,19 @@ public function element(string $tag, ?string $value = ''): XmlDocumentWriter
return $this;
}

/**
* Write single element with empty value
*
* @param string $tag
* @return XmlDocumentWriter
*/
public function elementEmpty(string $tag): XmlDocumentWriter
{
$this->startElement($tag, '')->endElement();

return $this;
}

/**
* Write a single element with a single attribute
*
Expand Down

0 comments on commit 51a8944

Please sign in to comment.