Heya Barbie-qu,
Usually, pretty much in all cases, it was oddly formatted metadata from files, or the file names/paths themselves... so the hard part is finding the offensive files first, then fix whatever makes the target host crash when consuming the xml...
If you are really interested in solving this for your library & use-case, here's 2 approaches, 1 requiring a bit of leg work, the other knowing your way around xmls & formatting standards:
RouteA:
Take the whole xml with all of the 18k files that causes problems, and start dissecting it. i.e. with Notepad++, duplicate it, name it partA & partB, and remove the last 9k track entries from A, and the first 9k from B, and run them each. IF you only have 1 offensive file, you now have 1 functioning, and one crashing xml. Now split the crashing xml one further down into parts, until you can pinpoint the crash to separate files.
Fix the files (i.e. remove filename & path oddities, as well as metadata - brute force: flush/remove all metadata...).
Alternatively, RouteB, requiring a bit of formatting/coding knowledge - find tools that you're comfortable with that let you find UTF-8 encoding violations in xmls.
Fix the files you find.
After both you should have a functioning xml with 18k tracks... and you have learnt what breaks Denon Prime xml imports specifically
Hope this helps.
c.