.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "XML::Easy::Classify 3pm" .TH XML::Easy::Classify 3pm 2024-03-10 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME XML::Easy::Classify \- classification of XML\-related items .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 9 \& use XML::Easy::Classify qw( \& is_xml_name check_xml_name \& is_xml_encname check_xml_encname \& is_xml_chardata check_xml_chardata \& is_xml_attributes check_xml_attributes \& is_xml_content_object check_xml_content_object \& is_xml_content_twine check_xml_content_twine \& is_xml_content check_xml_content \& is_xml_element check_xml_element); \& \& if(is_xml_name($arg)) { ... \& check_xml_name($arg); \& if(is_xml_encname($arg)) { ... \& check_xml_encname($arg); \& if(is_xml_chardata($arg)) { ... \& check_xml_chardata($arg); \& \& if(is_xml_attributes($arg)) { ... \& check_xml_attributes($arg); \& \& if(is_xml_content_object($arg)) { ... \& check_xml_content_object($arg); \& if(is_xml_content_twine($arg)) { ... \& check_xml_content_twine($arg); \& if(is_xml_content($arg)) { ... \& check_xml_content($arg); \& \& if(is_xml_element($arg)) { ... \& check_xml_element($arg); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" This module provides various type-testing functions, relating to data types used in the XML::Easy ensemble. These are mainly intended to be used to enforce validity of data being processed by XML-related functions. .PP There are two flavours of function in this module. Functions of the first flavour only provide type classification, to allow code to discriminate between argument types. Functions of the second flavour package up the most common type of type discrimination: checking that an argument is of an expected type. The functions come in matched pairs. .SH FUNCTIONS .IX Header "FUNCTIONS" Each of these functions takes one scalar argument (\fIARG\fR) to be tested. Any scalar value is acceptable for the argument to be tested. Each \f(CW\*(C`is_\*(C'\fR function returns a simple truth value result, which is true iff \fIARG\fR is of the type being checked for. Each \f(CW\*(C`check_\*(C'\fR function will return normally if the argument is of the type being checked for, or will \f(CW\*(C`die\*(C'\fR if it is not. .IP is_xml_name(ARG) 4 .IX Item "is_xml_name(ARG)" .PD 0 .IP check_xml_name(ARG) 4 .IX Item "check_xml_name(ARG)" .PD Check whether \fIARG\fR is a plain string satisfying the XML name syntax. (Such names are used to identify element types, attributes, entities, and other things in XML.) .IP is_xml_encname(ARG) 4 .IX Item "is_xml_encname(ARG)" .PD 0 .IP check_xml_encname(ARG) 4 .IX Item "check_xml_encname(ARG)" .PD Check whether \fIARG\fR is a plain string satisfying the XML character encoding name syntax. .IP is_xml_chardata(ARG) 4 .IX Item "is_xml_chardata(ARG)" .PD 0 .IP check_xml_chardata(ARG) 4 .IX Item "check_xml_chardata(ARG)" .PD Check whether \fIARG\fR is a plain string consisting of a sequence of characters that are acceptable to XML. Such a string is valid as data in an XML element (where it may be intermingled with subelements) or as the value of an element attribute. .IP is_xml_attributes(ARG) 4 .IX Item "is_xml_attributes(ARG)" .PD 0 .IP check_xml_attributes(ARG) 4 .IX Item "check_xml_attributes(ARG)" .PD Check whether \fIARG\fR is a reference to a hash that is well-formed as an XML element attribute set. To be well-formed, each key in the hash must be an XML name string, and each value must be an XML character data string. .IP is_xml_content_object(ARG) 4 .IX Item "is_xml_content_object(ARG)" .PD 0 .IP check_xml_content_object(ARG) 4 .IX Item "check_xml_content_object(ARG)" .PD Check whether \fIARG\fR is a reference to an XML::Easy::Content object, and thus represents a chunk of XML content. .IP is_xml_content_twine(ARG) 4 .IX Item "is_xml_content_twine(ARG)" .PD 0 .IP check_xml_content_twine(ARG) 4 .IX Item "check_xml_content_twine(ARG)" .PD Check whether \fIARG\fR is a reference to a twine array (see "Twine" in XML::Easy::NodeBasics), and thus represents a chunk of XML content. .IP is_xml_content_array(ARG) 4 .IX Item "is_xml_content_array(ARG)" Deprecated alias for "is_xml_content_twine". .IP is_xml_content(ARG) 4 .IX Item "is_xml_content(ARG)" .PD 0 .IP check_xml_content(ARG) 4 .IX Item "check_xml_content(ARG)" .PD Check whether \fIARG\fR is a reference to either an XML::Easy::Content object or a twine array (see "Twine" in XML::Easy::NodeBasics), and thus represents a chunk of XML content. .IP is_xml_element(ARG) 4 .IX Item "is_xml_element(ARG)" .PD 0 .IP check_xml_element(ARG) 4 .IX Item "check_xml_element(ARG)" .PD Check whether \fIARG\fR is a reference to an XML::Easy::Element object, and thus represents an XML element. .SH "SEE ALSO" .IX Header "SEE ALSO" Params::Classify, XML::Easy::NodeBasics .SH AUTHOR .IX Header "AUTHOR" Andrew Main (Zefram) .SH COPYRIGHT .IX Header "COPYRIGHT" Copyright (C) 2009, 2010, 2011, 2017 Andrew Main (Zefram) .SH LICENSE .IX Header "LICENSE" This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.