Using UBL/Oasis urn type namespaces fatal error #45
Unanswered
coenjacobs
asked this question in
Questions
Replies: 1 comment
-
Namespace identifiers must be declared without the Rewriting your code, $xml = new FluidXml('Invoice');
$xml->namespace('cac', 'urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2');
$xml->namespace('cbc', 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2');
$xml->namespace('inv', 'urn:oasis:names:specification:ubl:schema:xsd:Invoice-2');
$xml->addChild('cbc:UBLVersionID', '2.0'); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Doing this:
Results in this (paths stripped):
Fatal error: Uncaught Error: Call to a member function uri() on null in .../vendor/servo/fluidxml/source/FluidXml/FluidInsertionHandler.php:194 Stack trace: #0 .../vendor/servo/fluidxml/source/FluidXml/FluidInsertionHandler.php(259): FluidXml\FluidInsertionHandler->createElement('UBLVersionID', '2.0') #1 .../vendor/servo/fluidxml/source/FluidXml/FluidInsertionHandler.php(92): FluidXml\FluidInsertionHandler->insertStringSimple(Object(DOMElement), 'cbc:UBLVersionI...', '2.0', Object(Closure), Array) #2 .../vendor/servo/fluidxml/source/FluidXml/FluidInsertionHandler.php(26): FluidXml\FluidInsertionHandler->handleInsertion(Object(DOMElement), 'cbc:UBLVersionI...', '2.0', Object(Closure), Array) #3 /Users in .../vendor/servo/fluidxml/source/FluidXml/FluidInsertionHandler.php on line 194
As you can see in the error, the child I'm trying to add is throwing the error. This only happens when the namespace is used in the element name of the child. Am I adding the namespace wrong to the child element name? I've followed the Getting started guide on namespaces and there it appears to be used in the same way as I have shown above.
It also doesn't matter if I add the namespaces to the root element as attributes or not. Is this because the UBL/Oasis namespaces use the urn type notation of the namespaces perhaps?
Beta Was this translation helpful? Give feedback.
All reactions