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