parameters: (node, env, path, arg)
return_statement: return depfiles
docstring: Simple XML file scanner, detecting local images and XIncludes as implicit dependencies.
docstring_summary: Simple XML file scanner, detecting local images and XIncludes as implicit dependencies.
docstring_tokens: Simple XML file scanner detecting local images and XIncludes as implicit dependencies .
function: def __xml_scan(node, env, path, arg):
      """ Simple XML file scanner, detecting local images and XIncludes as implicit dependencies. """
      # Does the node exist yet?
      if not os.path.isfile(str(node)):
          return []
  
      if env.get('DOCBOOK_SCANENT',''):
          # Use simple pattern matching for system entities..., no support
          # for recursion yet.
          contents = node.get_text_contents()
          return sentity_re.findall(contents)
  
      xsl_file = os.path.join(scriptpath,'utils','xmldepend.xsl')
      if not has_lxml or prefer_xsltproc:
          # Try to call xsltproc
          xsltproc = env.subst("$DOCBOOK_XSLTPROC")
          if xsltproc and xsltproc.endswith('xsltproc'):
              result = env.backtick(' '.join([xsltproc, xsl_file, str(node)]))
              depfiles = [x.strip() for x in str(result).splitlines() if x.strip() != "" and not x.startswith("<?xml ")]
              return depfiles
          else:
              # Use simple pattern matching, there is currently no support
              # for xi:includes...
              contents = node.get_text_contents()
              return include_re.findall(contents)
          
      from lxml import etree
  
      xsl_tree = etree.parse(xsl_file)
      doc = etree.parse(str(node))
      result = doc.xslt(xsl_tree)
  
      depfiles = [x.strip() for x in str(result).splitlines() if x.strip() != "" and not x.startswith("<?xml ")]
      return depfiles
function_tokens: def __xml_scan ( node , env , path , arg ) : # Does the node exist yet? if not os . path . isfile ( str ( node ) ) : return [ ] if env . get ( 'DOCBOOK_SCANENT' , '' ) : # Use simple pattern matching for system entities..., no support # for recursion yet. contents = node . get_text_contents ( ) return sentity_re . findall ( contents ) xsl_file = os . path . join ( scriptpath , 'utils' , 'xmldepend.xsl' ) if not has_lxml or prefer_xsltproc : # Try to call xsltproc xsltproc = env . subst ( "$DOCBOOK_XSLTPROC" ) if xsltproc and xsltproc . endswith ( 'xsltproc' ) : result = env . backtick ( ' ' . join ( [ xsltproc , xsl_file , str ( node ) ] ) ) depfiles = [ x . strip ( ) for x in str ( result ) . splitlines ( ) if x . strip ( ) != "" and not x . startswith ( "<?xml " ) ] return depfiles else : # Use simple pattern matching, there is currently no support # for xi:includes... contents = node . get_text_contents ( ) return include_re . findall ( contents ) from lxml import etree xsl_tree = etree . parse ( xsl_file ) doc = etree . parse ( str ( node ) ) result = doc . xslt ( xsl_tree ) depfiles = [ x . strip ( ) for x in str ( result ) . splitlines ( ) if x . strip ( ) != "" and not x . startswith ( "<?xml " ) ] return depfiles