Change config; use name attribute wherewhere
authorAdam Dickmeiss <adam@indexdata.dk>
Wed, 18 Jun 2014 08:56:16 +0000 (10:56 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Wed, 18 Jun 2014 08:56:16 +0000 (10:56 +0200)
instead of value attribute. name+value is only used for
variable element.

src/config.xml
src/metaproxy_filter_xquery.cpp

index 70a2a02..2ed6842 100644 (file)
          <category access="false" line="true" apdu="false" />
       </filter>
       <filter type="xquery">
-       <script value="/home/adam/proj/marc2bibframe/xbin/zorba3-0.xqy"/>
-       <record value="marcxmluri"/>
-       <setVariable name="serialization" value="rdxml"/>
-       <setVariable name="baseuri" value="http://base/"/>
+       <script name="/home/adam/proj/marc2bibframe/xbin/zorba3-0.xqy"/>
+       <record name="marcxmluri"/>
+       <variable name="serialization" value="rdxml"/>
+       <variable name="baseuri" value="http://base/"/>
       </filter>
       <filter type="record_transform">
        <retrievalinfo  xmlns="http://indexdata.com/yaz" version="1.0">
index b74885d..466164c 100644 (file)
@@ -319,7 +319,7 @@ void yf::XQuery::configure(const xmlNode * ptr, bool test_only,
     {
         if (ptr->type != XML_ELEMENT_NODE)
             continue;
-        if (!strcmp((const char *) ptr->name, "setVariable"))
+        if (!strcmp((const char *) ptr->name, "variable"))
         {
             std::string name;
             std::string value;
@@ -338,29 +338,29 @@ void yf::XQuery::configure(const xmlNode * ptr, bool test_only,
         }
         else if (!strcmp((const char *) ptr->name, "script"))
         {
-            std::string value;
+            std::string name;
             struct _xmlAttr *attr;
             for (attr = ptr->properties; attr; attr = attr->next)
-                if (!strcmp((const char *) attr->name, "value"))
-                    value = mp::xml::get_text(attr->children);
+                if (!strcmp((const char *) attr->name, "name"))
+                    name = mp::xml::get_text(attr->children);
                 else
                     throw mp::filter::FilterException(
                         "Bad attribute " + std::string((const char *)
                                                        attr->name));
-            zorba_script = value;
+            zorba_script = name;
         }
         else if (!strcmp((const char *) ptr->name, "record"))
         {
-            std::string value;
+            std::string name;
             struct _xmlAttr *attr;
             for (attr = ptr->properties; attr; attr = attr->next)
-                if (!strcmp((const char *) attr->name, "value"))
-                    value = mp::xml::get_text(attr->children);
+                if (!strcmp((const char *) attr->name, "name"))
+                    name = mp::xml::get_text(attr->children);
                 else
                     throw mp::filter::FilterException(
                         "Bad attribute " + std::string((const char *)
                                                        attr->name));
-            zorba_record_variable = value;
+            zorba_record_variable = name;
         }
         else
         {