XML::Doctype::AttDef(3pm)

XML::Doctype::AttDef3pm

A class representing a definition in an <!attlist> tag

Usage

   $attr = $elt->attribute( $name ) ;
   $attr->name ;

Overview

This module is used to represent <!ELEMENT> tags in an XML::Doctype object. It contains <!ATTLIST> tags as well.

Status

This module is alpha code. It's developed enough to support XML::ValidWriter, but need a lot of work. Some big things that are lacking are:

Methods

new
   $dtd = XML::Doctype::AttDef->new( $name, $type, $default ) ;
default
   ( $spec, $value ) = $attr->default ;
   $attr->default( '#REQUIRED' ) ;
   $attr->default( '#IMPLIED' ) ;
   $attr->default( '', 'foo' ) ;
   $attr->default( '#FIXED', 'foo' ) ;

Sets/gets the default value. This is a

quant
   $attdef->quant( $q ) ;
   $q = $attdef->quant ;

Sets/gets the attribute quantifier: '#REQUIRED', '#FIXED', '#IMPLIED', or ''.

name
   $attdef->name( $name ) ;
   $name = $attdef->name ;

Sets/gets this attribute name. Don't change the name while an attribute is in an element's attlist, since it will then be filed under the wrong name.

default_on_write
   $attdef->default_on_write( $value ) ;
   $value = $attdef->default_on_write ;
   $attdef->default_on_write( $attdef->default ) ;

Sets/gets the value which is automatically output for this attribute if none is supplied to $writer->startTag. This is typically used to set a document-wide default for #REQUIRED attributes (and perhaps plain attributes) so that the attribute is treated like a #FIXED tag and emitted with a fixed value.

The default_on_write does not need to be the same as the default unless the quantifier is #FIXED.

Subclassing

This object uses the fields pragma, so you should use base and fields for any subclasses.

Releases

11 releases since Debian 3.1 (Sarge); the text changed 6 times.

  1. 3.1–4.0
  2. 5.0
  3. 6.0
  4. 7
  5. 8–10
  6. 11
  7. 12–13

Author

Barrie Slaymaker <[email protected]>

From libxml-autowriter-perl 0.40-5 in Debian 13 (Trixie). Parsed by carta from the page's man source.