X-Rechnung CII: missing qdt namespace
MelanieVeigl opened this issue ยท 5 comments
Hello,
thank you for the great work on this project, I already use it to read zugferd and plan to use it for x-Rechnung cii and ubl.
I attached an example for X-Rechnung CII 2.0 without the qdt namespace. On InvoiceDescriptor.Load I get a XPathException "namesapce 'qdt' is not defined."
I think it should not be an error, if the namespace is not used in xml.
What is your proposal to handle this error?
good point. Currently, only qdt is supported for reading invoices.
It would be pretty easy to write this code more abstract:
i.e. create a function which reads the datetime sub node from a given node regardless if it's qdt or udt.
like
retval.OrderDate = _childNodeAsDateTime(doc.DocumentElement, "//ram:ApplicableHeaderTradeAgreement/ram:BuyerOrderReferencedDocument/ram:FormattedIssueDateTime", nsmgr);
DateTime _childNodeAsDateTime(...)
{
// find out if we have a qdt or udt sub node
// apply _nodeAsDateTime() to the respective sub node
}
What do you think?
sounds good. I will create a pull request with the suggested changes.
Thanks, go ahead. I might move this into a separate dedicated class like 'UniversalDataTypeParser' later on though.
I had some spare time and implemented this already. Could you contribute a test case?
Great :), your changes work as expected. Thanks for the quick adjustment. I added tests with #327