It is currently Thu Mar 28, 2024 11:21 am

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: XML export
PostPosted: Wed May 11, 2022 10:07 pm 
Offline

Joined: Sat Jul 30, 2011 8:33 pm
Posts: 757
Hi,

Have you made some other changes to the XML export function? There seems to be some strange behaviour in the 'Location' field...

Most files work fine, they have :

<Location>\\SERVER\Folder\Filename</Location>

as you would expect, but it looks like some are picking up a bit of code instead :

<Location><![CDATA[\\SERVER\Folder\Filename]></Location>

At first glance it looks like it happens when there is an apostrophe ' in the filename, but there might be other instances as well.

(I import the XML into Excel and have some code parse it into a list there, and it was crashing because Excel imports those fields as blanks - it also seems that Predicted_Rating has turned into Predicted but that's not a big problem :D)

Thanks,


Top
 Profile  
 
 Post subject: Re: XML export
PostPosted: Wed May 11, 2022 10:20 pm 
Offline
User avatar

Joined: Tue Sep 27, 2005 2:28 am
Posts: 7631
Nope, I haven't made changes. Those CDATA were there before and they are needed to escape characters that could be confused with XML markups.

https://stackoverflow.com/questions/2784183/what-does-cdata-in-xml-mean

https://www.educba.com/xml-cdata/

I'm surprised that Excel crashes, but unfortunately I can't test because I don't have it on my computer.

Maybe my use of CDATA isn't 100% correct. Can you make the test with an XML file that contains some escaped characters but that imports fine into Excel, and see how it's using a different syntax from mine?


Top
 Profile  
 
 Post subject: Re: XML export
PostPosted: Wed May 11, 2022 10:28 pm 
Offline
User avatar

Joined: Tue Sep 27, 2005 2:28 am
Posts: 7631
I think I know why Excel crashes...

You have

<Location><![CDATA[\\SERVER\Folder\Filename]></Location>

when you should have

<Location><![CDATA[\\SERVER\Folder\Filename]]></Location>

I will look at my code, it's probably a bug on my part that has never been detected before.

Now it's bedtime for me, see you tomorrow!


Top
 Profile  
 
 Post subject: Re: XML export
PostPosted: Wed May 11, 2022 10:30 pm 
Offline
User avatar

Joined: Tue Sep 27, 2005 2:28 am
Posts: 7631
Are you sure you have <Location><![CDATA[\\SERVER\Folder\Filename]></Location>

My code seems correct as it includes the ]] at the end...


Top
 Profile  
 
 Post subject: Re: XML export
PostPosted: Wed May 11, 2022 11:02 pm 
Offline

Joined: Sat Jul 30, 2011 8:33 pm
Posts: 757
sleep well :D

sorry - that was a copy/paste error on my part, it does have the ]] at the end.

it looks like the XML import is working fine - the data seems to be translated into 'correct' data without the 'CDATA' codeword. It is my code that errors out - it is expecting to find Location data in a particular row but instead finds a blank cell - and Left(String, Num) throws an error when String is empty...

Something has changed, because it worked before; I will have a deeper dive into it tomorrow, and see if I can figure out what is happening. It's quite likely it's just some kludge in my code that no longer functions properly...it's in the code related to 'expanding' the non-IMDB files that i store as episodes of some movie file with a particular tag, into the individual movie files for my list...


Top
 Profile  
 
 Post subject: Re: XML export
PostPosted: Thu May 12, 2022 10:58 pm 
Offline

Joined: Sat Jul 30, 2011 8:33 pm
Posts: 757
OK; so the problem appears to be that previously, when the XML was imported into Excel, each element for an item was on the same row (so,header, title, orignal title, predicted_rating etc.), were on the same row in excel (basically making a table).

However now, instead each of those elements appears on it's own row (so title is on row 2 on it's own, original title on row 3 on it's own, etc., with only the 'header' field appearing on each row in the first column.

I don't know if it's Excel or the app that's the issue - is there an old version of the program accessible anywhere? I could try the XML output from a version that's a couple of months old, and that would tell me if Excel has changed or Coollector...

If not I could work around it in my code, or perhaps my googling around XML and excel will produce an answer :D

Thanks,


Top
 Profile  
 
 Post subject: Re: XML export
PostPosted: Thu May 12, 2022 11:31 pm 
Offline

Joined: Sat Jul 30, 2011 8:33 pm
Posts: 757
Ok, after a bit more experimenting with smaller lists, it seems the problem only arises when one of the films in the XML list is unrated.

For rated films, the XML element is e.g <Rated>excellent</Rated>
But for unrated films, instead it is <Watched>false</Watched>

with a bit more experimenting, if I take a list with one <Watched></Watched> element and all the rest <Rated></Rated>, the whole file imports incorrectly - but if I edit the XML so that one tag becomes <Rated></Rated> instead - it works fine.

And it also works if I replace 'Rated' with 'Watched' for all the other items. So it looks like the problem is because the elements are different between items.

If that's the intended behaviour of course, then I can work around it :D

(edit to add a small addendum - if I do a find and replace in the XML of the full list of movies to replace Rated> with Watched> - everything works perfectly.)

Thanks,


Last edited by Orclev on Thu May 12, 2022 11:40 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: XML export
PostPosted: Thu May 12, 2022 11:39 pm 
Offline
User avatar

Joined: Tue Sep 27, 2005 2:28 am
Posts: 7631
Orclev wrote:
So it looks like the problem is because the elements are different between items.

Makes sense. I'll make the change with the new version, normally this week-end.


Top
 Profile  
 
 Post subject: Re: XML export
PostPosted: Thu May 12, 2022 11:41 pm 
Offline

Joined: Sat Jul 30, 2011 8:33 pm
Posts: 757
that's excellent, thanks (especially since I may be the only person actually doing this :D)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 24 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  


Powered by phpBB © 2024 phpBB Group