-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up XML template files #23
Conversation
What should we do about this? |
I see you implemented a function to remove existing XML data from sample files. I don't think this is transparent enough since I can't easily look at the empty XML files and validate they are empty. It would be better to split the current XML files into 2 folders. One for samples (to view and develop with) and one for empty templates.
|
Okay, so this way we don't need to create any function and can just copy empty XML templates. |
Yes. I think this is the most transparent solution. So we can just look at the empty XML and validate it. In the accounting industry, no mistake can happen. Like forgetting to remove some old value from an XML template. That's what I meant from the start. From the way you implemented it, I see now that I wasn't clear enough on the implementation step. |
Like this?
|
I haven't tested all but |
<ram:IssueDateTime> | ||
<udt:DateTimeString format="102">20171031</udt:DateTimeString> | ||
<udt:DateTimeString format="102">00000000</udt:DateTimeString> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why so many 00 and not an empty tag?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because dates have 8 digits?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use an empty tag, like you did with all other tags? You said that's good practice. Why add placeholders for this one?
@@ -1,165 +1,165 @@ | |||
<rsm:CrossIndustryInvoice xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:100" xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100" xmlns:rsm="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100" xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |||
<rsm:ExchangedDocumentContext> | |||
<ram:BusinessProcessSpecifiedDocumentContextParameter> | |||
<ram:ID>A1</ram:ID> | |||
<ram:ID/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will lxml expand the tag again? I would have expected to see <ram:ID></ram:ID>
for an empty tag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the tags are expanded when any data is added. It's good practice to have empty tags as <tag/>
rather than <tag></tag>
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If they are expanded it's fine.
Please provide a minimal example that I can run to see that the empty XML templates can be filled again. Can post it here as comment. |
You can try this to check:
|
</ram:IncludedNote> | ||
</rsm:ExchangedDocument> | ||
<rsm:SupplyChainTradeTransaction> | ||
<ram:IncludedSupplyChainTradeLineItem> | ||
<ram:AssociatedDocumentLineDocument> | ||
<ram:LineID>1</ram:LineID> | ||
<ram:LineID>0</ram:LineID> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can't be 0. It's the line numbering.
<ram:CityName>PARIS</ram:CityName> | ||
<ram:CountryID>FR</ram:CountryID> | ||
<ram:PostcodeCode>0</ram:PostcodeCode> | ||
<ram:LineOne/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How did you decide on using an empty tag vs. 0
as placeholder?
</ram:IncludedNote> | ||
<ram:IncludedNote> | ||
<ram:Content>RCS NANTERRE 999 888 777</ram:Content> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When there are multiple invoice notes, you can't just make them all empty. We only keep one. Our current logic doesn't even allow having multiple elements at the same path.
Still need major changes before merging. See comments and
|
Can you provide me some resource from where I can understand the XML document? |
The XML represents an invoice. You can look at the sample invoice PDF content and see how they relate to the XML. Then try again. |
Here are the things I have gathered till know:
|
I don't know what you mean with your last comment. The stuff you write about the "only four fields can be changed" is simply not true. Maybe you want to check again. |
It seems you are mixing up the module for creating the PDF with the module responsible for the XML document. That's totally unrelated... |
* Assigning a placeholder if some restriction is there in XSD * Or if it contains default value * All the templates have been successfully validated against XSD
<ram:TypeCode>380</ram:TypeCode> | ||
<ram:IssueDateTime> | ||
<udt:DateTimeString format="102">20171031</udt:DateTimeString> | ||
<udt:DateTimeString format=""></udt:DateTimeString> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to keep the default time format. Else we need to code support for different formats which isn't practical.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So should I leave all the attributes as is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leave all the time formats. format="102"
. Else we need to take care of time formatting in many places.
It seems like you didn't adjust the code to use the new empty templates you created. That would be here. |
I don't think there is any need to adjust the code, because the old templates are moved to |
Let's discuss it here.
Issue #22
write_xml()
write_pdf
because some fields are conflicting. Example I have replace date data with '0' but white printing it cannot convert it to date format.