I have a xml file as below  &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"&gt;  &lt;url&gt;   &lt;loc&gt;https://ezinearticles.com/&lt;/loc&gt;   &lt;changefreq&gt;hourly&lt;/changefreq&gt;   &lt;priority&gt;1.0&lt;/priority&gt;  &lt;/url&gt;  &lt;url&gt;   &lt;loc&gt;https://ezinearticles.com/submit/&lt;/loc&gt;   &lt;changefreq&gt;weekly&lt;/changefreq&gt;   &lt;priority&gt;0.3&lt;/priority&gt;  &lt;/url&gt;  ...................   I want to use xpathin lxml module to get URL from all  tag. I implemented it as below code but it didn't work. The result is empty list  from lxml import etree parser = etree.XMLParser(ns_clean=True) xmlfile = "sitemap1.xml" xmlobj = etree.parse(xmlfile, parser)  loc = xmlobj.xpath('//loc[text()]')  print(loc)   Can anyone help me fix my script ?
I am testing against the following test document:  &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"                        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;    &lt;head&gt;         &lt;title&gt;hi there&lt;/title&gt;     &lt;/head&gt;     &lt;body&gt;         &lt;img class="foo" src="bar.png"/&gt;     &lt;/body&gt; &lt;/html&gt;   If I parse the document using lxml.html, I can get the IMG with an xpath just fine:  &gt;&gt;&gt; root = lxml.html.fromstring(doc) &gt;&gt;&gt; root.xpath("//img") [&lt;Element img at 1879e30&gt;]   However, if I parse the document as XML and try to get the IMG tag, I get an empty result:  &gt;&gt;&gt; tree = etree.parse(StringIO(doc)) &gt;&gt;&gt; tree.getroot().xpath("//img") []   I can navigate to the element directly:  &gt;&gt;&gt; tree.getroot().getchildren()[1].getchildren()[0] &lt;Element {http://www.w3.org/1999/xhtml}img at f56810&gt;   But of course that doesn't help me process arbitrary documents.  I would also expect to be able to query etree to get an xpath expression that will directly identify this element, which, technically I can do:  &gt;&gt;&gt; tree.getpath(tree.getroot().getchildren()[1].getchildren()[0]) '/*/*[2]/*' &gt;&gt;&gt; tree.getroot().xpath('/*/*[2]/*') [&lt;Element {http://www.w3.org/1999/xhtml}img at fa1750&gt;]   But that xpath is, again, obviously not useful for parsing arbitrary documents.  Obviously I am missing some key issue here, but I don't know what it is.  My best guess is that it has something to do with namespaces but the only namespace defined is the default and I don't know what else I might need to consider in regards to namespaces.  So, what am I missing?
Open maps which are not continuous How do I add a Javascript library to a field formatter? I'm trying to include a Javascript gallery () on my new Drupal 8 site and wrote a field formatter for this purpose.   Now I need to add the jQuery lightGallery to pages using this field formatter and call the library when the page is ready. I am confused about how I am supposed to do this, though.   I defined the library in the module containing my field formatter, but I'm not sure how I attach it only on sites that contain the field.   The documentation of the library uses the jQuery $(document).ready function to call the libary, how would that work inside a Drupal module? As our users regularly upload ~6MB images to use on the website (and aren't too familiar with how to resize them first), WordPress stores the originals as well as resizing them to several different sizes.  I'd like a function or plugin that takes the uploaded image, resizes it down to something more manageable and then replaces the original.  I've seen some functions that delete the original but do not replace it, meaning it is impossible to regenerate the thumbnails at a later date. I need this to be replaced so the user can upload a large image and it is automatically resized down and stored for future resizing if needed. I know there are many ways to prevent image caching (such as via META tags), as well as a few nice tricks to ensure that the current version of an image is shown with every page load (such as image.jpg?x=timestamp), but is there any way to actually clear or replace an image in the browsers cache so that neither of the methods above are necessary?  As an example, lets say there are 100 images on a page and that these images are named "01.jpg", "02.jpg", "03.jpg", etc. If image "42.jpg" is replaced, is there any way to replace it in the cache so that "42.jpg" will automatically display the new image on successive page loads? I can't use the META tag method, because I need everuthing that ISN"T replaced to remain cached, and I can't use the timestamp method, because I don't want ALL of the images to be reloaded every time the page loads.  I've racked my brain and scoured the Internet for a way to do this (preferrably via javascript), but no luck. Any suggestions? Evaluate  $$\int_0^\infty \frac{\log x \; dx}{x^{2} + 2x + 2}$$  by integrating a branch of $(\log z)^{2}/(z^{2} + 2z +2)$ along a keyhole contour.  The thing I have trouble with is why I should be examining the square of the log - I guess it has something to do with ln x in fact NOT being the real part of log z, since log z is (or can be) defined on the entire negative real axis and ln x can't. But looking at the square would definitely not have been my first plan of attack :( Is there a third Holmes sibling? How can I return the current action in an ASP.NET MVC view? I wanted to set a CSS class in my master page, which depends on the current controller and action. I can get to the current controller via ViewContext.Controller.GetType().Name, but how do I get the current action (e.g. Index, Show etc.)? What is the correct name to use with /give for Lapis Lazuli? In Minecraft, when cheats are enabled you can give yourself items using the command /give [user] [item] [count], e.g. /give user45623 dirt 32. What is the item name to use for Lapis Lazuli? I've tried lapis_lazuli, lapis, lazuli, dye4, and dye_4, but it's none of those. I would like to redirect a URL with uppercase characters http://localhost/A/B to a lowercase version http://localhost/a/b using the .htaccess file. Using regex I can capture A and B but is it possible to convert them to lowercase? What is the best way to clean the sensor on a interchangeable lens camera (mirrorless or digital SLR)? Lattices are congruence-distributive How to dynamically change a web page's title? I have a webpage that implements a set of tabs each showing different content. The tab clicks do not refresh the page but hide/unhide contents at the client side.  Now there is a requirement to change the page title according to the tab selected on the page ( for SEO reasons ). Is this possible? Can someone suggest a solution to dynamically alter the page title via javascript without reloading the page? Do paths in Adobe Photoshop have to be closed? I am working to convert a png to a vector graphic.  I am outlining the image using the pen tool.  Photoshop insists that the pen tool produce closed loops in order for me to use the "Stroke path..." tool.  Why is this? Can a monk make a bonus unarmed attack after using shocking grasp? I'm playing a 5e Wizard/ Monk build. My DM and I are questioning the viability of the cantrip Shocking Grasp. As a monk I can do another unarmed strike as a bonus action after I attack with a melee attack. Being a touch spell, can I punch (touch) with Shocking Grasp and then do my monk's bonus action? I've got a utility that outputs a list of files required by a game.  How can I run that utility within a C program and grab its output so I can act on it within the same program? UPDATE: Good call on the lack of information.  The utility spits out a series of strings, and this is supposed to be portable across Mac/Windows/Linux.  Please note, I'm looking for a programmatic way to execute the utility and retain its output (which goes to stdout). A inequality proposed at Zhautykov Olympiad 2008 An inequality proposed at Zhautykov Olympiad 2008.     Let be $a,b,c &gt;0$ with $abc=1$. Prove that:    $$\sum_{\mathrm{cyc}}{\frac{1}{(a+b)b}} \geq \frac{3}{2}.$$   Set $a=\frac{x}{y}$, $b=\frac{y}{z}$, $c=\frac{z}{x}$.   Our inequality becomes: $$\sum_{\mathrm{cyc}}{\frac{z^2}{zx+y^2}} \geq \frac{3}{2}.$$  Now we use that: $z^2+x^2 \geq 2zx.$ $$\sum_{\mathrm{cyc}}{\frac{z^2}{zx+y^2}} \geq \sum_{\mathrm{cyc}}{\frac{2z^2}{z^2+x^2+2y^2}} \geq \frac{3}{2}.$$  Now applying Cauchy-Schwarz we obtain the desired result.  What I wrote can be found on this link: . But now, I don't know how to apply Cauchy-Schwarz.   Thanks:) How can I make the map::find operation case insensitive? This is a question to experienced people that might help us shed some light on the issue.   We noticed a very strange behavior on our site, in Google Analytics. Some dude from Finland, namely, from Kouvola city is hitting one of our pages - only one page on our site, 'bout a hundred times per day, all with an average bounce rate of 90%+...  This is causing our overall bounce rate to go up by 1 to 3% per day... which is very disturbing.. since we're trying to do our best in order to keep it as low as possible. And obviously having it jumped from ~24% to 27%, just because of that crazy dude is not making us happy at all... We tried implementing a geo-targeted script in order to catch this particular visitor and deliver him a juicy message, and it seemed like it helped in the beginning, it has stopped for a day or two, but now he's back...   The geo-targeted script was also logging all IP addresses for page requests originating from Finland in order to find out more details and (in order to block them on the server level, later).. but thing is, it was all mainly cable or DSL connections with various, but not constantly repeating IPs... we are all wondering what is he up to really ?   I think that this page should be kept updated with ideas on how to combat this and perhaps someone could also shed light on what it might be ? What is the reason for doing this "bounce-rate attack", as I call it?  There was a similar question asked on stackoverflow earlier, with no meaningful answer - here - How to change user in WinSCP? I'm using WinSCP to access Unix computers. How can I change user after I have logged into a Unix server using WinSCP?  E.g. I have personal account in Unix computer A. I can log into this computer using PuTTY and then change user to root user  $sudo /usr/bin/su - rootuser   How can I do the same thing using WinSCP? I don't know the password for rootuser. How to Update Multiple Array Elements in mongodb