We just had a problem creating a bpost order when one of the product names in the orderline contains an '&' character.
This gives us the following error:
Error in request: cvc-pattern-valid: Value '' is not facet-valid with respect to pattern '.*[^\s].*' for type 'OrderLineTextType'.
Code which fails:
$itemName = 'Something with an & character.';
$itemQty = 1;
$bpostOrder->addLine(new TijsVerkoyen\Bpost\Bpost\Order\Line($itemName, $itemQty));
$itemName = htmlspecialchars('Something with an & character.', ENT_XML1);
$itemQty = 1;
$bpostOrder->addLine(new TijsVerkoyen\Bpost\Bpost\Order\Line($itemName, $itemQty));
Results in this XML:
<tns:orderLine>
<tns:text>Something with an & character.</tns:text>
<tns:nbOfItems>1</tns:nbOfItems>
</tns:orderLine>
But I don't think we should handle this in our own code, this should be handled by this library, no?
Another fix might be to wrap the text in CDATA sections, but I didn't test that.
Hi
We just had a problem creating a bpost order when one of the product names in the orderline contains an '&' character. This gives us the following error:
Code which fails:
Results in this XML:
Code to fix it:
Results in this XML:
But I don't think we should handle this in our own code, this should be handled by this library, no? Another fix might be to wrap the text in CDATA sections, but I didn't test that.
Thanks!