From: Mark Addison Date: Fri, 17 Oct 2003 13:39:01 +0000 (+0000) Subject: Fix: Now includes the Schema's name and database attributes X-Git-Tag: v0.04~55 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1caf2bb295c0dc5e7ab259c66e0b5044fd5fbaca;p=dbsrgits%2FSQL-Translator.git Fix: Now includes the Schema's name and database attributes --- diff --git a/lib/SQL/Translator/Producer/XML/SQLFairy.pm b/lib/SQL/Translator/Producer/XML/SQLFairy.pm index 3f72839..0ffe59e 100644 --- a/lib/SQL/Translator/Producer/XML/SQLFairy.pm +++ b/lib/SQL/Translator/Producer/XML/SQLFairy.pm @@ -1,7 +1,7 @@ package SQL::Translator::Producer::XML::SQLFairy; # ------------------------------------------------------------------- -# $Id: SQLFairy.pm,v 1.4 2003-09-09 16:05:09 kycl4rk Exp $ +# $Id: SQLFairy.pm,v 1.5 2003-10-17 13:39:01 grommit Exp $ # ------------------------------------------------------------------- # Copyright (C) 2003 Ken Y. Clark , # darren chamberlain , @@ -78,7 +78,7 @@ Creates XML output of a schema. use strict; use vars qw[ $VERSION @EXPORT_OK ]; -$VERSION = sprintf "%d.%02d", q$Revision: 1.4 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.5 $ =~ /(\d+)\.(\d+)/; use Exporter; use base qw(Exporter); @@ -107,7 +107,9 @@ sub produce { $xml->xmlDecl('UTF-8'); $xml->comment(header_comment('', '')); - $xml->startTag([ $Namespace => 'schema' ]); + #$xml->startTag([ $Namespace => 'schema' ]); + xml_obj($xml, $schema, + tag => "schema", methods => [qw/name database/], end_tag => 0 ); # # Table @@ -175,6 +177,12 @@ sub produce { } # ------------------------------------------------------------------- +# +# TODO +# - Doc this sub +# - Should the Namespace be passed in instead of global? Pass in the same +# as Writer ie [ NS => TAGNAME ] +# sub xml_obj { my ($xml, $obj, %args) = @_; my $tag = $args{'tag'} || ''; diff --git a/t/17sqlfxml-producer.t b/t/17sqlfxml-producer.t index db14a10..0ee12e5 100644 --- a/t/17sqlfxml-producer.t +++ b/t/17sqlfxml-producer.t @@ -46,6 +46,8 @@ my ($obj,$ans,$xml); $ans = < + + Basic 1 @@ -156,6 +158,8 @@ eq_or_diff $xml, $ans ,"XML looks right"; $ans = < + + Basic 2