+
+void tst()
+{
+ YAZ_CHECK_EQ(pqf2xml_text("@attr 1=4 bad query", ""), PQF_FAILED);
+#if HAVE_XML2
+ YAZ_CHECK_EQ(pqf2xml_text(
+ "@attr 1=4 computer",
+ "<?xml version=\"1.0\"?>\n"
+ "<query set=\"Bib-1\" type=\"rpn\">"
+ "<apt><attr type=\"1\" value=\"4\"/>"
+ "<term type=\"general\">computer</term></apt>"
+ "</query>\n"), XML_MATCH);
+
+ YAZ_CHECK_EQ(pqf2xml_text(
+ "@attr 2=1 @attr 1=title computer",
+ "<?xml version=\"1.0\"?>\n"
+ "<query set=\"Bib-1\" type=\"rpn\">"
+ "<apt><attr type=\"1\" value=\"title\"/>"
+ "<attr type=\"2\" value=\"1\"/>"
+ "<term type=\"general\">computer</term></apt>"
+ "</query>\n"), XML_MATCH);
+
+ YAZ_CHECK_EQ(pqf2xml_text(
+ "@attr 2=1 @attr exp1 1=1 computer",
+ "<?xml version=\"1.0\"?>\n"
+ "<query set=\"Bib-1\" type=\"rpn\">"
+ "<apt><attr set=\"Exp-1\" type=\"1\" value=\"1\"/>"
+ "<attr type=\"2\" value=\"1\"/>"
+ "<term type=\"general\">computer</term></apt>"
+ "</query>\n"), XML_MATCH);
+
+ YAZ_CHECK_EQ(pqf2xml_text(
+ "@and a b",
+ "<?xml version=\"1.0\"?>\n"
+ "<query set=\"Bib-1\" type=\"rpn\">"
+ "<binary type=\"and\">"
+ "<apt><term type=\"general\">a</term></apt>"
+ "<apt><term type=\"general\">b</term></apt>"
+ "</binary></query>\n"), XML_MATCH);
+
+ YAZ_CHECK_EQ(pqf2xml_text(
+ "@or @and a b c",
+ "<?xml version=\"1.0\"?>\n"
+ "<query set=\"Bib-1\" type=\"rpn\">"
+ "<binary type=\"or\">"
+ "<binary type=\"and\">"
+ "<apt><term type=\"general\">a</term></apt>"
+ "<apt><term type=\"general\">b</term></apt></binary>"
+ "<apt><term type=\"general\">c</term></apt>"
+ "</binary></query>\n"), XML_MATCH);
+
+ YAZ_CHECK_EQ(pqf2xml_text(
+ "@set abe",
+ "<?xml version=\"1.0\"?>\n"
+ "<query set=\"Bib-1\" type=\"rpn\">"
+ "<rset>abe</rset></query>\n"), XML_MATCH);
+
+ YAZ_CHECK_EQ(pqf2xml_text(
+ /* exclusion, distance, ordered, relationtype,
+ knownunit, proxunit */
+ "@prox 0 3 1 2 k 2 a b",
+ "<?xml version=\"1.0\"?>\n"
+ "<query set=\"Bib-1\" type=\"rpn\">"
+ "<binary type=\"prox\" exclusion=\"false\" "
+ "distance=\"3\" "
+ "ordered=\"true\" "
+ "relationType=\"2\" "
+ "knownProximityUnit=\"2\">"
+ "<apt><term type=\"general\">a</term></apt>"
+ "<apt><term type=\"general\">b</term></apt>"
+ "</binary></query>\n"), XML_MATCH);
+
+ YAZ_CHECK_EQ(pqf2xml_text(
+ "@term numeric 32",
+ "<?xml version=\"1.0\"?>\n"
+ "<query set=\"Bib-1\" type=\"rpn\">"
+ "<apt>"
+ "<term type=\"numeric\">32</term></apt>"
+ "</query>\n"), XML_MATCH);
+
+ YAZ_CHECK_EQ(pqf2xml_text(
+ "@term string computer",
+ "<?xml version=\"1.0\"?>\n"
+ "<query set=\"Bib-1\" type=\"rpn\">"
+ "<apt>"
+ "<term type=\"string\">computer</term></apt>"
+ "</query>\n"), XML_MATCH);
+
+ YAZ_CHECK_EQ(pqf2xml_text(
+ "@term null void",
+ "<?xml version=\"1.0\"?>\n"
+ "<query set=\"Bib-1\" type=\"rpn\">"
+ "<apt>"
+ "<term type=\"null\"/></apt>"
+ "</query>\n"), XML_MATCH);
+