use utf8;
use strict;
use warnings;
no warnings qw(uninitialized);

package XML::Pastor::Builtin::base64Binary;
use XML::Pastor::Builtin::Scalar;
use MIME::Base64 ();

our @ISA = qw(XML::Pastor::Builtin::Scalar);

XML::Pastor::Builtin::base64Binary->XmlSchemaType( bless( {
                 'class' => 'XML::Pastor::Builtin::base64Binary',
                 'contentType' => 'simple',
                 'derivedBy' => 'restriction',
                 'name' => 'base64Binary|',
                 'regex' => qr /^([0-9a-zA-Z\+\\\=][0-9a-zA-Z\+\\\=])+$/,   # Regex shamelessly copied from XML::Validator::Schema by Sam Tregar
               }, 'XML::Pastor::Schema::SimpleType' ) );

sub toBinary {
	my $self  = shift;
	my $value = $self->__value() . "";	
	return MIME::Base64::decode($value)

sub setFromBinary($$) {
	my $self  = shift;
	return $self->__value(MIME::Base64::encode($_[0], ''));

sub fromBinary($$) {
	my $self  	= shift->new();
	return $self->setFromBinary(@_);



=head1 NAME

B<XML::Pastor::Builtin::base64Binary> - Class for the B<W3C builtin> type B<base64Binary>.

=head1 WARNING

This module is used internally by L<XML::Pastor>. You do not normally know much about this module to actually use L<XML::Pastor>.  It is 
documented here for completeness and for L<XML::Pastor> developers. Do not count on the interface of this module. It may change in 
any of the subsequent releases. You have been warned. 

=head1 ISA

This class descends from L<XML::Pastor::Builtin::Scalar>. 


B<XML::Pastor::Builtin::base64Binary> represents the B<builtin> W3C type 

=head1 METHODS


This class inherits many methods from its ancestors. Please see L<XML::Pastor::Builtin::Scalar> for 
more methods. 

=head4 fromBinary() 

  my $object = XML::Pastor::Builtin::base64Binary->fromBinary($binary_data)


The B<fromBinary()> constructor method instantiates a new object from a binary
data chunk. It is inheritable. The necessary conversion is done within the method.	


=head4 setFromBinary()

This method sets the value of the object from a chunk of binary data. 
The necessary conversion is done within the method.	

=head4 toBinary()

	my $binary_data = $object->toBinary();
This method returns the value of the object as a chunk of binary data. 
The necessary conversion is done within the method.	



There no known bugs at this time, but this doesn't mean there are aren't any. 
Note that, although some testing was done prior to releasing the module, this should still be considered alpha code. 
So use it at your own risk.

Note that there may be other bugs or limitations that the author is not aware of.

=head1 AUTHOR

Ayhan Ulusoy <dev(at)ulusoy(dot)name>


  Copyright (C) 2006-2007 Ayhan Ulusoy. All Rights Reserved.

This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.

=head1 SEE ALSO

See also L<XML::Pastor>, L<XML::Pastor::ComplexType>, L<XML::Pastor::SimpleType>, L<XML::Pastor::Builtin>

If you are curious about the implementation, see L<XML::Pastor::Schema::Parser>,
L<XML::Pastor::Schema::Model>, L<XML::Pastor::Generator>.