Problem importing XML file

michaelpl

秀才
Hi everyone

I have spent days editing my flashcards on the computer in XML format, but when I tried to import them back into PLECO the import is failing after just a few entries. I can't see anything wrong with the structure of the XML file (which I edited using NotePad++)

Wonder if anyone has a tool to quickly check what is wrong, of if anyone has experience of how to identify errors on importing an XML file?
 

Attachments

  • flash-test.xml.txt
    33.2 KB · Views: 245

michaelpl

秀才
actually the file above is just a small section of the total import, but even that was failing.
attached is the entire file
 

Attachments

  • flash-NEW.xml.txt
    514.2 KB · Views: 258

mikelove

皇帝
Staff member
Very sorry for the hassle.

Looks like the XML structure is wrong; the first error I see - and probably the source of it failing after a few entries - is that before 孩子 you have two <card language="chinese"> tags. But there might be others as well.

Just in general it's probably better to edit XML files in a dedicated XML editor app (one which will show you the structure of the file in a list/tree view) rather than a text editor, since they'll help you avoid problems like this. Not sure whether you're on Mac or Windows but if you do an internet search for 'free XML editor' you should see lots of options.
 

michaelpl

秀才
sorry for very late reply.. i was using an XML editor called NotePad++
I fixed the error you spotted but there must have been many more as I never could get it to work. I am now working on a much smaller dictionary which is therefore easier to manage. But whichever XML editor I use, I find that in order to add the special Pleco codes for line breaks, italics, etc (e.g. &#xEAB1;) you have to do it in a non-hierarchical viewing pane, so it ends up as one massive block of text.. easy to make mistakes. Am I doing something wrong here? I'm on Windows by the way.

A related question.. How to add colours to text? I saw the posts on this forum, but something is wrong with the syntax as it throws an error.
per the example in this forum...
&#xEAB1; 800F 8F00 here is the text I want to be green&#xEAB2;

There are 2 problems with this.. firstly the colour code 800F 8F00 simply prints as text and therefore does not make the "here is the text I want to be green" become green! Secondly, the instruction to use &#xEAB2;as the end causes all of the subsequent text to be bold, because &#xEAB2;is also the special character to start bold type.
 

mikelove

皇帝
Staff member
No, honestly our XML format wasn't really designed for anybody to edit - it was mostly a way for us to let people export their cards while keeping scores etc intact. If you want to create a bunch of new complicated custom cards you'd be much better off using a regular text file.

Colors: the 800F/8F00 should also be Unicode. And it's EAC1/EAC2 for color changes, not B1/B2. But also those only work on iOS, as Android uses a different system with 4 character suffixes instead of 2 - you'd do EAC1 and then 4 characters (doesn't matter what, actually) for which the lowest 8 bits are 8 bit chunks of your 32-bit color code.

(again, none of this was ever designed for users to have to edit, it's just stuff we use internally)
 

michaelpl

秀才
thanks. i got this working.. sort-of. but I have no idea how to calculate "the lowest 8 bits are 8 bit chunks of your 32-bit colour code“.
I input the colour code like this.. but whatever I change the numbers to, it always renders it in pleco as a browny-grey colour...

&#xEAC1;&#x400C;to ask where something is &#xEAC2;

Do you have a chart of the colour values? I am basically looking for a regular green colour.. not too light or too dark.
 

mikelove

皇帝
Staff member
Color codes are A(lpha)RGB, so you basically want FF00FF00 for green. Can pick a lower hex value for that second set of FF's to have something less bright.
 

mikelove

皇帝
Staff member
Sorry, no, I mean 4 code points - those &#x things. So:

&#xEAC1;&#x40FF;&#x4000;&#x40FF;&#x4000;this is green text&#xEAC2;
 

michaelpl

秀才
thanks, that works!
last trouble to you.. is there a chart of hex colors you can point me to and a formula how to convert them to that code?
basically i need a darker green and probably other colors in the future
 

michaelpl

秀才
Oh. i just figured it out...

1) look up hex value of RGB colors online. So i want 009933 which is a darker green

2) The structure of your code is actually...
&#xEAC1;&#x40**;&#x40**;&#x43**;&#x40**;

3) So modified and taking the 4 lowest digits of the hex code it becomes...
&#xEAC1;&#x4099;&#x4033;&#x4099;&#x4033;

correct? It seems to work anyway, as I have now got a darker green!
 
Top