If you go on Google and look for an example on how to parse xml in java you will find plenty of examples using the saxparser. And you will see them doing something like this. package be.baes.thisDevelopersLifePlayer.rss; import android.util.Log; import be.baes.thisDevelopersLifePlayer.Constants; import org.xml.sax.helpers.DefaultHandler; import org.xml.sax.*; import java.util.regex.Matcher; import java.util.regex.Pattern; public class RSSHandler extends DefaultHandler { RSSFeed _feed; RSSItem _item; final int RSS_TITLE = 1; int depth = 0; int currentstate = 0; /* * Constructor */ public RSSHandler() { } /* * getFeed - this returns our feed when all of the parsing is complete */ public RSSFeed getFeed() { return _feed; } public void startDocument() throws SAXException { // initialize our RSSFeed object - this will hold our parsed contents _feed = new RSSFeed(); // initialize the RSSItem object - we will use this as a crutch to grab the info from the channel // because the channel and items have very similar entries.. _item = new RSSItem(); } public void endDocument() throws SAXException { } public void startElement(String namespaceURI, String localName,String qName, Attributes atts) throws SAXException { depth++; if (localName.equals("item")) { // create a new item _item = new RSSItem(); return; } if (localName.equals("title")) { currentstate = RSS_TITLE; return; } currentstate = 0; } public void endElement(String namespaceURI, String localName, String qName) throws SAXException { depth--; if (localName.equals("item")) { _feed.addItem(_item); } } public void characters(char ch[], int start, int length) { Sring result = new String(ch,start,length)); switch (currentstate) { case RSS_TITLE: _item.setTitle(result); currentstate = 0; break; } } } The biggest problem in the above code is that they assume that the characters method will only be called once per element. But that’s not true. It can and will be called multiple times per element, especially if you have encoded html tags in there. So be careful and use the below method instead.
This is an archive of the posts published to LessThanDot from 2008 to 2018, over a decade of useful content. While we're no longer adding new content, we still receive a lot of visitors and wanted to make sure the content didn't disappear forever.
The Thank You Economy by Gary Vaynerchuk If your company is thinking about jumping on the social media bandwagon then this book is required reading. You should be able to finish this book in one sitting, it is only 256 pages. The length of the book is one of the plus points, if you give it to someone in your marketing or pr department, the chance is much higher that they will actually read it compared to a book that is 800 pages.
Approximately a year and a half ago, friends of mine and I created SQLCop. Our motivation was to provide a tool that users can download and run against their database. This tool is very effective at detecting common problems with database configurations and TSQL code. Not every issue highlighted by SQLCop requires a fix, but you are very likely to discover potential problems that you didn’t even know you had.
Remember this moment? I sure do. At SQL Saturday #67, Chicago 2011, I won the SQLskills swag bag. My second-favorite part of the package was the book, Microsoft SQL Server 2008 Internals. It was written by Kalen Delaney (blog | twitter), Paul Randal (blog | twitter), Kimberly Tripp (blog | twitter), Conor Cunningham (blog), Adam Machanic (blog | twitter), and Ben Nevarez (blog | twitter). (My favorite part was the SQLskills Sharpie pen!) This is The Book to read if you want to know the “how” of SQL Server.
If you are considering moving your SQL Server databases to SQL Azure, you can use the SQL Azure Compatibility Assessment to check if your database schema is compatible with SQL Azure. This service is very easy to use and does not require an Azure account. To use this service, you need a Live ID and a .dacpac extracted from your database, you do not need to have an Azure account or have Azure knowledge
Come one, come all to… Filegroups: Putting The Pieces Together Every DBA must know how to create and maintain filegroups because they affect performance, maintenance, and security of your data. What are filegroups, and how do you use them? In this session, I’ll show you how to create filegroups, create objects in them, move objects to them, perform maintenance, and walk through piecemeal restores. I’ll be presenting for WiSSUG. Where: Microsoft Offices, N19 W24133 Riverwood Dr., Suite 150, Waukesha, WI 53188
SQL Server 2008 has the Script Data option inside the script wizard. You would right click on the database, select Tasks–>Generate Scripts–>Pick the DB and then you would be presented with scripting options, one of the options would be to script data, this is located under Table/View options. See the image below of how it looks like In SQL Server 2012, this has changed and is kind of buried. Here is how to find it now.
So far in the SQL Server Audit series we’ve looked at the different components that make up the auditing feature as well as how to create the audits with specifications specific to databases as well as server level. Here is the links to the posts covering the topics: SQL Server Auditing: Introduction SQL Server Auditing: Creating a Server Specification SQL Server Auditing: Creating a Database Specification Now that we have set up our audits covering failed logins on instance level and deletes on database level, let’s take a look at how we can see what audits are on a server as well as some views to make your life easier with reading the audit files.
Forget about those crazy Mayans and their stupid calendar, 2012 is here to stay! Is your new year’s resolution to learn how to code? I have some good news for you, if you don’t know how to code but would like to learn, there is help on the way. There is a new site (at least new for me) that will help you accomplish that goal. Here is what they say on their page.
Recently I had to deal with the problem of displaying and saving Unicode data in a Visual FoxPro form. As we all know, Visual FoxPro does not support Unicode, so this was quite a challenge for me. I would never have solved this problem by myself if Gregory Adam from the UniversalThread would not lend me his generous support and practically solved the problem of saving for me. I want to show the full solution we came to together as this may be a very important topic for the remaining Visual FoxPro developers (and because Koen asked me to write this blog post).