Griffith - media collection manager
May 21, 2012, 07:40:07 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Please check ask.griffith.cc and wiki.griffith.cc before asking questions.
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: .toprettyxml() to be avoided?  (Read 588 times)
CinéphOli
Jr. Member
**
Offline Offline

Posts: 87



View Profile
« on: August 10, 2011, 10:02:40 PM »

Hello,

While working on the module PluginExportGCstar.py, I noticed that the method (I hope it is the right word, my OOP vocabulary is rather weak…) .toprettyxml() used in <griffith>/lib/plugins/export/__init.py__ does NOT produce correct XML.

It adds extra carriage returns, tabs and/or whitespaces to the text nodes, which is simply wrong/illegal. Such whitespaces count in XML text nodes, they are not neutral (there are discussions about this on the internet). And because of that, the data imported into GCstar are misaligned, at least in some fields (actors, summary, …). I suppose this is true for the other export modules as well, but I didn't have a look at them yet.

On the contrary, the method .toxml() produces correct XML, and IMO should be privileged. I know that the one line output is hardly human readable, but at least it is correct and can easily be correctly beautified with a utility like xmllint:

Code:
xmllint --format input.xml > output.xml

Just my 2 (euro)cents.

PS: should I rather post this on the developers' list? I subscribed recently.
Logged

Using Griffith v0.13 r1621 on Linux Ubuntu
Griffith SQL for Dummies
mike
Global Moderator
Hero Member
*****
Offline Offline

Posts: 996


View Profile WWW
« Reply #1 on: August 13, 2011, 06:58:28 PM »

First, yes you are right. .toxml() is the better choice. I took .toprettyxml() in the past for debugging and comparing reasons. But in production you only need .toxml().

And yes the mailing list is a good place for such things. Smiley
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2006-2007, Simple Machines Valid XHTML 1.0! Valid CSS!