'Parse a document fragment from a string, returning the
fragment node.'

def parseString(self, string):

    self._source = string
    parser = self.getParser()
    doctype = self.originalDocument.doctype
    ident = ''
    if doctype:
        subset = (doctype.internalSubset or self._getDeclarations())
        if doctype.publicId:
            ident = ('PUBLIC    "%s"    "%s"' % (doctype.publicId, doctype.systemId))
        elif doctype.systemId:
            ident = ('SYSTEM    "%s"' % doctype.systemId)
    else:
        subset = ''
    nsattrs = self._getNSattrs()
    document = (_FRAGMENT_BUILDER_TEMPLATE % (ident, subset, nsattrs))
    try:
        parser.Parse(document, 1)
    except:
        self.reset()
        raise
    fragment = self.fragment
    self.reset()
    return fragment
