CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
BeautifulSoup.NavigableString Class Reference
Inheritance diagram for BeautifulSoup.NavigableString:
BeautifulSoup.PageElement BeautifulSoup.CData BeautifulSoup.Comment BeautifulSoup.Declaration BeautifulSoup.ProcessingInstruction

Public Member Functions

def __getattr__
 
def __getnewargs__
 
def __new__
 
def __str__
 
def __unicode__
 

Detailed Description

Definition at line 449 of file BeautifulSoup.py.

Member Function Documentation

def BeautifulSoup.NavigableString.__getattr__ (   self,
  attr 
)
text.string gives you text. This is for backwards
compatibility for Navigable*String, but for CData* it lets you
get the string without the CData wrapper.

Definition at line 466 of file BeautifulSoup.py.

Referenced by VarParsing.VarParsing.setType().

467  def __getattr__(self, attr):
468  """text.string gives you text. This is for backwards
469  compatibility for Navigable*String, but for CData* it lets you
470  get the string without the CData wrapper."""
471  if attr == 'string':
472  return self
473  else:
474  raise AttributeError, "'%s' object has no attribute '%s'" % (self.__class__.__name__, attr)
def BeautifulSoup.NavigableString.__getnewargs__ (   self)

Definition at line 463 of file BeautifulSoup.py.

464  def __getnewargs__(self):
465  return (NavigableString.__str__(self),)
def BeautifulSoup.NavigableString.__new__ (   cls,
  value 
)
Create a new NavigableString.

When unpickling a NavigableString, this method is called with
the string in DEFAULT_OUTPUT_ENCODING. That encoding needs to be
passed in to the superclass's __new__ or the superclass won't know
how to handle non-ASCII characters.

Definition at line 451 of file BeautifulSoup.py.

Referenced by SequenceTypes._ModuleSequenceType.copyAndExclude().

452  def __new__(cls, value):
453  """Create a new NavigableString.
454 
455  When unpickling a NavigableString, this method is called with
456  the string in DEFAULT_OUTPUT_ENCODING. That encoding needs to be
457  passed in to the superclass's __new__ or the superclass won't know
458  how to handle non-ASCII characters.
459  """
460  if isinstance(value, unicode):
461  return unicode.__new__(cls, value)
462  return unicode.__new__(cls, value, DEFAULT_OUTPUT_ENCODING)
def BeautifulSoup.NavigableString.__str__ (   self,
  encoding = DEFAULT_OUTPUT_ENCODING 
)

Definition at line 478 of file BeautifulSoup.py.

Referenced by BeautifulSoup.Tag.__repr__(), BeautifulSoup.Tag.__unicode__(), and BeautifulSoup.Tag.prettify().

479  def __str__(self, encoding=DEFAULT_OUTPUT_ENCODING):
480  # Substitute outgoing XML entities.
481  data = self.BARE_AMPERSAND_OR_BRACKET.sub(self._sub_entity, self)
482  if encoding:
483  return data.encode(encoding)
484  else:
485  return data
def BeautifulSoup.NavigableString.__unicode__ (   self)

Definition at line 475 of file BeautifulSoup.py.

References edm.decode().

476  def __unicode__(self):
477  return str(self).decode(DEFAULT_OUTPUT_ENCODING)
bool decode(bool &, std::string const &)
Definition: types.cc:62