Add built local::lib
[catagits/Gitalist.git] / local-lib5 / man / man3 / XML::Parser::Expat.3pm
CommitLineData
3fea05b9 1.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.10)
2.\"
3.\" Standard preamble:
4.\" ========================================================================
5.de Sp \" Vertical space (when we can't use .PP)
6.if t .sp .5v
7.if n .sp
8..
9.de Vb \" Begin verbatim text
10.ft CW
11.nf
12.ne \\$1
13..
14.de Ve \" End verbatim text
15.ft R
16.fi
17..
18.\" Set up some character translations and predefined strings. \*(-- will
19.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
20.\" double quote, and \*(R" will give a right double quote. \*(C+ will
21.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
22.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
23.\" nothing in troff, for use with C<>.
24.tr \(*W-
25.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
26.ie n \{\
27. ds -- \(*W-
28. ds PI pi
29. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
30. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
31. ds L" ""
32. ds R" ""
33. ds C` ""
34. ds C' ""
35'br\}
36.el\{\
37. ds -- \|\(em\|
38. ds PI \(*p
39. ds L" ``
40. ds R" ''
41'br\}
42.\"
43.\" Escape single quotes in literal strings from groff's Unicode transform.
44.ie \n(.g .ds Aq \(aq
45.el .ds Aq '
46.\"
47.\" If the F register is turned on, we'll generate index entries on stderr for
48.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
49.\" entries marked with X<> in POD. Of course, you'll have to process the
50.\" output yourself in some meaningful fashion.
51.ie \nF \{\
52. de IX
53. tm Index:\\$1\t\\n%\t"\\$2"
54..
55. nr % 0
56. rr F
57.\}
58.el \{\
59. de IX
60..
61.\}
62.\"
63.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
64.\" Fear. Run. Save yourself. No user-serviceable parts.
65. \" fudge factors for nroff and troff
66.if n \{\
67. ds #H 0
68. ds #V .8m
69. ds #F .3m
70. ds #[ \f1
71. ds #] \fP
72.\}
73.if t \{\
74. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
75. ds #V .6m
76. ds #F 0
77. ds #[ \&
78. ds #] \&
79.\}
80. \" simple accents for nroff and troff
81.if n \{\
82. ds ' \&
83. ds ` \&
84. ds ^ \&
85. ds , \&
86. ds ~ ~
87. ds /
88.\}
89.if t \{\
90. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
91. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
92. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
93. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
94. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
95. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
96.\}
97. \" troff and (daisy-wheel) nroff accents
98.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
99.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
100.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
101.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
102.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
103.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
104.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
105.ds ae a\h'-(\w'a'u*4/10)'e
106.ds Ae A\h'-(\w'A'u*4/10)'E
107. \" corrections for vroff
108.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
109.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
110. \" for low resolution devices (crt and lpr)
111.if \n(.H>23 .if \n(.V>19 \
112\{\
113. ds : e
114. ds 8 ss
115. ds o a
116. ds d- d\h'-1'\(ga
117. ds D- D\h'-1'\(hy
118. ds th \o'bp'
119. ds Th \o'LP'
120. ds ae ae
121. ds Ae AE
122.\}
123.rm #[ #] #H #V #F C
124.\" ========================================================================
125.\"
126.IX Title "Expat 3"
127.TH Expat 3 "2007-11-20" "perl v5.8.7" "User Contributed Perl Documentation"
128.\" For nroff, turn off justification. Always turn off hyphenation; it makes
129.\" way too many mistakes in technical documents.
130.if n .ad l
131.nh
132.SH "NAME"
133XML::Parser::Expat \- Lowlevel access to James Clark's expat XML parser
134.SH "SYNOPSIS"
135.IX Header "SYNOPSIS"
136.Vb 1
137\& use XML::Parser::Expat;
138\&
139\& $parser = new XML::Parser::Expat;
140\& $parser\->setHandlers(\*(AqStart\*(Aq => \e&sh,
141\& \*(AqEnd\*(Aq => \e&eh,
142\& \*(AqChar\*(Aq => \e&ch);
143\& open(FOO, \*(Aqinfo.xml\*(Aq) or die "Couldn\*(Aqt open";
144\& $parser\->parse(*FOO);
145\& close(FOO);
146\& # $parser\->parse(\*(Aq<foo id="me"> here <em>we</em> go </foo>\*(Aq);
147\&
148\& sub sh
149\& {
150\& my ($p, $el, %atts) = @_;
151\& $p\->setHandlers(\*(AqChar\*(Aq => \e&spec)
152\& if ($el eq \*(Aqspecial\*(Aq);
153\& ...
154\& }
155\&
156\& sub eh
157\& {
158\& my ($p, $el) = @_;
159\& $p\->setHandlers(\*(AqChar\*(Aq => \e&ch) # Special elements won\*(Aqt contain
160\& if ($el eq \*(Aqspecial\*(Aq); # other special elements
161\& ...
162\& }
163.Ve
164.SH "DESCRIPTION"
165.IX Header "DESCRIPTION"
166This module provides an interface to James Clark's \s-1XML\s0 parser, expat. As in
167expat, a single instance of the parser can only parse one document. Calls
168to parsestring after the first for a given instance will die.
169.PP
170Expat (and XML::Parser::Expat) are event based. As the parser recognizes
171parts of the document (say the start or end of an \s-1XML\s0 element), then any
172handlers registered for that type of an event are called with suitable
173parameters.
174.SH "METHODS"
175.IX Header "METHODS"
176.IP "new" 4
177.IX Item "new"
178This is a class method, the constructor for XML::Parser::Expat. Options are
179passed as keyword value pairs. The recognized options are:
180.RS 4
181.IP "\(bu" 4
182ProtocolEncoding
183.Sp
184The protocol encoding name. The default is none. The expat built-in
185encodings are: \f(CW\*(C`UTF\-8\*(C'\fR, \f(CW\*(C`ISO\-8859\-1\*(C'\fR, \f(CW\*(C`UTF\-16\*(C'\fR, and \f(CW\*(C`US\-ASCII\*(C'\fR.
186Other encodings may be used if they have encoding maps in one of the
187directories in the \f(CW@Encoding_Path\fR list. Setting the protocol encoding
188overrides any encoding in the \s-1XML\s0 declaration.
189.IP "\(bu" 4
190Namespaces
191.Sp
192When this option is given with a true value, then the parser does namespace
193processing. By default, namespace processing is turned off. When it is
194turned on, the parser consumes \fIxmlns\fR attributes and strips off prefixes
195from element and attributes names where those prefixes have a defined
196namespace. A name's namespace can be found using the \*(L"namespace\*(R" method
197and two names can be checked for absolute equality with the \*(L"eq_name\*(R"
198method.
199.IP "\(bu" 4
200NoExpand
201.Sp
202Normally, the parser will try to expand references to entities defined in
203the internal subset. If this option is set to a true value, and a default
204handler is also set, then the default handler will be called when an
205entity reference is seen in text. This has no effect if a default handler
206has not been registered, and it has no effect on the expansion of entity
207references inside attribute values.
208.IP "\(bu" 4
209Stream_Delimiter
210.Sp
211This option takes a string value. When this string is found alone on a line
212while parsing from a stream, then the parse is ended as if it saw an end of
213file. The intended use is with a stream of xml documents in a \s-1MIME\s0 multipart
214format. The string should not contain a trailing newline.
215.IP "\(bu" 4
216ErrorContext
217.Sp
218When this option is defined, errors are reported in context. The value
219of ErrorContext should be the number of lines to show on either side of
220the line in which the error occurred.
221.IP "\(bu" 4
222ParseParamEnt
223.Sp
224Unless standalone is set to \*(L"yes\*(R" in the \s-1XML\s0 declaration, setting this to
225a true value allows the external \s-1DTD\s0 to be read, and parameter entities
226to be parsed and expanded.
227.IP "\(bu" 4
228Base
229.Sp
230The base to use for relative pathnames or URLs. This can also be done by
231using the base method.
232.RE
233.RS 4
234.RE
235.IP "setHandlers(\s-1TYPE\s0, \s-1HANDLER\s0 [, \s-1TYPE\s0, \s-1HANDLER\s0 [...]])" 4
236.IX Item "setHandlers(TYPE, HANDLER [, TYPE, HANDLER [...]])"
237This method registers handlers for the various events. If no handlers are
238registered, then a call to parsestring or parsefile will only determine if
239the corresponding \s-1XML\s0 document is well formed (by returning without error.)
240This may be called from within a handler, after the parse has started.
241.Sp
242Setting a handler to something that evaluates to false unsets that
243handler.
244.Sp
245This method returns a list of type, handler pairs corresponding to the
246input. The handlers returned are the ones that were in effect before the
247call to setHandlers.
248.Sp
249The recognized events and the parameters passed to the corresponding
250handlers are:
251.RS 4
252.IP "\(bu" 4
253Start (Parser, Element [, Attr, Val [,...]])
254.Sp
255This event is generated when an \s-1XML\s0 start tag is recognized. Parser is
256an XML::Parser::Expat instance. Element is the name of the \s-1XML\s0 element that
257is opened with the start tag. The Attr & Val pairs are generated for each
258attribute in the start tag.
259.IP "\(bu" 4
260End (Parser, Element)
261.Sp
262This event is generated when an \s-1XML\s0 end tag is recognized. Note that
263an \s-1XML\s0 empty tag (<foo/>) generates both a start and an end event.
264.Sp
265There is always a lower level start and end handler installed that wrap
266the corresponding callbacks. This is to handle the context mechanism.
267A consequence of this is that the default handler (see below) will not
268see a start tag or end tag unless the default_current method is called.
269.IP "\(bu" 4
270Char (Parser, String)
271.Sp
272This event is generated when non-markup is recognized. The non-markup
273sequence of characters is in String. A single non-markup sequence of
274characters may generate multiple calls to this handler. Whatever the
275encoding of the string in the original document, this is given to the
276handler in \s-1UTF\-8\s0.
277.IP "\(bu" 4
278Proc (Parser, Target, Data)
279.Sp
280This event is generated when a processing instruction is recognized.
281.IP "\(bu" 4
282Comment (Parser, String)
283.Sp
284This event is generated when a comment is recognized.
285.IP "\(bu" 4
286CdataStart (Parser)
287.Sp
288This is called at the start of a \s-1CDATA\s0 section.
289.IP "\(bu" 4
290CdataEnd (Parser)
291.Sp
292This is called at the end of a \s-1CDATA\s0 section.
293.IP "\(bu" 4
294Default (Parser, String)
295.Sp
296This is called for any characters that don't have a registered handler.
297This includes both characters that are part of markup for which no
298events are generated (markup declarations) and characters that
299could generate events, but for which no handler has been registered.
300.Sp
301Whatever the encoding in the original document, the string is returned to
302the handler in \s-1UTF\-8\s0.
303.IP "\(bu" 4
304Unparsed (Parser, Entity, Base, Sysid, Pubid, Notation)
305.Sp
306This is called for a declaration of an unparsed entity. Entity is the name
307of the entity. Base is the base to be used for resolving a relative \s-1URI\s0.
308Sysid is the system id. Pubid is the public id. Notation is the notation
309name. Base and Pubid may be undefined.
310.IP "\(bu" 4
311Notation (Parser, Notation, Base, Sysid, Pubid)
312.Sp
313This is called for a declaration of notation. Notation is the notation name.
314Base is the base to be used for resolving a relative \s-1URI\s0. Sysid is the system
315id. Pubid is the public id. Base, Sysid, and Pubid may all be undefined.
316.IP "\(bu" 4
317ExternEnt (Parser, Base, Sysid, Pubid)
318.Sp
319This is called when an external entity is referenced. Base is the base to be
320used for resolving a relative \s-1URI\s0. Sysid is the system id. Pubid is the public
321id. Base, and Pubid may be undefined.
322.Sp
323This handler should either return a string, which represents the contents of
324the external entity, or return an open filehandle that can be read to obtain
325the contents of the external entity, or return undef, which indicates the
326external entity couldn't be found and will generate a parse error.
327.Sp
328If an open filehandle is returned, it must be returned as either a glob
329(*FOO) or as a reference to a glob (e.g. an instance of IO::Handle).
330.IP "\(bu" 4
331ExternEntFin (Parser)
332.Sp
333This is called after an external entity has been parsed. It allows
334applications to perform cleanup on actions performed in the above
335ExternEnt handler.
336.IP "\(bu" 4
337Entity (Parser, Name, Val, Sysid, Pubid, Ndata, IsParam)
338.Sp
339This is called when an entity is declared. For internal entities, the Val
340parameter will contain the value and the remaining three parameters will
341be undefined. For external entities, the Val parameter
342will be undefined, the Sysid parameter will have the system id, the Pubid
343parameter will have the public id if it was provided (it will be undefined
344otherwise), the Ndata parameter will contain the notation for unparsed
345entities. If this is a parameter entity declaration, then the IsParam
346parameter is true.
347.Sp
348Note that this handler and the Unparsed handler above overlap. If both are
349set, then this handler will not be called for unparsed entities.
350.IP "\(bu" 4
351Element (Parser, Name, Model)
352.Sp
353The element handler is called when an element declaration is found. Name is
354the element name, and Model is the content model as an
355XML::Parser::ContentModel object. See \*(L"XML::Parser::ContentModel Methods\*(R"
356for methods available for this class.
357.IP "\(bu" 4
358Attlist (Parser, Elname, Attname, Type, Default, Fixed)
359.Sp
360This handler is called for each attribute in an \s-1ATTLIST\s0 declaration.
361So an \s-1ATTLIST\s0 declaration that has multiple attributes
362will generate multiple calls to this handler. The Elname parameter is the
363name of the element with which the attribute is being associated. The Attname
364parameter is the name of the attribute. Type is the attribute type, given as
365a string. Default is the default value, which will either be \*(L"#REQUIRED\*(R",
366\&\*(L"#IMPLIED\*(R" or a quoted string (i.e. the returned string will begin and end
367with a quote character). If Fixed is true, then this is a fixed attribute.
368.IP "\(bu" 4
369Doctype (Parser, Name, Sysid, Pubid, Internal)
370.Sp
371This handler is called for \s-1DOCTYPE\s0 declarations. Name is the document type
372name. Sysid is the system id of the document type, if it was provided,
373otherwise it's undefined. Pubid is the public id of the document type,
374which will be undefined if no public id was given. Internal will be
375true or false, indicating whether or not the doctype declaration contains
376an internal subset.
377.IP "\(bu" 4
378DoctypeFin (Parser)
379.Sp
380This handler is called after parsing of the \s-1DOCTYPE\s0 declaration has finished,
381including any internal or external \s-1DTD\s0 declarations.
382.IP "\(bu" 4
383XMLDecl (Parser, Version, Encoding, Standalone)
384.Sp
385This handler is called for \s-1XML\s0 declarations. Version is a string containg
386the version. Encoding is either undefined or contains an encoding string.
387Standalone is either undefined, or true or false. Undefined indicates
388that no standalone parameter was given in the \s-1XML\s0 declaration. True or
389false indicates \*(L"yes\*(R" or \*(L"no\*(R" respectively.
390.RE
391.RS 4
392.RE
393.IP "namespace(name)" 4
394.IX Item "namespace(name)"
395Return the \s-1URI\s0 of the namespace that the name belongs to. If the name doesn't
396belong to any namespace, an undef is returned. This is only valid on names
397received through the Start or End handlers from a single document, or through
398a call to the generate_ns_name method. In other words, don't use names
399generated from one instance of XML::Parser::Expat with other instances.
400.IP "eq_name(name1, name2)" 4
401.IX Item "eq_name(name1, name2)"
402Return true if name1 and name2 are identical (i.e. same name and from
403the same namespace.) This is only meaningful if both names were obtained
404through the Start or End handlers from a single document, or through
405a call to the generate_ns_name method.
406.IP "generate_ns_name(name, namespace)" 4
407.IX Item "generate_ns_name(name, namespace)"
408Return a name, associated with a given namespace, good for using with the
409above 2 methods. The namespace argument should be the namespace \s-1URI\s0, not
410a prefix.
411.IP "new_ns_prefixes" 4
412.IX Item "new_ns_prefixes"
413When called from a start tag handler, returns namespace prefixes declared
414with this start tag. If called elsewere (or if there were no namespace
415prefixes declared), it returns an empty list. Setting of the default
416namespace is indicated with '#default' as a prefix.
417.IP "expand_ns_prefix(prefix)" 4
418.IX Item "expand_ns_prefix(prefix)"
419Return the uri to which the given prefix is currently bound. Returns
420undef if the prefix isn't currently bound. Use '#default' to find the
421current binding of the default namespace (if any).
422.IP "current_ns_prefixes" 4
423.IX Item "current_ns_prefixes"
424Return a list of currently bound namespace prefixes. The order of the
425the prefixes in the list has no meaning. If the default namespace is
426currently bound, '#default' appears in the list.
427.IP "recognized_string" 4
428.IX Item "recognized_string"
429Returns the string from the document that was recognized in order to call
430the current handler. For instance, when called from a start handler, it
431will give us the the start-tag string. The string is encoded in \s-1UTF\-8\s0.
432This method doesn't return a meaningful string inside declaration handlers.
433.IP "original_string" 4
434.IX Item "original_string"
435Returns the verbatim string from the document that was recognized in
436order to call the current handler. The string is in the original document
437encoding. This method doesn't return a meaningful string inside declaration
438handlers.
439.IP "default_current" 4
440.IX Item "default_current"
441When called from a handler, causes the sequence of characters that generated
442the corresponding event to be sent to the default handler (if one is
443registered). Use of this method is deprecated in favor the recognized_string
444method, which you can use without installing a default handler. This
445method doesn't deliver a meaningful string to the default handler when
446called from inside declaration handlers.
447.IP "xpcroak(message)" 4
448.IX Item "xpcroak(message)"
449Concatenate onto the given message the current line number within the
450\&\s-1XML\s0 document plus the message implied by ErrorContext. Then croak with
451the formed message.
452.IP "xpcarp(message)" 4
453.IX Item "xpcarp(message)"
454Concatenate onto the given message the current line number within the
455\&\s-1XML\s0 document plus the message implied by ErrorContext. Then carp with
456the formed message.
457.IP "current_line" 4
458.IX Item "current_line"
459Returns the line number of the current position of the parse.
460.IP "current_column" 4
461.IX Item "current_column"
462Returns the column number of the current position of the parse.
463.IP "current_byte" 4
464.IX Item "current_byte"
465Returns the current position of the parse.
466.IP "base([\s-1NEWBASE\s0]);" 4
467.IX Item "base([NEWBASE]);"
468Returns the current value of the base for resolving relative URIs. If
469\&\s-1NEWBASE\s0 is supplied, changes the base to that value.
470.IP "context" 4
471.IX Item "context"
472Returns a list of element names that represent open elements, with the
473last one being the innermost. Inside start and end tag handlers, this
474will be the tag of the parent element.
475.IP "current_element" 4
476.IX Item "current_element"
477Returns the name of the innermost currently opened element. Inside
478start or end handlers, returns the parent of the element associated
479with those tags.
480.IP "in_element(\s-1NAME\s0)" 4
481.IX Item "in_element(NAME)"
482Returns true if \s-1NAME\s0 is equal to the name of the innermost currently opened
483element. If namespace processing is being used and you want to check
484against a name that may be in a namespace, then use the generate_ns_name
485method to create the \s-1NAME\s0 argument.
486.IP "within_element(\s-1NAME\s0)" 4
487.IX Item "within_element(NAME)"
488Returns the number of times the given name appears in the context list.
489If namespace processing is being used and you want to check
490against a name that may be in a namespace, then use the generate_ns_name
491method to create the \s-1NAME\s0 argument.
492.IP "depth" 4
493.IX Item "depth"
494Returns the size of the context list.
495.IP "element_index" 4
496.IX Item "element_index"
497Returns an integer that is the depth-first visit order of the current
498element. This will be zero outside of the root element. For example,
499this will return 1 when called from the start handler for the root element
500start tag.
501.IP "skip_until(\s-1INDEX\s0)" 4
502.IX Item "skip_until(INDEX)"
503\&\s-1INDEX\s0 is an integer that represents an element index. When this method
504is called, all handlers are suspended until the start tag for an element
505that has an index number equal to \s-1INDEX\s0 is seen. If a start handler has
506been set, then this is the first tag that the start handler will see
507after skip_until has been called.
508.IP "position_in_context(\s-1LINES\s0)" 4
509.IX Item "position_in_context(LINES)"
510Returns a string that shows the current parse position. \s-1LINES\s0 should be
511an integer >= 0 that represents the number of lines on either side of the
512current parse line to place into the returned string.
513.IP "xml_escape(\s-1TEXT\s0 [, \s-1CHAR\s0 [, \s-1CHAR\s0 ...]])" 4
514.IX Item "xml_escape(TEXT [, CHAR [, CHAR ...]])"
515Returns \s-1TEXT\s0 with markup characters turned into character entities. Any
516additional characters provided as arguments are also turned into character
517references where found in \s-1TEXT\s0.
518.IP "parse (\s-1SOURCE\s0)" 4
519.IX Item "parse (SOURCE)"
520The \s-1SOURCE\s0 parameter should either be a string containing the whole \s-1XML\s0
521document, or it should be an open IO::Handle. Only a single document
522may be parsed for a given instance of XML::Parser::Expat, so this will croak
523if it's been called previously for this instance.
524.IP "parsestring(\s-1XML_DOC_STRING\s0)" 4
525.IX Item "parsestring(XML_DOC_STRING)"
526Parses the given string as an \s-1XML\s0 document. Only a single document may be
527parsed for a given instance of XML::Parser::Expat, so this will die if either
528parsestring or parsefile has been called for this instance previously.
529.Sp
530This method is deprecated in favor of the parse method.
531.IP "parsefile(\s-1FILENAME\s0)" 4
532.IX Item "parsefile(FILENAME)"
533Parses the \s-1XML\s0 document in the given file. Will die if parsestring or
534parsefile has been called previously for this instance.
535.IP "is_defaulted(\s-1ATTNAME\s0)" 4
536.IX Item "is_defaulted(ATTNAME)"
537\&\s-1NO\s0 \s-1LONGER\s0 \s-1WORKS\s0. To find out if an attribute is defaulted please use
538the specified_attr method.
539.IP "specified_attr" 4
540.IX Item "specified_attr"
541When the start handler receives lists of attributes and values, the
542non-defaulted (i.e. explicitly specified) attributes occur in the list
543first. This method returns the number of specified items in the list.
544So if this number is equal to the length of the list, there were no
545defaulted values. Otherwise the number points to the index of the
546first defaulted attribute name.
547.IP "finish" 4
548.IX Item "finish"
549Unsets all handlers (including internal ones that set context), but expat
550continues parsing to the end of the document or until it finds an error.
551It should finish up a lot faster than with the handlers set.
552.IP "release" 4
553.IX Item "release"
554There are data structures used by XML::Parser::Expat that have circular
555references. This means that these structures will never be garbage
556collected unless these references are explicitly broken. Calling this
557method breaks those references (and makes the instance unusable.)
558.Sp
559Normally, higher level calls handle this for you, but if you are using
560XML::Parser::Expat directly, then it's your responsibility to call it.
561.SS "XML::Parser::ContentModel Methods"
562.IX Subsection "XML::Parser::ContentModel Methods"
563The element declaration handlers are passed objects of this class as the
564content model of the element declaration. They also represent content
565particles, components of a content model.
566.PP
567When referred to as a string, these objects are automagicly converted to a
568string representation of the model (or content particle).
569.IP "isempty" 4
570.IX Item "isempty"
571This method returns true if the object is \*(L"\s-1EMPTY\s0\*(R", false otherwise.
572.IP "isany" 4
573.IX Item "isany"
574This method returns true if the object is \*(L"\s-1ANY\s0\*(R", false otherwise.
575.IP "ismixed" 4
576.IX Item "ismixed"
577This method returns true if the object is \*(L"(#PCDATA)\*(R" or \*(L"(#PCDATA|...)*\*(R",
578false otherwise.
579.IP "isname" 4
580.IX Item "isname"
581This method returns if the object is an element name.
582.IP "ischoice" 4
583.IX Item "ischoice"
584This method returns true if the object is a choice of content particles.
585.IP "isseq" 4
586.IX Item "isseq"
587This method returns true if the object is a sequence of content particles.
588.IP "quant" 4
589.IX Item "quant"
590This method returns undef or a string representing the quantifier
591('?', '*', '+') associated with the model or particle.
592.IP "children" 4
593.IX Item "children"
594This method returns undef or (for mixed, choice, and sequence types)
595an array of component content particles. There will always be at least
596one component for choices and sequences, but for a mixed content model
597of pure \s-1PCDATA\s0, \*(L"(#PCDATA)\*(R", then an undef is returned.
598.SS "XML::Parser::ExpatNB Methods"
599.IX Subsection "XML::Parser::ExpatNB Methods"
600The class XML::Parser::ExpatNB is a subclass of XML::Parser::Expat used
601for non-blocking access to the expat library. It does not support the parse,
602parsestring, or parsefile methods, but it does have these additional methods:
603.IP "parse_more(\s-1DATA\s0)" 4
604.IX Item "parse_more(DATA)"
605Feed expat more text to munch on.
606.IP "parse_done" 4
607.IX Item "parse_done"
608Tell expat that it's gotten the whole document.
609.SH "FUNCTIONS"
610.IX Header "FUNCTIONS"
611.IP "XML::Parser::Expat::load_encoding(\s-1ENCODING\s0)" 4
612.IX Item "XML::Parser::Expat::load_encoding(ENCODING)"
613Load an external encoding. \s-1ENCODING\s0 is either the name of an encoding or
614the name of a file. The basename is converted to lowercase and a '.enc'
615extension is appended unless there's one already there. Then, unless
616it's an absolute pathname (i.e. begins with '/'), the first file by that
617name discovered in the \f(CW@Encoding_Path\fR path list is used.
618.Sp
619The encoding in the file is loaded and kept in the \f(CW%Encoding_Table\fR
620table. Earlier encodings of the same name are replaced.
621.Sp
622This function is automaticly called by expat when it encounters an encoding
623it doesn't know about. Expat shouldn't call this twice for the same
624encoding name. The only reason users should use this function is to
625explicitly load an encoding not contained in the \f(CW@Encoding_Path\fR list.
626.SH "AUTHORS"
627.IX Header "AUTHORS"
628Larry Wall <\fIlarry@wall.org\fR> wrote version 1.0.
629.PP
630Clark Cooper <\fIcoopercc@netheaven.com\fR> picked up support, changed the \s-1API\s0
631for this version (2.x), provided documentation, and added some standard
632package features.