Update of /cvsroot/net-script/netscript2/src/perl/XML/DOM2
In directory usw-pr-cvs1:/tmp/cvs-serv19332
Added Files:
ProcessingInstruction.pm
Log Message:
* initial checkin
--- NEW FILE: ProcessingInstruction.pm ---
#--------------------------------------------------------
# DOM Level 2 Implementation for Perl
# Class ProcessingInstruction
# $Id: ProcessingInstruction.pm,v 1.1 2001/12/03 21:18:11 derkork Exp $
#
# DOM2 and all related materials, such as documentation,
# are protected under the terms and conditions of the Artistic License.
# (C) 2000-2001 by Jan Thomä, insOMnia
# mailto: ko...@in...
#--------------------------------------------------------
use strict;
package XML::DOM2::ProcessingInstruction;
use base qw(XML::DOM2::Node);
use vars qw($VERSION);
use XML::DOM2::DOMException;
#--------------------------------------------------------
# Globals
#--------------------------------------------------------
$VERSION = '1.0';
#--------------------------------------------------------
# Methods
#--------------------------------------------------------
#/**
# Creates a new Processing instruction.
# @return an instance of XML::DOM2::ProcessingInstruction
# @public
#*/
sub new {
my ($proto) = shift;
my $class = ref( $proto ) || $proto;# get the Classname
my $this = $proto -> SUPER::new(@_);
$this -> { m_data } = "";
$this -> { m_target } = "";
return $this;
}
#/**
# The content of this processing instruction. This is from the
# first non white-space character after the target to the character
# immediately preceding the ?>
# Can be set or retrieved. If the param is not supplied it will
# return the data, if the param is supplied it will set the new
# data.
# @param a hash containing the following key-value-pairs
# data - the new character data
# @return the content of this processing instruction
# @public
#*/
sub data {
my ( $this, $paramsRef ) = @_;
if ( defined( $paramsRef ) ) {
my %params = %{$paramsRef};
$this -> { m_data } = $params{"data"};
}
$this -> { m_data };
}
#/**
# The target of this processing instruction. XML defines this as being
# the first token following the markup that begins the processing
# instruction.
# Can be set or retrieved. If the param is not supplied it will
# return the data, if the param is supplied it will set the new
# data.
# @param a hash containing the following key-value-pairs
# target - the new character data
# @return the target of this processing instruction.
# @public
#*/
sub target {
my ( $this, $paramsRef ) = @_;
if ( defined( $paramsRef ) ) {
my %params = %{$paramsRef};
$this -> { m_target } = $params{"target"};
}
$this -> { m_target };
}
#/**
# AppendChild is unsupported, a ProcessingInstruction cannot have children.
#*/
sub appendChild {
my $exc = XML::DOM2::DOMException -> new (
{ ErrCode => XML::DOM2::DOMException -> INVALID_ACCESS_ERR(),
ErrDesc => "This node cannot have children."
} );
$exc -> raise();
}
#/**
# RemoveChild is unsupported, a ProcessingInstruction cannot have children.
#*/
sub removeChild {
my $exc = XML::DOM2::DOMException -> new (
{ ErrCode => XML::DOM2::DOMException -> INVALID_ACCESS_ERR(),
ErrDesc => "This node cannot have children."
} );
$exc -> raise();
}
#/**
# ReplaceChild is unsupported, a ProcessingInstruction cannot have children.
#*/
sub replaceChild {
my $exc = XML::DOM2::DOMException -> new (
{ ErrCode => XML::DOM2::DOMException -> INVALID_ACCESS_ERR(),
ErrDesc => "This node cannot have children."
} );
$exc -> raise();
}
#/**
# InsertBefore is unsupported, a ProcessingInstruction cannot have children.
#*/
sub insertBefore {
my $exc = XML::DOM2::DOMException -> new (
{ ErrCode => XML::DOM2::DOMException -> INVALID_ACCESS_ERR(),
ErrDesc => "This node cannot have children."
} );
$exc -> raise();
}
#/**
# Returns the entire content of this Processing instruction, except the
# target.
# @return the content of this PI, excluding the target.
# @public
#*/
sub nodeValue {
my ($this) = @_;
$this -> data();
}
|