Le 01/03/2011 22:42, Paul Rouse a écrit :
Hello

I have been using Gregorio recently and came across some problems
with the XML reading and writing.  There were several cases where
writing XML and reading it back in again produced a different
result than going direct from GABC to the output format.

One way on Linux to show what I was seeing is this:

     gregorio -F xml -o completetest.xml completetest.gabc
     gregorio -f xml -F xml -o junk.xml completetest.xml
     xmllint --format completetest.xml>  completetest.pxml
     xmllint --format junk.xml>  junk.pxml
     diff completetest.pxml junk.pxml

I attach a set of patches which fix almost all of the problems.
There is still an issue with escaping backslash in<verbatim>
elements, but I don't know enough about the way it is supposed
to work to able to fix that one!

I hope this is useful -- please check that you agree with the
way I have done these changes!

Hello,

I'm not maintaining gregorio anymore, but the maintenance and development are still ongoing on [email protected] (CCed).

Anyway, thank you very much for your patches, I must say that I didn't test xml enough to fix everythin, as I've never used it; so this patch is extremely useful!

Thank you very much,
--
Elie
Index: plugins/xml/xml-utils.c
===================================================================
--- plugins/xml/xml-utils.c     (revision 1100)
+++ plugins/xml/xml-utils.c     (working copy)
@@ -89,7 +89,7 @@
       str = "<right>auctum</right>";
       break;
     case _AUCTUM_DUPLEX:
-      str = "<right>auctum_duplex</right>";
+      str = "<right>auctum-duplex</right>";
       break;
     case _V_EPISEMUS:
       str = "<bottom>v_episemus</bottom>";
Index: plugins/xml/xml-write.c
===================================================================
--- plugins/xml/xml-write.c     (revision 1100)
+++ plugins/xml/xml-write.c     (working copy)
@@ -391,9 +391,9 @@
       fprintf (f, "</str>");
       in_text = 0;
     }
-  fprintf (f, "<special-char>");
+  fprintf (f, "<special-character>");
   xml_print_unistring(f, first_char);
-  fprintf (f, "</special-char>");
+  fprintf (f, "</special-character>");
 }
 
 void
Index: plugins/xml/xml-read.c
===================================================================
--- plugins/xml/xml-read.c      (revision 1100)
+++ plugins/xml/xml-read.c      (working copy)
@@ -443,6 +443,7 @@
                          char *signs)
 {
   xmlNodePtr current_children_node;
+  *signs = _NO_SIGN;                /* In case there is no <signs> child */
   while (current_node)
     {
       if (!xmlStrcmp (current_node->name, (const xmlChar *) "type"))
@@ -482,6 +483,14 @@
            }
          if (!xmlStrcmp
              (xmlNodeListGetString (doc, current_children_node, 1),
+              (const xmlChar *) "divisio-finalis"))
+           {
+             *type = B_DIVISIO_FINALIS;
+             current_node = current_node->next;
+             continue;
+           }
+         if (!xmlStrcmp
+             (xmlNodeListGetString (doc, current_children_node, 1),
               (const xmlChar *) "dominican-bar-1"))
            {
              *type = B_DIVISIO_MINOR_D1;
@@ -524,7 +533,7 @@
              (xmlNodeListGetString (doc, current_children_node, 6),
               (const xmlChar *) "dominican-bar-6"))
            {
-             *type = B_DIVISIO_MINOR_D1;
+             *type = B_DIVISIO_MINOR_D6;
              current_node = current_node->next;
              continue;
            }
@@ -922,8 +931,9 @@
          (current_node->name, (const xmlChar *) "special-character"))
        {
          gregorio_begin_style (current_character, ST_SPECIAL_CHAR);
-         xml_read_styled_text (current_node->xmlChildrenNode,
-                                           doc, current_character);
+         gregorio_add_text ((char *) xmlNodeListGetString
+                            (doc, current_node->xmlChildrenNode, 1),
+                            current_character);
          gregorio_end_style (current_character, ST_SPECIAL_CHAR);
          current_node = current_node->next;
          continue;
@@ -931,8 +941,9 @@
       if (!xmlStrcmp (current_node->name, (const xmlChar *) "verbatim"))
        {
          gregorio_begin_style (current_character, ST_VERBATIM);
-         xml_read_styled_text (current_node->xmlChildrenNode,
-                                           doc, current_character);
+         gregorio_add_text ((char *) xmlNodeListGetString
+                            (doc, current_node->xmlChildrenNode, 1),
+                            current_character);
          gregorio_end_style (current_character, ST_VERBATIM);
          current_node = current_node->next;
          continue;
@@ -1170,7 +1181,7 @@
          step =
            xml_read_alteration (current_node->xmlChildrenNode,
                                             doc, key);
-         gregorio_add_special_as_glyph (&current_glyph, GRE_NATURAL,
+         gregorio_add_special_as_glyph (&current_glyph, GRE_SHARP,
                                         step, 0, NULL);
          current_node = current_node->next;
          continue;
Index: include/gregorio/struct.h
===================================================================
--- include/gregorio/struct.h   (revision 1100)
+++ include/gregorio/struct.h   (working copy)
@@ -462,7 +462,7 @@
 
 #define max(a, b) (a > b ? a : b)
 
-#define is_alteration(type) type==GRE_FLAT||type==GRE_NATURAL
+#define is_alteration(type) type==GRE_FLAT||type==GRE_NATURAL||GRE_SHARP
 
 #define MAX_TEXT_LENGTH 200
 
_______________________________________________
Gregorio-devel mailing list
[email protected]
https://mail.gna.org/listinfo/gregorio-devel

Répondre à