public void run() {
		for (;;) {
			Package pkg = null;
			try {
				pkg = packageQ.take();
			} catch (Exception e) {
				System.out.println(e);
			}

			// handle this package
			XmlTag tag = pkg.getXmlTag();
			String tagName = tag.getLocalName();

			System.out.println("Processing a package of type: " + tagName);

			PackageHandler handler = handlers.get(tagName);

			String ns = null;

			if (null == handler) {
				ns = tag.getNamespaceUri();
				if (null != ns)
					handler = handlers.get(ns);
				if (null == handler) {
					if (tag instanceof XmlNode) {
						XmlNode node = (XmlNode) tag;
						ns = node.getAttributeValueFromRawName("xmlns");
						handler = handlers.get(ns);
					}
				}
			}

			if (null == handler)
				System.out.println("No handler found for package of type: " + tagName);

			if (null != handler) {
				try {
					System.out.println("Handler: " + handler + " selected for package of type " + tagName + " or namespace of " + ns + ".");
					handler.handle(pkg);
				} catch (Exception e) {
					System.out.println(e);
				}
			}
		}
	}