XML::D...entDecl(3pm)

πŸ“¦
version 0.40 Β· 2 versions
  • 0.40 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.40 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

XML::Doctype::ElementDecl β€” bestie, it's a whole class that represents an <!ELEMENT> tag. That's it, that's the vibe. πŸ‘‘


✨ SYNOPSIS ✨

$elt = $dtd->element( 'foo' ) ;
$elt->name() ;
$elt->attr( 'foo' ) ;

okay so that's literally all you need to peek at it. slay. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

So like… this module is the little guy that stands in for <!ELEMENT> tags inside an XML::Doctype object. and the plot twist? It also carries <!ATTLIST> tags around with it. multi-talented. main character energy fr fr. πŸŽ€


🌸 STATUS 🌸

heads up bestie β€” this module is alpha code. not finished, not polished, still in its awkward growing-out-bangs era. 😭

It is developed enough to support XML::ValidWriter, which is lowkey iconic of it. But it needs a lot of work. Some big things that are lacking are:

  • (…nothing listed here, bestie. the list is just. empty. the void. the silence. πŸ’€)

so yeah, imagine a bullet list with nothing in it. that's the energy we're working with.


πŸ’… METHODS πŸ’…

new

# Undefined element constructors:
$dtd = XML::Doctype::ElementDecl->new( $name ) ;
$dtd = XML::Doctype::ElementDecl->new( $name, undef, \@attdefs ) ;

# Defined element constructors
$dtd = XML::Doctype::ElementDecl->new( $name, \@kids, \@attdef ) ;
$dtd = XML::Doctype::ElementDecl->new( $name, [], \@attdefs ) ;

four flavors of construction, pick your fighter. two for undefined elements, two for defined ones. 🫢

add_attdef

$elt_decl->add_attdef( $att_def ) ;

you hand it an attdef, it adds it. simple as. ✨

attdef

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

Returns the XML::Doctype::AttDef named by $name, or undef if there is no such attribute. no attribute, no problem, just undef. πŸ™ˆ

attdefs

$attdefs = $elt->attdefs( $name ) ;

Returns the list of XML::Doctype::AttDef instances associated with this element. the whole squad. πŸ‘‘

attribute_names

Returns a list of the attdefs' names. that's it. that's the method. short king. πŸ’œ

child_names

@names = $elt->child_names ;

Returns a list of names of elements in this element decl's content model. your element's kids, named and accounted for. 🧚

is_declared

if ( $elt_decl->is_declared ) ...
$elt_decl->is_declared( 1 ) ;

Returns TRUE if there is any data defined in the element other than name and attributes β€” or if is_declared has been set by calling is_declared( 1 ) or by passing DECLARED => 1 to new(). three ways to become declared. glow up. ⭐

is_empty

no extra deets given, bestie β€” it's just here, existing, being mysterious. 🌈

is_any

also just vibing here with zero elaboration. πŸ“

is_mixed

same situation. present. unexplained. iconic honestly. πŸ’«

name

$n = $elt_decl->name ;

Gets the name of the element. yep. the name. of the element. πŸ’–

validate_content

$v = $elt_decl->validate_content( \@seq ) ;

Takes an ARRAY ref of tag names (or '#PCDATA') and checks to see if it would be valid content for elements of this type.

important bestie: right now, this must be called only when an element's end tag is emitted. It can be broadened to be incremental if need be β€” but for now, end tag only. no cap. πŸ”₯

πŸŽ€ SUBCLASSING πŸŽ€

This object uses the fields pragma, so if you're subclassing, you should use base and fields for any subclasses. do it right, bestie. πŸ’…


πŸ‘‘ AUTHOR πŸ‘‘

Barrie Slaymaker <barries@slaysys.com>


This module is Copyright 2000, 2005 Barrie Slaymaker. All rights reserved.

This module is licensed under your choice of the Artistic, BSD or General Public License. pick your fave, they're all valid. ✨


and that's a wrap, bestie!! 🫢 this little beauty is perl v5.34.0, dated 2022-06-28, and it lives under User Contributed Perl Documentation β€” go forth and declare those elements. mwah. πŸ’‹

πŸ“¦ where this page comes from