Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

How to solve unclosed literal string error in XML documents

Posted on by 25

Greetings again.

Found myself with another sticky issue.

In our Testing environment we ran several invoicing tests, however, if I move from one invoice to another in the electronic invoice journal I get the following error:

"There is an unclosed literal string. Line 1, position 961."

Literal-Strings.jpg

I researched extensively that error, and came to understand that it refers to a string literal which has not been closed in the XML document. Hence, I opened an invoice XML sample and began to manually observe both the contents and structure within the file to seek for any of the following:

  1. Missing double quotes at the end of each string literal

  2. Multiline strings that are not concatenated properly

  3. Or, unescaped double quotes inside each string literal

So far I was not able to identify any missing double quotes, improperly concatenated strings, and/or unescaped double quotes in the XML document.

The error indicates where the possible, faulty literal string is located, but I need to know how to interpret it. 

Or, providing other solutions to that problem.

Please, your help would be mostly appreciated.

  • Suggested answer
    GuidoMTY Profile Picture
    GuidoMTY 25 on at
    RE: How to solve unclosed literal string error in XML documents

    Found a solution.

    I identified the response that receives the XML document, and then look into its extended datatype.

    The EDT corresponded to EInvoiceCFDIResponse_MX and looked into its properties.

    Found that StringSize's original value for the EDT was 960, so I modified its StringSize property to Memo value in order to increase the response so that the error will not show up again.

    EDT_5F00_properties.jpg

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,198 Most Valuable Professional on at
    RE: How to solve unclosed literal string error in XML documents

    The error message says that the problem was noticed at position 961, therefore look at what you have as the 961st character and at the preceding characters.

    Also note that XML editors with syntax highlighting (such as Visual Studio) can show you syntax errors.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans