def read_xmp_identifers(parent):
 for li in XPath(u'./rdf:Bag/rdf:li')(parent):
  is_resource = (li.attrib.get(expand(u'rdf:parseType'), None) == u'Resource')
  is_resource = (is_resource or ((len(li) == 1) and (li[0].tag == expand(u'rdf:Description'))))
  if (not is_resource):
   (yield (None, (li.text or u'')))
  value = XPath(u'descendant::rdf:value')(li)
  if (not value):
   continue
  value = (value[0].text or u'')
  scheme = XPath(u'descendant::xmpidq:Scheme')(li)
  if (not scheme):
   (yield (None, value))
  else:
   (yield ((scheme[0].text or u''), value))

def read_xmp_identifers ( parent ) : for li in XPath ( u'./rdf:Bag/rdf:li' ) ( parent ) : is_resource = ( li . attrib . get ( expand ( u'rdf:parseType' ) , None ) == u'Resource' ) is_resource = ( is_resource or ( ( len ( li ) == 1 ) and ( li [ 0 ] . tag == expand ( u'rdf:Description' ) ) ) ) if ( not is_resource ) : ( yield ( None , ( li . text or u'' ) ) ) value = XPath ( u'descendant::rdf:value' ) ( li ) if ( not value ) : continue value = ( value [ 0 ] . text or u'' ) scheme = XPath ( u'descendant::xmpidq:Scheme' ) ( li ) if ( not scheme ) : ( yield ( None , value ) ) else : ( yield ( ( scheme [ 0 ] . text or u'' ) , value ) )
for example: <rdf:li rdf:parsetype="resource"><xmpidq:scheme>url</xmp:idq><rdf:value>URL or the longer form: <rdf:li><rdf:description><xmpidq:scheme>url</xmp:idq><rdf:value>URL .