Skip to main content

Posts

Showing posts with the label Eclipse

XPath Matching in Unique XML Namespaces (xmlns)

I ran into a problem trying to get my Python script to locate an etree node in an XML document that had declared a namespace for all elements in the document. The trouble I was seeing is that the find and xpath functions weren't returning anything for any of the searches I was doing. Nothing seemed to make sense until I realized that I wasn't including the namespace in the search. The bugger with this is that you have to declare the ns on each and every element in the document! To simplify things a little, i went with code that looked a little like this: The full code: from lxml import etree as ET fp = open("sitemap.xml","r") element = ET.parse(fp) namespace = "{http://www.sitemaps.org/schemas/sitemap/0.9"}" e = element.findall('{0}url'.format(namespace)) for i in e: print i.text

Editing XML/DTDs/XSLT/XPath in Linux

My favorite new tool for editing XML in Linux? Eclipse. That's right. The does-it-all-and-comes-with-batteries-too tool does a great job editing XML, XSLT, xpath, etc. All you need to do is add the plugin for Eclipse Web Tools (available in the standard list of plugins). Just enable the software site and install the latest version! Very simple and very powerful.

PyDev and Code Completion

I was struggling with code completion/hinting in PyDev on Eclipse 3.5.2 (default for Ubuntu) and came across this little useful tidbit on the Internet: 'To enable code completion, go to Window > Preferences > Pydev > Editor > Code Completion, and check the 'Use Code Completion?' box, as well as the other boxes for what you want to complete on. It seems to take a second to load, the first time it has to complete something.' Problem solved! I now have my autocomplete settings just the way I want them! Thanks Internet! If I haven't said it lately, you're awesome.

The Ultimate Python IDE: Eclipse + pyDev

I posted awhile ago about my recommendation for an IDE (Wingware's IDE). I'd like to retract that recommendation in favor of one I've been experimenting with lately: Eclipse + pyDev. First off, the IDE is open source and is one of the most popular IDEs on the market today. I wasn't aware of how Aptana had fully integrated Python as a plugin until yesterday. I can only say that I am extremely pleased with the result. They did it right, no doubt about it. Check it out on your favorite OS today. For Ubuntu 10.04 users, simply add Eclipse to your system through the Software Center and then follow the instructions on pydev.org to add it as a plugin. Make sure you follow the instructions for adding it as a plugin.

Unable to Install Eclipse Plugins in Ubuntu 10.04

I wanted to give pyDev a spin after installing a new copy of Ubuntu 10.04 with Eclipse. Turns out it needs one additional package to install Eclipse plugins correctly. I kept getting this error: The artifact file for osgi.bundle,org.eclipse.cvs,1.0.400.v201002111343 was not found. Here's the fix : sudo apt-get install eclipse-pde