new($xmldom_element, %options)
get_stream
set_stream($votable_stream)
get_content($offset, $length)
set_content($bytes, $offset, $length)
VOTABLE::BINARY - VOTABLE BINARY XML element class
use VOTABLE::BINARY;
This class implements the BINARY
element from the VOTABLE
DTD. This element encapsulates a stream of binary data (non-FITS).
The BINARY
element is a Tier 1 element, and is described by the
following excerpt from the VOTABLE
1.0 DTD:
<!ELEMENT BINARY (STREAM)>
new($xmldom_element, %options)
Create and return a new VOTABLE::BINARY
object, based on the
supplied XML::DOM::Element
object, using %options
to set the
attributes of the new object. If no XML::DOM::Element
object is
specified, or is undefined, create and return an empty
VOTABLE::BINARY
object. Return undef if an error occurs.
get_stream
Return the VOTABLE::STREAM
object for the STREAM
element which
is the child of this BINARY
element. Return undef
if no
STREAM
element is found, or an error occurs.
set_stream($votable_stream)
Set the STREAM
element for this BINARY
element using the
supplied VOTABLE::STREAM
object. Return the VOTABLE::STREAM
object on success, or undef
if an error occurs.
get_content($offset, $length)
Return a portion of the content string starting at $offset
bytes
and continuing for $length
bytes. If $offset
and $length
are
not specified, return the entire content as a single byte string. If
$offset
is specified but $length
is not, return the content from
$offset
to the end of the string. Otherwise, the $offset
and
$length
arguments are treated the same as the corresponding
arguments to the substr
subroutine. Return the content as a string,
or undef
if an error occurs.
set_content($bytes, $offset, $length)
Set the specified portion of the content, starting at $offset
and
continuing for $length
bytes, to the specified byte string. If
$offset
and $length
are not specified, the current content is
replaced by the specified byte string. If $offset
is specified but
$length
is not specified, $length
defaults to the length of
$bytes
. Otherwise, $offset
and $length
behave as the
corresponding arguments to substr
. Return the new string on
success, or undef
on error.
_
') are for
internal use only, and should not be used outside of the VOTABLE
class hierarchy.
get_XXX
and set_XXX
accessors for attributes
and elements are derived directly from the names of the attributes or
elements, with the attribute or element name replacing
XXX
. Attribute and element names containing embedded hyphens
('-
') use accessors where the hyphen is mapped to an underscore
('_
') in the name of the accessor method. This is a necessity,
since the hyphen is not a valid name character in Perl.
BINARY
STREAM
, but that capability will be added ASAP.
VOTABLE
object always has an underlying XML::DOM::Element
object. As long as the internal structure is manipulated only by the
publicly-available methods, this should be an adequate assumption. If
a method detects an aberrant case, a warning message is printed (using
the Carp::carp
subroutine), and the method fails.
XML::DOM
methods always
succeed. If a method detects an aberrant case, a warning message is
printed (using the Carp::carp
subroutine), and the method fails.
set_XXX
accessors do not perform validation of the
new attribute values. The exceptions are the accessors for attributes
with enumerated values; the new value is checked against the list of
acceptable values, as defined in the DTD.
VOTABLE
, VOTABLE::DATA
, VOTABLE::STREAM
Eric Winter, NASA GSFC (elwinter@milkyway.gsfc.nasa.gov)
$Id: BINARY.pm,v 1.1.1.13 2002/06/09 21:13:08 elwinter Exp $