MCPcopy Create free account
hub / github.com/clips/pattern / parse_declaration

Method parse_declaration

pattern/web/soup/BeautifulSoup.py:1450–1468  ·  view source on GitHub ↗

Treat a bogus SGML declaration as raw data. Treat a CDATA declaration as a CData object.

(self, i)

Source from the content-addressed store, hash-verified

1448 self._toStringSubclass(data, Declaration)
1449
1450 def parse_declaration(self, i):
1451 """Treat a bogus SGML declaration as raw data. Treat a CDATA
1452 declaration as a CData object."""
1453 j = None
1454 if self.rawdata[i:i+9] == '<![CDATA[':
1455 k = self.rawdata.find(']]>', i)
1456 if k == -1:
1457 k = len(self.rawdata)
1458 data = self.rawdata[i+9:k]
1459 j = k+3
1460 self._toStringSubclass(data, CData)
1461 else:
1462 try:
1463 j = SGMLParser.parse_declaration(self, i)
1464 except SGMLParseError:
1465 toHandle = self.rawdata[i:]
1466 self.handle_data(toHandle)
1467 j = i + len(toHandle)
1468 return j
1469
1470class BeautifulSoup(BeautifulStoneSoup):
1471

Callers

nothing calls this directly

Calls 4

_toStringSubclassMethod · 0.95
handle_dataMethod · 0.95
lenFunction · 0.85
findMethod · 0.45

Tested by

no test coverage detected