Commit 739eeec9 authored by gmantele's avatar gmantele
Browse files

[TAP] Fix the XML serialization for 'foreignKey' items in /tables.

The order of its children was incorrect according to the XSD schema:
the 'fkColumn' must be written before 'description' and 'utype'.
parent 239c7178
Loading
Loading
Loading
Loading
+110 −109
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ import uws.UWSToolBox;
 * </p>
 *
 * @author Gr&eacute;gory Mantelet (CDS;ARI)
 * @version 2.1 (09/2017)
 * @version 2.1 (11/2017)
 */
public class TAPMetadata implements Iterable<TAPSchema>, VOSIResource, TAPResource {

@@ -850,13 +850,13 @@ public class TAPMetadata implements Iterable<TAPSchema>, VOSIResource, TAPResour
	 * <pre>
	 * &lt;foreignKey&gt;
	 * 	&lt;targetTable&gt;...&lt;/targetTable&gt;
	 * 	&lt;description&gt;...&lt;/description&gt;
	 * 	&lt;utype&gt;...&lt;/utype&gt;
	 * 	&lt;fkColumn&gt;
	 * 		&lt;fromColumn&gt;...&lt;/fromColumn&gt;
	 * 		&lt;targetColumn&gt;...&lt;/targetColumn&gt;
	 * 	&lt;/fkColumn&gt;
	 * 	...
	 * 	&lt;description&gt;...&lt;/description&gt;
	 * 	&lt;utype&gt;...&lt;/utype&gt;
	 * &lt;/foreignKey&gt;
	 * </pre>
	 *
@@ -873,8 +873,6 @@ public class TAPMetadata implements Iterable<TAPSchema>, VOSIResource, TAPResour
		writer.println("\t\t\t<foreignKey>");

		writeAtt(prefix, "targetTable", fk.getTargetTable().getRawName(), false, writer);
		writeAtt(prefix, "description", fk.getDescription(), true, writer);
		writeAtt(prefix, "utype", fk.getUtype(), true, writer);

		final String prefix2 = prefix + "\t";
		for(Map.Entry<String,String> entry : fk){
@@ -886,6 +884,9 @@ public class TAPMetadata implements Iterable<TAPSchema>, VOSIResource, TAPResour
			writer.println("</fkColumn>");
		}

		writeAtt(prefix, "description", fk.getDescription(), true, writer);
		writeAtt(prefix, "utype", fk.getUtype(), true, writer);

		writer.println("\t\t\t</foreignKey>");
	}