X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FSQL%2FTranslator%2FProducer%2FXML%2FSQLFairy.pm;h=972ffe12f8c550924baccf9deae6525f47b6178e;hb=4ab3763d2ad756c236b757306989cafa08e7f35e;hp=8871a1043ffab0147a59e13726aa5a84ea34cffc;hpb=0eebe05938c1a9ec8533d5ac9502743c0b43550b;p=dbsrgits%2FSQL-Translator.git diff --git a/lib/SQL/Translator/Producer/XML/SQLFairy.pm b/lib/SQL/Translator/Producer/XML/SQLFairy.pm index 8871a10..972ffe1 100644 --- a/lib/SQL/Translator/Producer/XML/SQLFairy.pm +++ b/lib/SQL/Translator/Producer/XML/SQLFairy.pm @@ -1,8 +1,6 @@ package SQL::Translator::Producer::XML::SQLFairy; # ------------------------------------------------------------------- -# $Id: SQLFairy.pm,v 1.19 2004-11-05 16:37:00 grommit Exp $ -# ------------------------------------------------------------------- # Copyright (C) 2003 Ken Y. Clark , # darren chamberlain , # Chris Mungall , @@ -165,7 +163,7 @@ To convert your old format files simply pass them through the translator :) use strict; use vars qw[ $VERSION @EXPORT_OK ]; -$VERSION = sprintf "%d.%02d", q$Revision: 1.19 $ =~ /(\d+)\.(\d+)/; +$VERSION = '1.59'; use Exporter; use base qw(Exporter); @@ -260,6 +258,17 @@ sub produce { /], ); + # + # Comments + # + xml_obj_children( $xml, $table, + tag => 'comment', + collection_tag => "comments", + methods => [qw/ + comments + /], + ); + $xml->endTag( [ $Namespace => 'table' ] ); } $xml->endTag( [ $Namespace => 'tables' ] ); @@ -309,17 +318,28 @@ sub xml_obj_children { my ($name,$collection_name,$methods) = @args{qw/tag collection_tag methods/}; $collection_name ||= "${name}s"; - my $meth = "get_$collection_name"; + + my $meth; + if ( $collection_name eq 'comments' ) { + $meth = 'comments'; + } else { + $meth = "get_$collection_name"; + } my @kids = $parent->$meth; #@kids || return; $xml->startTag( [ $Namespace => $collection_name ] ); + for my $obj ( @kids ) { - xml_obj($xml, $obj, - tag => "$name", - end_tag => 1, - methods => $methods, - ); + if ( $collection_name eq 'comments' ){ + $xml->dataElement( [ $Namespace => 'comment' ], $obj ); + } else { + xml_obj($xml, $obj, + tag => "$name", + end_tag => 1, + methods => $methods, + ); + } } $xml->endTag( [ $Namespace => $collection_name ] ); }