fix perl
[platform/upstream/libxml2.git] / packaging / fix-perl.diff
1 commit 77b77b1301e052d90e6a0967534a698506afcd86
2 Author: Daniel Veillard <veillard@redhat.com>
3 Date:   Thu Jan 26 19:11:02 2012 +0800
4
5     Fix SAX2 builder in case of undefined element namespaces
6     
7     Work as in XML-1.0 before namespaces, and use prefix:localname
8     as the new element name (and no namespace of course)
9     Also fix 3 cases in the regression tests where the prefix: was
10     erroneously dropped in such case
11
12 Index: SAX2.c
13 ===================================================================
14 --- SAX2.c.orig
15 +++ SAX2.c
16 @@ -2162,7 +2162,6 @@ xmlSAX2StartElementNs(void *ctx,
17      xmlNodePtr parent;
18      xmlNsPtr last = NULL, ns;
19      const xmlChar *uri, *pref;
20 -    xmlChar *lname = NULL;
21      int i, j;
22  
23      if (ctx == NULL) return;
24 @@ -2182,20 +2181,6 @@ xmlSAX2StartElementNs(void *ctx,
25      }
26  
27      /*
28 -     * Take care of the rare case of an undefined namespace prefix
29 -     */
30 -    if ((prefix != NULL) && (URI == NULL)) {
31 -        if (ctxt->dictNames) {
32 -           const xmlChar *fullname;
33 -
34 -           fullname = xmlDictQLookup(ctxt->dict, prefix, localname);
35 -           if (fullname != NULL)
36 -               localname = fullname;
37 -       } else {
38 -           lname = xmlBuildQName(localname, prefix, NULL, 0);
39 -       }
40 -    }
41 -    /*
42       * allocate the node
43       */
44      if (ctxt->freeElems != NULL) {
45 @@ -2208,10 +2193,7 @@ xmlSAX2StartElementNs(void *ctx,
46         if (ctxt->dictNames)
47             ret->name = localname;
48         else {
49 -           if (lname == NULL)
50 -               ret->name = xmlStrdup(localname);
51 -           else
52 -               ret->name = lname;
53 +           ret->name = xmlStrdup(localname);
54             if (ret->name == NULL) {
55                 xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs");
56                 return;
57 @@ -2223,11 +2205,8 @@ xmlSAX2StartElementNs(void *ctx,
58         if (ctxt->dictNames)
59             ret = xmlNewDocNodeEatName(ctxt->myDoc, NULL, 
60                                        (xmlChar *) localname, NULL);
61 -       else if (lname == NULL)
62 -           ret = xmlNewDocNode(ctxt->myDoc, NULL, localname, NULL);
63         else
64 -           ret = xmlNewDocNodeEatName(ctxt->myDoc, NULL, 
65 -                                      (xmlChar *) lname, NULL);
66 +           ret = xmlNewDocNode(ctxt->myDoc, NULL, localname, NULL);
67         if (ret == NULL) {
68             xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs");
69             return;
70 @@ -2334,33 +2313,8 @@ xmlSAX2StartElementNs(void *ctx,
71       */
72      if (nb_attributes > 0) {
73          for (j = 0,i = 0;i < nb_attributes;i++,j+=5) {
74 -           /*
75 -            * Handle the rare case of an undefined atribute prefix
76 -            */
77 -           if ((attributes[j+1] != NULL) && (attributes[j+2] == NULL)) {
78 -               if (ctxt->dictNames) {
79 -                   const xmlChar *fullname;
80 -
81 -                   fullname = xmlDictQLookup(ctxt->dict, attributes[j+1],
82 -                                             attributes[j]);
83 -                   if (fullname != NULL) {
84 -                       xmlSAX2AttributeNs(ctxt, fullname, NULL,
85 -                                          attributes[j+3], attributes[j+4]);
86 -                       continue;
87 -                   }
88 -               } else {
89 -                   lname = xmlBuildQName(attributes[j], attributes[j+1],
90 -                                         NULL, 0);
91 -                   if (lname != NULL) {
92 -                       xmlSAX2AttributeNs(ctxt, lname, NULL,
93 -                                          attributes[j+3], attributes[j+4]);
94 -                       xmlFree(lname);
95 -                       continue;
96 -                   }
97 -               }
98 -           }
99             xmlSAX2AttributeNs(ctxt, attributes[j], attributes[j+1],
100 -                              attributes[j+3], attributes[j+4]);
101 +                              attributes[j+3], attributes[j+4]);
102         }
103      }
104  
105 Index: result/namespaces/err_7.xml
106 ===================================================================
107 --- result/namespaces/err_7.xml.orig
108 +++ result/namespaces/err_7.xml
109 @@ -1,2 +1,2 @@
110  <?xml version="1.0"?>
111 -<f:foo/>
112 +<foo/>
113 Index: result/xmlid/id_tst2.xml
114 ===================================================================
115 --- result/xmlid/id_tst2.xml.orig
116 +++ result/xmlid/id_tst2.xml
117 @@ -1,6 +1,6 @@
118  Object is a Node Set :
119  Set contains 1 nodes:
120 -1  ELEMENT n:foo
121 +1  ELEMENT foo
122      ATTRIBUTE id
123        TEXT
124          content=bar
125 Index: result/xmlid/id_tst3.xml
126 ===================================================================
127 --- result/xmlid/id_tst3.xml.orig
128 +++ result/xmlid/id_tst3.xml
129 @@ -1,6 +1,6 @@
130  Object is a Node Set :
131  Set contains 1 nodes:
132 -1  ELEMENT f:o:o
133 +1  ELEMENT o:o
134      ATTRIBUTE id
135        TEXT
136          content=bar