| SGML-Grove documentation | Contained in the SGML-Grove distribution. |
SGML::Entity - an entity defined in an SGML or XML document
$name = $entity->name; $data = $entity->data; $entity->iter; $entity->accept($visitor, ...); The following are defined for type compatibilty: $entity->as_string([$context, ...]); $entity->accept_gi($visitor, ...); $entity->children_accept($visitor, ...); $entity->children_accept_gi($visitor, ...);
An SGML::Entity contains an entity defined in a document instance.
Within a grove, any entity with the same name refers to the same
SGML::Entity object.
SGML::Entity objects occur in a value of an element attribute or as
children of entities.
$entity->name returns the name of the Entity object.
$entity->data returns the data of the Entity object.
$entity->accept($visitor[, ...]) issues a call back to
$visitor->visit_SGML_Entity($entity[, ...]). See examples
visitor.pl and simple-dump.pl for more information.
$entity->as_string returns an empty string.
$entity->accept_gi($visitor[, ...]) is implemented as a synonym
for accept.
children_accept and children_accept_gi do nothing.
Ken MacLeod, ken@bitsko.slc.ut.us
perl(1), SGML::Grove(3), Text::EntityMap(3), SGML::Element(3), SGML::PI(3).
| SGML-Grove documentation | Contained in the SGML-Grove distribution. |
# # Copyright (C) 1997 Ken MacLeod # See the file COPYING for distribution terms. # # $Id: Entity.pm,v 1.2 1998/01/18 00:21:13 ken Exp $ # package SGML::Entity; use strict; use Class::Visitor; visitor_class 'SGML::Entity', 'Class::Visitor::Base', { 'name' => '$', 'data' => '$', # if ext, will be valid if loaded };
sub as_string { my $self = shift; my $context = shift; return (""); } sub accept { my $self = shift; my $visitor = shift; $visitor->visit_SGML_Entity ($self, @_); } # synonomous to `accept' sub accept_gi { my $self = shift; my $visitor = shift; $visitor->visit_SGML_Entity ($self, @_); } # these are here just for type compatibility sub children_accept { } sub children_accept_gi { } sub contents { return [] } 1;