Re: BUG #3734: Invalid XML schema output. - Mailing list pgsql-bugs
From | Euler Taveira de Oliveira |
---|---|
Subject | Re: BUG #3734: Invalid XML schema output. |
Date | |
Msg-id | 47465803.9050606@timbira.com Whole thread Raw |
In response to | Re: BUG #3734: Invalid XML schema output. (Bruce Momjian <bruce@momjian.us>) |
Responses |
Re: BUG #3734: Invalid XML schema output.
Re: BUG #3734: Invalid XML schema output. |
List | pgsql-bugs |
Bruce Momjian wrote: >> Agreed. Feel free to add whitespace before every /> of simple xml elements. > > Uh, was this done? > Nope. Attached is a patch that does it. I'm attaching another cosmetic patch that replaces the use of some single quotes with double quotes in the XML attributes output. -- Euler Taveira de Oliveira http://www.timbira.com/ *** ./src/backend/utils/adt/xml.c.orig 2007-11-23 01:55:00.000000000 -0200 --- ./src/backend/utils/adt/xml.c 2007-11-23 02:01:24.000000000 -0200 *************** *** 2641,2658 **** appendStringInfo(&result, "<xsd:complexType name=\"%s\">\n" " <xsd:sequence>\n" ! " <xsd:element name=\"row\" type=\"%s\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n" " </xsd:sequence>\n" "</xsd:complexType>\n\n", tabletypename, rowtypename); appendStringInfo(&result, ! "<xsd:element name=\"%s\" type=\"%s\"/>\n\n", xmltn, tabletypename); } else appendStringInfo(&result, ! "<xsd:element name=\"%s\" type=\"%s\"/>\n\n", xmltn, rowtypename); xsd_schema_element_end(&result); --- 2641,2658 ---- appendStringInfo(&result, "<xsd:complexType name=\"%s\">\n" " <xsd:sequence>\n" ! " <xsd:element name=\"row\" type=\"%s\" minOccurs=\"0\" maxOccurs=\"unbounded\" />\n" " </xsd:sequence>\n" "</xsd:complexType>\n\n", tabletypename, rowtypename); appendStringInfo(&result, ! "<xsd:element name=\"%s\" type=\"%s\" />\n\n", xmltn, tabletypename); } else appendStringInfo(&result, ! "<xsd:element name=\"%s\" type=\"%s\" />\n\n", xmltn, rowtypename); xsd_schema_element_end(&result); *************** *** 2709,2719 **** if (!tableforest) appendStringInfo(&result, ! " <xsd:element name=\"%s\" type=\"%s\"/>\n", xmltn, tabletypename); else appendStringInfo(&result, ! " <xsd:element name=\"%s\" type=\"%s\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n", xmltn, tabletypename); } --- 2709,2719 ---- if (!tableforest) appendStringInfo(&result, ! " <xsd:element name=\"%s\" type=\"%s\" />\n", xmltn, tabletypename); else appendStringInfo(&result, ! " <xsd:element name=\"%s\" type=\"%s\" minOccurs=\"0\" maxOccurs=\"unbounded\" />\n", xmltn, tabletypename); } *************** *** 2727,2733 **** "</xsd:complexType>\n\n"); appendStringInfo(&result, ! "<xsd:element name=\"%s\" type=\"%s\"/>\n\n", xmlsn, schematypename); return result.data; --- 2727,2733 ---- "</xsd:complexType>\n\n"); appendStringInfo(&result, ! "<xsd:element name=\"%s\" type=\"%s\" />\n\n", xmlsn, schematypename); return result.data; *************** *** 2775,2781 **** NULL); appendStringInfo(&result, ! " <xsd:element name=\"%s\" type=\"%s\"/>\n", xmlsn, schematypename); } --- 2775,2781 ---- NULL); appendStringInfo(&result, ! " <xsd:element name=\"%s\" type=\"%s\" />\n", xmlsn, schematypename); } *************** *** 2785,2791 **** "</xsd:complexType>\n\n"); appendStringInfo(&result, ! "<xsd:element name=\"%s\" type=\"%s\"/>\n\n", xmlcn, catalogtypename); return result.data; --- 2785,2791 ---- "</xsd:complexType>\n\n"); appendStringInfo(&result, ! "<xsd:element name=\"%s\" type=\"%s\" />\n\n", xmlcn, catalogtypename); return result.data; *************** *** 2969,2975 **** appendStringInfo(&result, "<xsd:complexType mixed=\"true\">\n" " <xsd:sequence>\n" ! " <xsd:any name=\"element\" minOccurs=\"0\" maxOccurs=\"unbounded\" processContents=\"skip\"/>\n" " </xsd:sequence>\n" "</xsd:complexType>\n"); } --- 2969,2975 ---- appendStringInfo(&result, "<xsd:complexType mixed=\"true\">\n" " <xsd:sequence>\n" ! " <xsd:any name=\"element\" minOccurs=\"0\" maxOccurs=\"unbounded\" processContents=\"skip\"/>\n" " </xsd:sequence>\n" "</xsd:complexType>\n"); } *************** *** 2986,2992 **** if (typmod != -1) appendStringInfo(&result, " <xsd:restriction base=\"xsd:string\">\n" ! " <xsd:maxLength value=\"%d\"/>\n" " </xsd:restriction>\n", typmod - VARHDRSZ); break; --- 2986,2992 ---- if (typmod != -1) appendStringInfo(&result, " <xsd:restriction base=\"xsd:string\">\n" ! " <xsd:maxLength value=\"%d\" />\n" " </xsd:restriction>\n", typmod - VARHDRSZ); break; *************** *** 3001,3008 **** if (typmod != -1) appendStringInfo(&result, " <xsd:restriction base=\"xsd:decimal\">\n" ! " <xsd:totalDigits value=\"%d\"/>\n" ! " <xsd:fractionDigits value=\"%d\"/>\n" " </xsd:restriction>\n", ((typmod - VARHDRSZ) >> 16) & 0xffff, (typmod - VARHDRSZ) & 0xffff); --- 3001,3008 ---- if (typmod != -1) appendStringInfo(&result, " <xsd:restriction base=\"xsd:decimal\">\n" ! " <xsd:totalDigits value=\"%d\" />\n" ! " <xsd:fractionDigits value=\"%d\" />\n" " </xsd:restriction>\n", ((typmod - VARHDRSZ) >> 16) & 0xffff, (typmod - VARHDRSZ) & 0xffff); *************** *** 3011,3018 **** case INT2OID: appendStringInfo(&result, " <xsd:restriction base=\"xsd:short\">\n" ! " <xsd:maxInclusive value=\"%d\"/>\n" ! " <xsd:minInclusive value=\"%d\"/>\n" " </xsd:restriction>\n", SHRT_MAX, SHRT_MIN); break; --- 3011,3018 ---- case INT2OID: appendStringInfo(&result, " <xsd:restriction base=\"xsd:short\">\n" ! " <xsd:maxInclusive value=\"%d\" />\n" ! " <xsd:minInclusive value=\"%d\" />\n" " </xsd:restriction>\n", SHRT_MAX, SHRT_MIN); break; *************** *** 3020,3027 **** case INT4OID: appendStringInfo(&result, " <xsd:restriction base='xsd:int'>\n" ! " <xsd:maxInclusive value=\"%d\"/>\n" ! " <xsd:minInclusive value=\"%d\"/>\n" " </xsd:restriction>\n", INT_MAX, INT_MIN); break; --- 3020,3027 ---- case INT4OID: appendStringInfo(&result, " <xsd:restriction base='xsd:int'>\n" ! " <xsd:maxInclusive value=\"%d\" />\n" ! " <xsd:minInclusive value=\"%d\" />\n" " </xsd:restriction>\n", INT_MAX, INT_MIN); break; *************** *** 3029,3036 **** case INT8OID: appendStringInfo(&result, " <xsd:restriction base=\"xsd:long\">\n" ! " <xsd:maxInclusive value=\"" INT64_FORMAT "\"/>\n" ! " <xsd:minInclusive value=\"" INT64_FORMAT "\"/>\n" " </xsd:restriction>\n", (((uint64) 1) << (sizeof(int64) * 8 - 1)) - 1, (((uint64) 1) << (sizeof(int64) * 8 - 1))); --- 3029,3036 ---- case INT8OID: appendStringInfo(&result, " <xsd:restriction base=\"xsd:long\">\n" ! " <xsd:maxInclusive value=\"" INT64_FORMAT "\" />\n" ! " <xsd:minInclusive value=\"" INT64_FORMAT "\" />\n" " </xsd:restriction>\n", (((uint64) 1) << (sizeof(int64) * 8 - 1)) - 1, (((uint64) 1) << (sizeof(int64) * 8 - 1))); *************** *** 3059,3075 **** if (typmod == -1) appendStringInfo(&result, " <xsd:restriction base=\"xsd:time\">\n" ! " <xsd:pattern value=\"\\p{Nd}{2}:\\p{Nd}{2}:\\p{Nd}{2}(.\\p{Nd}+)?%s\"/>\n" " </xsd:restriction>\n", tz); else if (typmod == 0) appendStringInfo(&result, " <xsd:restriction base=\"xsd:time\">\n" ! " <xsd:pattern value=\"\\p{Nd}{2}:\\p{Nd}{2}:\\p{Nd}{2}%s\"/>\n" " </xsd:restriction>\n", tz); else appendStringInfo(&result, " <xsd:restriction base=\"xsd:time\">\n" ! " <xsd:pattern value=\"\\p{Nd}{2}:\\p{Nd}{2}:\\p{Nd}{2}.\\p{Nd}{%d}%s\"/>\n" " </xsd:restriction>\n", typmod - VARHDRSZ, tz); break; } --- 3059,3075 ---- if (typmod == -1) appendStringInfo(&result, " <xsd:restriction base=\"xsd:time\">\n" ! " <xsd:pattern value=\"\\p{Nd}{2}:\\p{Nd}{2}:\\p{Nd}{2}(.\\p{Nd}+)?%s\" />\n" " </xsd:restriction>\n", tz); else if (typmod == 0) appendStringInfo(&result, " <xsd:restriction base=\"xsd:time\">\n" ! " <xsd:pattern value=\"\\p{Nd}{2}:\\p{Nd}{2}:\\p{Nd}{2}%s\" />\n" " </xsd:restriction>\n", tz); else appendStringInfo(&result, " <xsd:restriction base=\"xsd:time\">\n" ! " <xsd:pattern value=\"\\p{Nd}{2}:\\p{Nd}{2}:\\p{Nd}{2}.\\p{Nd}{%d}%s\" />\n" " </xsd:restriction>\n", typmod - VARHDRSZ, tz); break; } *************** *** 3082,3098 **** if (typmod == -1) appendStringInfo(&result, " <xsd:restriction base=\"xsd:dateTime\">\n" ! " <xsd:pattern value=\"\\p{Nd}{4}-\\p{Nd}{2}-\\p{Nd}{2}T\\p{Nd}{2}:\\p{Nd}{2}:\\p{Nd}{2}(.\\p{Nd}+)?%s\"/>\n" " </xsd:restriction>\n", tz); else if (typmod == 0) appendStringInfo(&result, " <xsd:restriction base=\"xsd:dateTime\">\n" ! " <xsd:pattern value=\"\\p{Nd}{4}-\\p{Nd}{2}-\\p{Nd}{2}T\\p{Nd}{2}:\\p{Nd}{2}:\\p{Nd}{2}%s\"/>\n" " </xsd:restriction>\n", tz); else appendStringInfo(&result, " <xsd:restriction base=\"xsd:dateTime\">\n" ! " <xsd:pattern value=\"\\p{Nd}{4}-\\p{Nd}{2}-\\p{Nd}{2}T\\p{Nd}{2}:\\p{Nd}{2}:\\p{Nd}{2}.\\p{Nd}{%d}%s\"/>\n" " </xsd:restriction>\n", typmod - VARHDRSZ, tz); break; } --- 3082,3098 ---- if (typmod == -1) appendStringInfo(&result, " <xsd:restriction base=\"xsd:dateTime\">\n" ! " <xsd:pattern value=\"\\p{Nd}{4}-\\p{Nd}{2}-\\p{Nd}{2}T\\p{Nd}{2}:\\p{Nd}{2}:\\p{Nd}{2}(.\\p{Nd}+)?%s\"/>\n" " </xsd:restriction>\n", tz); else if (typmod == 0) appendStringInfo(&result, " <xsd:restriction base=\"xsd:dateTime\">\n" ! " <xsd:pattern value=\"\\p{Nd}{4}-\\p{Nd}{2}-\\p{Nd}{2}T\\p{Nd}{2}:\\p{Nd}{2}:\\p{Nd}{2}%s\"/>\n" " </xsd:restriction>\n", tz); else appendStringInfo(&result, " <xsd:restriction base=\"xsd:dateTime\">\n" ! " <xsd:pattern value=\"\\p{Nd}{4}-\\p{Nd}{2}-\\p{Nd}{2}T\\p{Nd}{2}:\\p{Nd}{2}:\\p{Nd}{2}.\\p{Nd}{%d}%s\"/>\n" " </xsd:restriction>\n", typmod - VARHDRSZ, tz); break; } *************** *** 3100,3106 **** case DATEOID: appendStringInfo(&result, " <xsd:restriction base=\"xsd:date\">\n" ! " <xsd:pattern value=\"\\p{Nd}{4}-\\p{Nd}{2}-\\p{Nd}{2}\"/>\n" " </xsd:restriction>\n"); break; --- 3100,3106 ---- case DATEOID: appendStringInfo(&result, " <xsd:restriction base=\"xsd:date\">\n" ! " <xsd:pattern value=\"\\p{Nd}{4}-\\p{Nd}{2}-\\p{Nd}{2}\" />\n" " </xsd:restriction>\n"); break; *************** *** 3113,3119 **** base_typeoid = getBaseTypeAndTypmod(typeoid, &base_typmod); appendStringInfo(&result, ! " <xsd:restriction base=\"%s\"/>\n", map_sql_type_to_xml_name(base_typeoid, base_typmod)); } break; --- 3113,3119 ---- base_typeoid = getBaseTypeAndTypmod(typeoid, &base_typmod); appendStringInfo(&result, ! " <xsd:restriction base=\"%s\" />\n", map_sql_type_to_xml_name(base_typeoid, base_typmod)); } break; *************** *** 3168,3174 **** if (isnull) { if (nulls) ! appendStringInfo(result, " <%s xsi:nil='true'/>\n", colname); } else appendStringInfo(result, " <%s>%s</%s>\n", --- 3168,3174 ---- if (isnull) { if (nulls) ! appendStringInfo(result, " <%s xsi:nil='true' />\n", colname); } else appendStringInfo(result, " <%s>%s</%s>\n", *** ./src/backend/utils/adt/xml.c.orig 2007-11-23 02:17:55.000000000 -0200 --- ./src/backend/utils/adt/xml.c 2007-11-23 02:21:31.000000000 -0200 *************** *** 3019,3025 **** case INT4OID: appendStringInfo(&result, ! " <xsd:restriction base='xsd:int'>\n" " <xsd:maxInclusive value=\"%d\" />\n" " <xsd:minInclusive value=\"%d\" />\n" " </xsd:restriction>\n", --- 3019,3025 ---- case INT4OID: appendStringInfo(&result, ! " <xsd:restriction base=\"xsd:int\">\n" " <xsd:maxInclusive value=\"%d\" />\n" " <xsd:minInclusive value=\"%d\" />\n" " </xsd:restriction>\n", *************** *** 3168,3174 **** if (isnull) { if (nulls) ! appendStringInfo(result, " <%s xsi:nil='true' />\n", colname); } else appendStringInfo(result, " <%s>%s</%s>\n", --- 3168,3174 ---- if (isnull) { if (nulls) ! appendStringInfo(result, " <%s xsi:nil=\"true\" />\n", colname); } else appendStringInfo(result, " <%s>%s</%s>\n",
pgsql-bugs by date: