class_docstr: A corpus view that selects out specified elements from an XML
  file, and provides a flat list-like interface for accessing them.
  (Note: ``XMLCorpusView`` is not used by ``XMLCorpusReader`` itself,
  but may be used by subclasses of ``XMLCorpusReader``.)
  
  Every XML corpus view has a "tag specification", indicating what
  XML elements should be included in the view; and each (non-nested)
  element that matches this specification corresponds to one item in
  the view.  Tag specifications are regular expressions over tag
  paths, where a tag path is a list of element tag names, separated
  by '/', indicating the ancestry of the element.  Some examples:
  
    - ``'foo'``: A top-level element whose tag is ``foo``.
    - ``'foo/bar'``: An element whose tag is ``bar`` and whose parent
      is a top-level element whose tag is ``foo``.
    - ``'.*/foo'``: An element whose tag is ``foo``, appearing anywhere
      in the xml tree.
    - ``'.*/(foo|bar)'``: An wlement whose tag is ``foo`` or ``bar``,
      appearing anywhere in the xml tree.
  
  The view items are generated from the selected XML elements via
  the method ``handle_elt()``.  By default, this method returns the
  element as-is (i.e., as an ElementTree object); but it can be
  overridden, either via subclassing or via the ``elt_handler``
  constructor parameter.
class_docstr_tok: ["A","corpus","view","that","selects","out","specified","elements","from","an","XML","file",",","and","provides","a","flat","list-like","interface","for","accessing","them",".","(","Note",":","``","XMLCorpusView","``","is","not","used","by","``","XMLCorpusReader","``","itself",",","but","may","be","used","by","subclasses","of","``","XMLCorpusReader","``",".",")","Every","XML","corpus","view","has","a","``","tag","specification","''",",","indicating","what","XML","elements","should","be","included","in","the","view",";","and","each","(","non-nested",")","element","that","matches","this","specification","corresponds","to","one","item","in","the","view",".","Tag","specifications","are","regular","expressions","over","tag","paths",",","where","a","tag","path","is","a","list","of","element","tag","names",",","separated","by","'\/","'",",","indicating","the","ancestry","of","the","element",".","Some","examples",":","-","``","'foo","'","``",":","A","top-level","element","whose","tag","is","``","foo","``",".","-","``","'foo\/bar","'","``",":","An","element","whose","tag","is","``","bar","``","and","whose","parent","is","a","top-level","element","whose","tag","is","``","foo","``",".","-","``","'",".","*","\/foo","'","``",":","An","element","whose","tag","is","``","foo","``",",","appearing","anywhere","in","the","xml","tree",".","-","``","'",".","*","\/","(","foo|bar",")","'","``",":","An","wlement","whose","tag","is","``","foo","``","or","``","bar","``",",","appearing","anywhere","in","the","xml","tree",".","The","view","items","are","generated","from","the","selected","XML","elements","via","the","method","``","handle_elt","(",")","``",".","By","default",",","this","method","returns","the","element","as-is","(","i.e.",",","as","an","ElementTree","object",")",";","but","it","can","be","overridden",",","either","via","subclassing","or","via","the","``","elt_handler","``","constructor","parameter","."]
docstr: Convert an element into an appropriate value for inclusion in
  the view.  Unless overridden by a subclass or by the
  ``elt_handler`` constructor argument, this method simply
  returns ``elt``.
  
  :return: The view value corresponding to ``elt``.
  
  :type elt: ElementTree
  :param elt: The element that should be converted.
  
  :type context: str
  :param context: A string composed of element tags separated by
      forward slashes, indicating the XML context of the given
      element.  For example, the string ``'foo/bar/baz'``
      indicates that the element is a ``baz`` element whose
      parent is a ``bar`` element and whose grandparent is a
      top-level ``foo`` element.
docstr_tok: ["Convert","an","element","into","an","appropriate","value","for","inclusion","in","the","view",".","Unless","overridden","by","a","subclass","or","by","the","``","elt_handler","``","constructor","argument",",","this","method","simply","returns","``","elt","``",".",":","return",":","The","view","value","corresponding","to","``","elt","``",".",":","type","elt",":","ElementTree",":","param","elt",":","The","element","that","should","be","converted",".",":","type","context",":","str",":","param","context",":","A","string","composed","of","element","tags","separated","by","forward","slashes",",","indicating","the","XML","context","of","the","given","element",".","For","example",",","the","string","``","'foo\/bar\/baz","'","``","indicates","that","the","element","is","a","``","baz","``","element","whose","parent","is","a","``","bar","``","element","and","whose","grandparent","is","a","top-level","``","foo","``","element","."]
code: def handle_elt(self, elt, context):
      """
      Convert an element into an appropriate value for inclusion in
      the view.  Unless overridden by a subclass or by the
      ``elt_handler`` constructor argument, this method simply
      returns ``elt``.
  
      :return: The view value corresponding to ``elt``.
  
      :type elt: ElementTree
      :param elt: The element that should be converted.
  
      :type context: str
      :param context: A string composed of element tags separated by
          forward slashes, indicating the XML context of the given
          element.  For example, the string ``'foo/bar/baz'``
          indicates that the element is a ``baz`` element whose
          parent is a ``bar`` element and whose grandparent is a
          top-level ``foo`` element.
      """
      return elt
  
file_path: nltk/nltk/corpus/reader/xmldocs.py
imports: import codecs
  from xml.etree import ElementTree
  from nltk.corpus.reader.api import CorpusReader
  from nltk.corpus.reader.util import *
  from nltk.data import SeekableUnicodeStreamReader
  from nltk.internals import ElementWrapper
  from nltk.tokenize import WordPunctTokenizer
label_desc: Use image node_id 3 for calling the XMLCorpusView obj's underlying member method code with example usage: obj.handle_elt(elt, context) and returns: elt