Index: org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/actions/NewJARAction.java
===================================================================
--- org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/actions/NewJARAction.java	(revision 42480)
+++ org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/actions/NewJARAction.java	(working copy)
@@ -32,6 +32,7 @@
 			dialog.open();
 		} catch( Exception e ) {
 			// TODO
+			e.printStackTrace();
 		}
 	}
 
Index: org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveModel.java
===================================================================
--- org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveModel.java	(revision 42480)
+++ org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveModel.java	(working copy)
@@ -12,7 +12,6 @@
 
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
-import org.jboss.ide.eclipse.archives.core.model.internal.xb.XMLBinding.XbException;
 
 
 /**
Index: org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveModelRootNode.java
===================================================================
--- org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveModelRootNode.java	(revision 42480)
+++ org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveModelRootNode.java	(working copy)
@@ -12,8 +12,6 @@
 
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
-import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackages;
-import org.jboss.ide.eclipse.archives.core.model.internal.xb.XMLBinding.XbException;
 
 
 /**
Index: org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/IMemento.java
===================================================================
--- org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/IMemento.java	(revision 0)
+++ org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/IMemento.java	(working copy)
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2006 Jeff Mesnil
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.jboss.ide.eclipse.archives.core.model.internal.xb;
+
+import java.util.List;
+
+/**
+ * Stolen from webtools wst.server.core,
+ * represents a savable memento to be
+ * translated into xml
+ * 
+ * Moved from org.jboss.ide.eclipse.as.core.util.internal 
+ *    to org.jboss.ide.eclipse.as.core.util
+ *    
+ * May later move to COMMON
+ *
+ */
+public interface IMemento {
+	/**
+	 * Creates a new child of this memento with the given type.
+	 * <p>
+	 * The <code>getChild</code> and <code>getChildren</code> methods
+	 * are used to retrieve children of a given type.
+	 * </p>
+	 *
+	 * @param type the type
+	 * @return a new child memento
+	 * @see #getChild
+	 * @see #getChildren
+	 */
+	public IMemento createChild(String type);
+
+	/**
+	 * Returns the first child with the given type id.
+	 *
+	 * @param type the type id
+	 * @return the first child with the given type
+	 */
+	public IMemento getChild(String type);
+
+	/**
+	 * Returns all children with the given type id.
+	 *
+	 * @param type the type id
+	 * @return the list of children with the given type
+	 */
+	public IMemento[] getChildren(String type);
+
+	/**
+	 * Returns the floating point value of the given key.
+	 *
+	 * @param key the key
+	 * @return the value, or <code>null</code> if the key was not found or was found
+	 *   but was not a floating point number
+	 */
+	public Float getFloat(String key);
+
+	/**
+	 * Returns the integer value of the given key.
+	 *
+	 * @param key the key
+	 * @return the value, or <code>null</code> if the key was not found or was found
+	 *   but was not an integer
+	 */
+	public Integer getInteger(String key);
+
+	/**
+	 * Returns the string value of the given key.
+	 *
+	 * @param key the key
+	 * @return the value, or <code>null</code> if the key was not found or was found
+	 *  but was not an integer
+	 */
+	public String getString(String key);
+
+	/**
+	 * Returns the boolean value of the given key.
+	 *
+	 * @param key the key
+	 * @return the value, or <code>null</code> if the key was not found or was found
+	 *  but was not a boolean
+	 */
+	public Boolean getBoolean(String key);
+
+	public List<String> getNames();
+
+	/**
+	 * Sets the value of the given key to the given integer.
+	 *
+	 * @param key the key
+	 * @param value the value
+	 */
+	public void putInteger(String key, int value);
+
+	/**
+	 * Sets the value of the given key to the given boolean value.
+	 *
+	 * @param key the key
+	 * @param value the value
+	 */
+	public void putBoolean(String key, boolean value);
+
+	/**
+	 * Sets the value of the given key to the given string.
+	 *
+	 * @param key the key
+	 * @param value the value
+	 */
+	public void putString(String key, String value);
+}
Index: org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XMLMemento.java
===================================================================
--- org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XMLMemento.java	(revision 0)
+++ org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XMLMemento.java	(working copy)
@@ -0,0 +1,430 @@
+/*******************************************************************************
+ * Copyright (c) 2006 Jeff Mesnil
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.jboss.ide.eclipse.archives.core.model.internal.xb;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+import org.xml.sax.InputSource;
+
+/**
+ * Stolen from webtools wst.server.core
+ *
+ */
+public final class XMLMemento implements IMemento {
+	private Document factory;
+	private Element element;
+
+	/**
+	 * Answer a memento for the document and element.  For simplicity
+	 * you should use createReadRoot and createWriteRoot to create the initial
+	 * mementos on a document.
+	 */
+	public XMLMemento(Document doc, Element el) {
+		factory = doc;
+		element = el;
+	}
+
+	/*
+	 * @see IMemento
+	 */
+	public IMemento createChild(String type) {
+		Element child = factory.createElement(type);
+		element.appendChild(child);
+		return new XMLMemento(factory, child);
+	}
+
+	public void removeChild(XMLMemento child) {
+		element.removeChild(child.element);
+	}
+	
+	/**
+	 * Create a Document from a Reader and answer a root memento for reading
+	 * a document.
+	 */
+	public static XMLMemento createReadRoot(InputStream in) {
+		Document document = null;
+		try {
+			DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+			DocumentBuilder parser = factory.newDocumentBuilder();
+			document = parser.parse(new InputSource(in));
+			Node node = document.getFirstChild();
+			if (node instanceof Element)
+				return new XMLMemento(document, (Element) node);
+		} catch (Exception e) {
+			// ignore
+		} finally {
+			try {
+				in.close();
+			} catch (Exception e) {
+				// ignore
+			}
+		}
+		return null;
+	}
+
+	/**
+	 * Answer a root memento for writing a document.
+	 *
+	 * @param type a type
+	 * @return a memento
+	 */
+	public static XMLMemento createWriteRoot(String type) {
+		Document document;
+		try {
+			document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
+			Element element = document.createElement(type);
+			document.appendChild(element);
+			return new XMLMemento(document, element);
+		} catch (ParserConfigurationException e) {
+			throw new Error(e);
+		}
+	}
+
+	/*
+	 * @see IMemento
+	 */
+	public IMemento getChild(String type) {
+		// Get the nodes.
+		NodeList nodes = element.getChildNodes();
+		int size = nodes.getLength();
+		if (size == 0)
+			return null;
+
+		// Find the first node which is a child of this node.
+		for (int nX = 0; nX < size; nX ++) {
+			Node node = nodes.item(nX);
+			if (node instanceof Element) {
+				Element element2 = (Element)node;
+				if (element2.getNodeName().equals(type))
+					return new XMLMemento(factory, element2);
+			}
+		}
+
+		// A child was not found.
+		return null;
+	}
+
+	/*
+	 * @see IMemento
+	 */
+	public IMemento [] getChildren(String type) {
+		// Get the nodes.
+		NodeList nodes = element.getChildNodes();
+		int size = nodes.getLength();
+		if (size == 0)
+			return new IMemento[0];
+
+		// Extract each node with given type.
+		List<Element> list = new ArrayList<Element>(size);
+		for (int nX = 0; nX < size; nX ++) {
+			Node node = nodes.item(nX);
+			if (node instanceof Element) {
+				Element element2 = (Element)node;
+				if (element2.getNodeName().equals(type))
+					list.add(element2);
+			}
+		}
+
+		// Create a memento for each node.
+		size = list.size();
+		IMemento [] results = new IMemento[size];
+		for (int x = 0; x < size; x ++) {
+			results[x] = new XMLMemento(factory, list.get(x));
+		}
+		return results;
+	}
+	
+	public String[] getChildNames() {
+		// Get the nodes.
+		NodeList nodes = element.getChildNodes();
+		int size = nodes.getLength();
+		if (size == 0)
+			return new String[0];
+
+		// Extract each node with given type.
+		List<String> list = new ArrayList<String>();
+		for (int nX = 0; nX < size; nX ++) {
+			Node node = nodes.item(nX);
+			if (node instanceof Element) {
+				Element element2 = (Element)node;
+				if (!list.contains(element2.getNodeName()))
+					list.add(element2.getNodeName());
+			}
+		}
+		return (String[]) list.toArray(new String[list.size()]);
+	}
+
+	/**
+	 * Return the contents of this memento as a byte array.
+	 *
+	 * @return byte[]
+	 * @throws IOException if anything goes wrong
+	 */
+	public byte[] getContents() throws IOException {
+		ByteArrayOutputStream out = new ByteArrayOutputStream();
+		save(out);
+		return out.toByteArray();
+	}
+
+	/**
+	 * Returns an input stream for writing to the disk with a local locale.
+	 *
+	 * @return java.io.InputStream
+	 * @throws IOException if anything goes wrong
+	 */
+	public InputStream getInputStream() throws IOException {
+		ByteArrayOutputStream out = new ByteArrayOutputStream();
+		save(out);
+		return new ByteArrayInputStream(out.toByteArray());
+	}
+
+	/*
+	 * @see IMemento
+	 */
+	public Float getFloat(String key) {
+		Attr attr = element.getAttributeNode(key);
+		if (attr == null)
+			return null;
+		String strValue = attr.getValue();
+		try {
+			return new Float(strValue);
+		} catch (NumberFormatException e) {
+			return null;
+		}
+	}
+
+	/*
+	 * @see IMemento
+	 */
+	public Integer getInteger(String key) {
+		Attr attr = element.getAttributeNode(key);
+		if (attr == null)
+			return null;
+		String strValue = attr.getValue();
+		try {
+			return new Integer(strValue);
+		} catch (NumberFormatException e) {
+			return null;
+		}
+	}
+
+	/*
+	 * @see IMemento
+	 */
+	public String getString(String key) {
+		Attr attr = element.getAttributeNode(key);
+		if (attr == null)
+			return null;
+		return attr.getValue();
+	}
+
+	public List<String> getNames() {
+		NamedNodeMap map = element.getAttributes();
+		int size = map.getLength();
+		List<String> list = new ArrayList<String>();
+		for (int i = 0; i < size; i++) {
+			Node node = map.item(i);
+			String name = node.getNodeName();
+			list.add(name);
+		}
+		return list;
+	}
+
+	/**
+	 * Loads a memento from the given filename.
+	 *
+	 * @param in java.io.InputStream
+	 * @return org.eclipse.ui.IMemento
+	 */
+	public static IMemento loadMemento(InputStream in) {
+		return createReadRoot(in);
+	}
+
+	/**
+	 * Loads a memento from the given filename.
+	 *
+	 * @param filename java.lang.String
+	 * @return org.eclipse.ui.IMemento
+	 * @exception java.io.IOException
+	 */
+	public static IMemento loadMemento(String filename) throws IOException {
+		InputStream in = null;
+		try {
+			in = new BufferedInputStream(new FileInputStream(filename));
+			return XMLMemento.createReadRoot(in);
+		} finally {
+			try {
+				if (in != null)
+					in.close();
+			} catch (Exception e) {
+				// ignore
+			}
+		}
+	}
+
+	/*
+	 * @see IMemento
+	 */
+	public void putInteger(String key, int n) {
+		element.setAttribute(key, String.valueOf(n));
+	}
+
+	/*
+	 * @see IMemento
+	 */
+	public void putString(String key, String value) {
+		if (value == null)
+			return;
+		element.setAttribute(key, value);
+	}
+
+	/**
+	 * Save this Memento to a Writer.
+	 *
+	 * @throws IOException if there is a problem saving
+	 */
+	public void save(OutputStream os) throws IOException {
+		Result result = new StreamResult(os);
+		Source source = new DOMSource(factory);
+		try {
+			Transformer transformer = TransformerFactory.newInstance().newTransformer();
+			transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
+			transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
+			transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); //$NON-NLS-1$
+			transformer.setOutputProperty("{http://xml.apache.org/xalan}indent-amount", "2"); //$NON-NLS-1$ //$NON-NLS-2$
+			transformer.transform(source, result);
+		} catch (Exception e) {
+			throw (IOException) (new IOException().initCause(e));
+		}
+	}
+
+	/**
+	 * Saves the memento to the given file.
+	 *
+	 * @param filename java.lang.String
+	 * @exception java.io.IOException
+	 */
+	public void saveToFile(String filename) throws IOException {
+		BufferedOutputStream w = null;
+		try {
+			w = new BufferedOutputStream(new FileOutputStream(filename));
+			save(w);
+		} catch (IOException e) {
+			throw e;
+		} catch (Exception e) {
+			throw new IOException(e.getLocalizedMessage());
+		} finally {
+			if (w != null) {
+				try {
+					w.close();
+				} catch (Exception e) {
+					// ignore
+				}
+			}
+		}
+	}
+
+	public String saveToString() throws IOException {
+		ByteArrayOutputStream out = new ByteArrayOutputStream();
+		save(out);
+		return out.toString("UTF-8"); //$NON-NLS-1$
+	}
+
+	/*
+	 * @see IMemento#getBoolean(String)
+	 */
+	public Boolean getBoolean(String key) {
+		Attr attr = element.getAttributeNode(key);
+		if (attr == null)
+			return null;
+		String strValue = attr.getValue();
+		if ("true".equalsIgnoreCase(strValue)) //$NON-NLS-1$
+			return new Boolean(true);
+		return new Boolean(false);
+	}
+
+	/*
+	 * @see IMemento#putBoolean(String, boolean)
+	 */
+	public void putBoolean(String key, boolean value) {
+		element.setAttribute(key, new Boolean(value).toString());
+	}
+
+	/**
+    * Returns the Text node of the memento. Each memento is allowed only
+    * one Text node.
+    *
+    * @return the Text node of the memento, or <code>null</code> if
+    * the memento has no Text node.
+    */
+   public Text getTextNode() {
+       // Get the nodes.
+       NodeList nodes = element.getChildNodes();
+       int size = nodes.getLength();
+       if (size == 0) {
+			return null;
+		}
+       for (int nX = 0; nX < size; nX++) {
+           Node node = nodes.item(nX);
+           if (node instanceof Text) {
+               return (Text) node;
+           }
+       }
+       // a Text node was not found
+       return null;
+   }
+
+	/* (non-Javadoc)
+    */
+   public void putTextData(String data) {
+       Text textNode = getTextNode();
+       if (textNode == null) {
+           textNode = factory.createTextNode(data);
+			// Always add the text node as the first child (fixes bug 93718)
+			element.insertBefore(textNode, element.getFirstChild());
+       } else {
+           textNode.setData(data);
+       }
+   }
+   
+   public String getTextData() {
+       Text textNode = getTextNode();
+       if (textNode != null) {
+           return textNode.getData();
+       }
+       return ""; //$NON-NLS-1$
+   }
+}
\ No newline at end of file
Index: org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XMLBinding.java
===================================================================
--- org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XMLBinding.java	(revision 42480)
+++ org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XMLBinding.java	(working copy)
@@ -10,84 +10,189 @@
  ******************************************************************************/
 package org.jboss.ide.eclipse.archives.core.model.internal.xb;
 
-import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.InputStreamReader;
 import java.io.OutputStreamWriter;
 import java.io.StringWriter;
 import java.io.Writer;
-import java.net.URL;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
 
-import javax.xml.parsers.ParserConfigurationException;
-
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.jboss.ide.eclipse.archives.core.ArchivesCore;
 import org.jboss.ide.eclipse.archives.core.model.IArchive;
-import org.jboss.ide.eclipse.archives.core.model.IArchivesLogger;
 import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveImpl;
-import org.jboss.xb.binding.JBossXBException;
-import org.jboss.xb.binding.JBossXBRuntimeException;
-import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
-import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder;
-import org.xml.sax.SAXException;
 
+
 /**
  * This class is responsible for binding some xml file to it's proper
  * objects. In short, it marshalls and unmarshalls the data.
  * @author Marshall
  * @author Rob Stryker
  */
-public class XMLBinding {
+public class XMLBinding {	
+	
+	public static class XbException extends Exception {
+		private Exception parent;
+		public XbException(Exception e) {
+			super();
+			parent = e;
+		}
+		public Exception getException() {
+			return parent;
+		}
+		public String getMessage() {
+			return parent.getCause() == null ? parent.getMessage() : parent.getCause().getMessage();
+		}
+		public Throwable getCause() {
+			return parent;
+		}
+	}
+	
+ 	public static String serializePackages(XbPackages packages, IProgressMonitor monitor) throws XbException {
+ 		try {
+ 			StringWriter sw = new StringWriter();
+			XMLBinding.marshall(packages, sw, monitor);
+ 			return new String(sw.toString());
+ 		} catch( Exception e ) {
+ 			throw new XbException(e);
+ 		}
+ 	}
+	public static void marshallToFile(XbPackages element, IPath filePath, IProgressMonitor monitor) throws XbException {
+		OutputStreamWriter writer = null;
+		try {
+			writer = new OutputStreamWriter(new FileOutputStream(filePath.toFile()));
+			XMLBinding.marshall(element, writer, monitor);
+		} catch( XbException xbe ) {
+			throw xbe;
+		} catch( IOException ioe ) {
+			throw new XbException(ioe);
+		}
+		finally {
+			try {
+				if( writer != null ) writer.close();
+			} catch( IOException ioe) {}
+		}
+	}
 
-	public static final int NUM_UNMARSHAL_MONITOR_STEPS = 3;
-	public static final int NUM_MARSHALL_MONITOR_STEPS = 2;
+	public static String marshall(IArchive topLevelArchive, IProgressMonitor monitor ) throws XbException {
+		if( topLevelArchive.isTopLevel() && topLevelArchive instanceof ArchiveImpl ) {
+			XbPackages packs = (XbPackages)((ArchiveImpl)topLevelArchive).getNodeDelegate().getParent();
+			StringWriter sw = new StringWriter();
+			marshall(packs, sw, monitor);
+			return sw.toString();
+		}
+		return null;
+	}
 
-	private static URL schema = XMLBinding.class.getClassLoader().getResource("packages.xsd"); //$NON-NLS-1$
-	private static URL log4jxml = XMLBinding.class.getClassLoader().getResource("log4j.xml"); //$NON-NLS-1$
-	private static SchemaBinding binding;
+	public static void marshall (final XbPackages element, final Writer writer,
+			final IProgressMonitor monitor) throws XbException {
+		XMLMemento root = XMLMemento.createWriteRoot("packages"); //$NON-NLS-1$
+		if( element.getVersion() > 0 ) 
+			root.putString("version", new Double(element.getVersion()).toString()); //$NON-NLS-1$
+		List packagesToAdd = element.getChildren(XbPackage.class);
+		List props = element.getChildren(XbProperties.class);
+		marshallAddPackages(root, nullSafe(packagesToAdd));
+		marshallAddProperties(root, nullSafe(props));
+		try{
+			String s = root.saveToString();
+			writer.write(s);
+		} catch(IOException ioe) {
+			throw new XbException(ioe);
+		}
+	}
+	private static List nullSafe(List list) {
+		return list == null ? new ArrayList() : list;
+	}
+	private static boolean isEmpty(String s) {
+		return s != null && !"".equals(s); //$NON-NLS-1$
+	}
+	private static void marshallAddPackages(XMLMemento memento, List packages) {
+		Iterator i = packages.iterator();
+		while(i.hasNext()) {
+			XMLMemento childMemento = (XMLMemento)memento.createChild("package"); //$NON-NLS-1$
+			XbPackage childXb = (XbPackage)i.next();
+			childMemento.putString("name", childXb.getName()); //$NON-NLS-1$
+			if( !isEmpty(childXb.getPackageType()) )
+				childMemento.putString("type", childXb.getPackageType()); //$NON-NLS-1$
+			if( !isEmpty( childXb.getToDir()) )
+				childMemento.putString("todir", childXb.getToDir()); //$NON-NLS-1$
+			if( !isEmpty(childXb.getId() ) )
+				childMemento.putString("id", childXb.getId()); //$NON-NLS-1$
+			childMemento.putString("exploded", new Boolean(childXb.isExploded()).toString()); //$NON-NLS-1$
+			childMemento.putString("inWorkspace", new Boolean(childXb.isInWorkspace()).toString()); //$NON-NLS-1$
 
-	private static boolean initialized = false;
+			// Add children
+			marshallAddPackages(childMemento, nullSafe(childXb.getChildren(XbPackage.class)));
+			addFileset(childMemento, nullSafe(childXb.getChildren(XbFileSet.class)));
+			addLibFileset(childMemento, nullSafe(childXb.getChildren(XbLibFileSet.class)));
+			addFolders(childMemento, nullSafe(childXb.getChildren(XbFolder.class)));
+			marshallAddProperties(childMemento, nullSafe(childXb.getChildren(XbProperties.class)));
+		}
+	}
 
-	static {
-		System.setProperty("log4j.configuration", log4jxml.toString()); //$NON-NLS-1$
+	private static void addFolders(XMLMemento memento, List folders) {
+		Iterator i = folders.iterator();
+		while(i.hasNext()) {
+			XMLMemento childMemento = (XMLMemento)memento.createChild("folder"); //$NON-NLS-1$
+			XbFolder childXb = (XbFolder)i.next();
+			if( childXb.getName() != null )
+				childMemento.putString("name", childXb.getName()); //$NON-NLS-1$
+
+			// Add children
+			marshallAddPackages(childMemento, nullSafe(childXb.getChildren(XbPackage.class)));
+			addFileset(childMemento, nullSafe(childXb.getChildren(XbFileSet.class)));
+			addLibFileset(childMemento, nullSafe(childXb.getChildren(XbLibFileSet.class)));
+			addFolders(childMemento, nullSafe(childXb.getChildren(XbFolder.class)));
+			marshallAddProperties(childMemento, nullSafe(childXb.getChildren(XbProperties.class)));
+		}
 	}
 
-	public static void init ()
-	{
-		try {
-			InputStream stream = schema.openStream();
-			binding = XsdBinder.bind(stream, "UTF-8", (String)null); //$NON-NLS-1$
-			stream.close();
-			initialized = true;
-		} catch (IOException e) {
-			ArchivesCore.getInstance().getLogger().log(IStatus.ERROR, e.getMessage(), e);
+	private static void addFileset(XMLMemento memento, List xbList) {
+		Iterator i = xbList.iterator();
+		while(i.hasNext()) {
+			XMLMemento fsMemento = (XMLMemento)memento.createChild("fileset"); //$NON-NLS-1$
+			XbFileSet fsXb = (XbFileSet)i.next();
+			fsMemento.putString("dir", fsXb.getDir()); //$NON-NLS-1$
+			fsMemento.putString("includes", fsXb.getIncludes()); //$NON-NLS-1$
+			if( !isEmpty(fsXb.getExcludes()))
+				fsMemento.putString("excludes", fsXb.getExcludes()); //$NON-NLS-1$
+			fsMemento.putString("inWorkspace",new Boolean(fsXb.isInWorkspace()).toString()); //$NON-NLS-1$ 
+			fsMemento.putString("flatten", new Boolean(fsXb.isFlatten()).toString()); //$NON-NLS-1$
+			marshallAddProperties(fsMemento, nullSafe(fsXb.getChildren(XbProperties.class)));
 		}
 	}
 
-	private static void binderSandbox (XbRunnable runnable) throws XbException {
-		ClassLoader original = Thread.currentThread().getContextClassLoader();
-		ClassLoader myCL = XMLBinding.class.getClassLoader();
-		Thread.currentThread().setContextClassLoader(myCL);
-		XbException e = null;
-		try {
-			runnable.run();
-		} catch( XbException ex ) {
-			e = ex;
+	private static void addLibFileset(XMLMemento memento, List xbList) {
+		Iterator i = xbList.iterator();
+		while(i.hasNext()) {
+			XMLMemento fsMemento = (XMLMemento)memento.createChild("lib-fileset"); //$NON-NLS-1$
+			XbLibFileSet fsXb = (XbLibFileSet)i.next();
+			if( !isEmpty(fsXb.getId()))
+				fsMemento.putString("name", fsXb.getId()); //$NON-NLS-1$
+			marshallAddProperties(fsMemento, nullSafe(fsXb.getChildren(XbProperties.class)));
 		}
-		Thread.currentThread().setContextClassLoader(original);
-		if( e != null )
-			throw e;
 	}
 
-	public static XbPackages unmarshal( String input, IProgressMonitor monitor ) throws XbException {
-		return unmarshal(new ByteArrayInputStream(input.getBytes()), monitor);
+	private static void marshallAddProperties(XMLMemento memento, List properties) {
+		Iterator i = properties.iterator();
+		while(i.hasNext()) {
+			XMLMemento props = (XMLMemento)memento.createChild("properties"); //$NON-NLS-1$
+			XbProperties propsObj = (XbProperties)i.next();
+			List indivProps = propsObj.getAllChildren();
+			Iterator j = indivProps.iterator();
+			while(j.hasNext()) {
+				XbProperty prop = (XbProperty)j.next();
+				XMLMemento propMemento = (XMLMemento) props.createChild("property"); //$NON-NLS-1$
+				propMemento.putString("name", prop.getName()); //$NON-NLS-1$
+				propMemento.putString("value", prop.getValue()); //$NON-NLS-1$
+			}
+		}
 	}
 
 	public static XbPackages unmarshal(File file, IProgressMonitor monitor) throws XbException {
@@ -102,127 +207,151 @@
 	}
 
 	protected static XbPackages unmarshal (final InputStream in,
-				final IProgressMonitor monitor) throws XbException {
-		if( !initialized) init();
-		final XbPackages[] element = new XbPackages[1];
-		element[0] = null;
-		XbRunnable runnable = new XbRunnable() {
-			public void run () throws XbException {
-				try {
-					ArchivesUnmarshallerImpl unmarshaller = new ArchivesUnmarshallerImpl();
-					monitor.worked(1);
-					binding.setStrictSchema(true);
-					unmarshaller.setValidation(true);
-					unmarshaller.getParser().setFeature("http://apache.org/xml/features/validation/schema", true); //$NON-NLS-1$
-					unmarshaller.getParser().setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation", schema.toExternalForm()); //$NON-NLS-1$
-					Object xmlObject = unmarshaller.unmarshal(in, binding);
-					monitor.worked(1);
+			final IProgressMonitor monitor) throws XbException {
+		XMLMemento root = XMLMemento.createReadRoot(in);
+		String versionString = root.getString("version"); //$NON-NLS-1$
+		System.out.println("unmarshalling: " + versionString); //$NON-NLS-1$
+		XbPackages packs = new XbPackages();
+		packs.setVersion(Double.parseDouble(versionString));
 
-					element[0] = (XbPackages) xmlObject;
-					monitor.worked(1);
+		IMemento[] packageChildren = root.getChildren("package"); //$NON-NLS-1$
+		unmarshallPackageList(packs, packageChildren);
+		IMemento[] propertiesChild = root.getChildren("properties"); //$NON-NLS-1$
+		if( propertiesChild != null && propertiesChild.length == 1)
+			unmarshallProperties(packs, propertiesChild[0]);
+		return packs;
+	}
 
-				} catch (JBossXBException e) {
-					throw new XbException(e);
-				}
-			}
-		};
+	private static void unmarshallPackageList(XbPackageNodeWithProperties packs, IMemento[] packageChildren) {
+		for( int i = 0; i < packageChildren.length; i++ ) {
+			XbPackage pack = new XbPackage();
+			// name, type, toDir, exploded, inWorkspace, id
+			String name = packageChildren[i].getString("name"); //$NON-NLS-1$
+			String type = packageChildren[i].getString("type"); //$NON-NLS-1$
+			String toDir = packageChildren[i].getString("toDir"); //$NON-NLS-1$
+			String id = packageChildren[i].getString("id"); //$NON-NLS-1$
+			String exploded = packageChildren[i].getString("exploded"); //$NON-NLS-1$
+			String inWorkspace = packageChildren[i].getString("inWorkspace"); //$NON-NLS-1$
+			String exploded2 = exploded == null ? "" : exploded; //$NON-NLS-1$
+			String inWorkspace2 = inWorkspace == null ? "" : inWorkspace; //$NON-NLS-1$
+			boolean explodedValid = ("true".equals(exploded2.toLowerCase()) || "false".equals(exploded2.toLowerCase())); //$NON-NLS-1$ //$NON-NLS-2$
+			boolean inWorkspaceValid = ("true".equals(inWorkspace2.toLowerCase()) || "false".equals(inWorkspace2.toLowerCase())); //$NON-NLS-1$ //$NON-NLS-2$
+			boolean bExploded = explodedValid ? Boolean.parseBoolean(exploded) : false;
+			boolean bInWorkspace = inWorkspaceValid ? Boolean.parseBoolean(inWorkspace) : true;
+			pack.setName(name);
+			pack.setPackageType(type);
+			pack.setToDir(toDir);
+			pack.setId(id);
+			pack.setExploded(bExploded);
+			pack.setInWorkspace(bInWorkspace);
+			// package
+			IMemento[] inner = packageChildren[i].getChildren("package"); //$NON-NLS-1$
+			if( inner != null && inner.length == 1)
+				unmarshallPackageList(pack, inner);
 
-		binderSandbox(runnable);
-		return element[0];
-	}
+			// fileset
+			IMemento[] fsets = packageChildren[i].getChildren("fileset"); //$NON-NLS-1$
+			if( fsets != null && fsets.length == 1)
+				unmarshallFilesets(pack, fsets);
 
-	public static String marshall(IArchive topLevelArchive, IProgressMonitor monitor ) throws XbException {
-		if( topLevelArchive.isTopLevel() && topLevelArchive instanceof ArchiveImpl ) {
-			XbPackages packs = (XbPackages)((ArchiveImpl)topLevelArchive).getNodeDelegate().getParent();
-			StringWriter sw = new StringWriter();
-			marshall(packs, sw, monitor);
-			return sw.toString();
-		}
-		return null;
-	}
+			// lib-fileset
+			IMemento[] libfsets = packageChildren[i].getChildren("lib-fileset"); //$NON-NLS-1$
+			if( libfsets != null && libfsets.length == 1)
+				unmarshallLibFilesets(pack, libfsets);
 
-	public static void marshallToFile(XbPackages element, IPath filePath, IProgressMonitor monitor) throws XbException {
-		OutputStreamWriter writer = null;
-		try {
-			writer = new OutputStreamWriter(new FileOutputStream(filePath.toFile()));
-			XMLBinding.marshall(element, writer, monitor);
-		} catch( XbException xbe ) {
-			throw xbe;
-		} catch( IOException ioe ) {
-			throw new XbException(ioe);
+			// folder
+			IMemento[] folders = packageChildren[i].getChildren("folder"); //$NON-NLS-1$
+			if( folders != null && folders.length == 1)
+				unmarshallFolders(pack, folders);
+
+			// properties
+			IMemento[] propertiesChild = packageChildren[i].getChildren("properties"); //$NON-NLS-1$
+			if( propertiesChild != null && propertiesChild.length == 1)
+				unmarshallProperties(packs, propertiesChild[0]);
+
+			packs.addChild(pack);
 		}
-		finally {
-			try {
-				if( writer != null ) writer.close();
-			} catch( IOException ioe) {}
-		}
 	}
+	private static void unmarshallFolders(XbPackageNodeWithProperties node, IMemento[] folders) {
+		for( int i = 0; i < folders.length; i++ ) {
+			XbFolder folder = new XbFolder();
+			// name, type, toDir, exploded, inWorkspace, id
+			String name = folders[i].getString("name"); //$NON-NLS-1$
+			folder.setName(name);
 
-	public static void marshall (final XbPackages element, final Writer writer,
-			final IProgressMonitor monitor) throws XbException {
-		if( !initialized) init();
-		binderSandbox(new XbRunnable() {
-			public void run () throws XbException {
-				Exception f = null;
-				InputStream stream = null;
-				try {
-					stream = schema.openStream();
-					monitor.worked(1);
+			// package
+			IMemento[] inner = folders[i].getChildren("package"); //$NON-NLS-1$
+			if( inner != null && inner.length == 1)
+				unmarshallPackageList(folder, inner);
 
-					StrictXercesXSMarshaller marshaller = new StrictXercesXSMarshaller();
-					marshaller.marshal(new InputStreamReader(stream), new XbPackagesObjectProvider(), element, writer);
-					monitor.worked(1);
-				} catch (IOException e) {
-					f = e;
-				} catch (SAXException e) {
-					f = e;
-				} catch (ParserConfigurationException e) {
-					f = e;
-				} catch (JBossXBRuntimeException e ) {
-					f = e;
-				} finally {
-					if( stream != null ) {
-						try {
-							stream.close();
-						} catch(IOException ioe) {}
-					}
-				}
-				if( f != null ) {
-					throw new XbException(f);
-				}
-			}
-		});
-	}
+			// fileset
+			IMemento[] fsets = folders[i].getChildren("fileset"); //$NON-NLS-1$
+			if( fsets != null && fsets.length == 1)
+				unmarshallFilesets(folder, fsets);
 
-	public static String serializePackages(XbPackages packages, IProgressMonitor monitor) throws XbException {
-		try {
-			StringWriter sw = new StringWriter();
-			XMLBinding.marshall(packages, sw, monitor);
-			return new String(sw.toString());
-		} catch( Exception e ) {
-			throw new XbException(e);
-		}
-	}
+			// lib-fileset
+			IMemento[] libfsets = folders[i].getChildren("lib-fileset"); //$NON-NLS-1$
+			if( libfsets != null && libfsets.length == 1)
+				unmarshallLibFilesets(folder, libfsets);
 
+			// folder
+			IMemento[] folders2 = folders[i].getChildren("folder"); //$NON-NLS-1$
+			if( folders2 != null && folders2.length == 1)
+				unmarshallFolders(folder, folders2);
 
-	public static interface XbRunnable {
-		public void run() throws XbException;
+			// properties
+			IMemento[] propertiesChild = folders[i].getChildren("properties"); //$NON-NLS-1$
+			if( propertiesChild != null && propertiesChild.length == 1)
+				unmarshallProperties(folder, propertiesChild[0]);
+
+			node.addChild(folder);
+		}
 	}
+	private static void unmarshallFilesets(XbPackageNodeWithProperties node, IMemento[] fs) {
+		for( int i = 0; i < fs.length; i++ ) {
+			XbFileSet fileset = new XbFileSet();
+			// name, type, toDir, exploded, inWorkspace, id
+			String dir = fs[i].getString("dir"); //$NON-NLS-1$
+			String inc = fs[i].getString("includes"); //$NON-NLS-1$
+			String exc = fs[i].getString("excludes"); //$NON-NLS-1$
+			String inWorkspace = fs[i].getString("inWorkspace"); //$NON-NLS-1$
+			String inWorkspace2 = inWorkspace == null ? "" : inWorkspace; //$NON-NLS-1$
+			String flatten = fs[i].getString("exploded"); //$NON-NLS-1$
+			String flatten2 = flatten == null ? "" : flatten; //$NON-NLS-1$
+			boolean explodedValid = ("true".equals(flatten2.toLowerCase()) || "false".equals(flatten2.toLowerCase())); //$NON-NLS-1$ //$NON-NLS-2$
+			boolean inWorkspaceValid = ("true".equals(inWorkspace2.toLowerCase()) || "false".equals(inWorkspace2.toLowerCase())); //$NON-NLS-1$ //$NON-NLS-2$
+			boolean bFlat = explodedValid ? Boolean.parseBoolean(flatten) : false;
+			boolean bInWorkspace = inWorkspaceValid ? Boolean.parseBoolean(inWorkspace) : true;
+			fileset.setDir(dir);
+			fileset.setIncludes(inc);
+			if( exc != null && !"".equals(exc)) //$NON-NLS-1$
+				fileset.setExcludes(exc);
+			fileset.setInWorkspace(bInWorkspace);
+			fileset.setFlatten(bFlat);
 
-	public static class XbException extends Exception {
-		private Exception parent;
-		public XbException(Exception e) {
-			super();
-			parent = e;
+			node.addChild(fileset);
 		}
-		public Exception getException() {
-			return parent;
+	}
+	private static void unmarshallLibFilesets(XbPackageNodeWithProperties node, IMemento[] fs) {
+		for( int i = 0; i < fs.length; i++ ) {
+			XbLibFileSet fileset = new XbLibFileSet();
+			String id = fs[i].getString("id"); //$NON-NLS-1$
+			fileset.setId(id);
+			node.addChild(fileset);
 		}
-		public String getMessage() {
-			return parent.getCause() == null ? parent.getMessage() : parent.getCause().getMessage();
+
+	}
+	private static void unmarshallProperties(XbPackageNodeWithProperties node, IMemento propNode) {
+		XbProperties propsWrapper = new XbProperties();
+		node.addChild(propsWrapper);
+		IMemento[] allProps = propNode.getChildren("property"); //$NON-NLS-1$
+		for( int i = 0; i < allProps.length; i++ ) {
+			XbProperty p = new XbProperty();
+			String name = allProps[i].getString("name"); //$NON-NLS-1$
+			String val = allProps[i].getString("value"); //$NON-NLS-1$
+			p.setName(name);
+			p.setValue(val);
+			propsWrapper.addChild(p);
 		}
-		public Throwable getCause() {
-			return parent;
-		}
 	}
 }
Index: org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveModelNode.java
===================================================================
--- org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveModelNode.java	(revision 42480)
+++ org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveModelNode.java	(working copy)
@@ -23,8 +23,8 @@
 import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
 import org.jboss.ide.eclipse.archives.core.model.IArchiveNodeDelta;
 import org.jboss.ide.eclipse.archives.core.model.internal.xb.XMLBinding;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XMLBinding.XbException;
 import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackages;
-import org.jboss.ide.eclipse.archives.core.model.internal.xb.XMLBinding.XbException;
 
 /**
  * 
Index: org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java
===================================================================
--- org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java	(revision 42480)
+++ org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java	(working copy)
@@ -201,6 +201,8 @@
 	}
 
 	public static void fillArchiveModel( XbPackages node, IArchiveModelRootNode modelNode) throws ArchivesModelException {
+		if( node == null )
+			return;
 		for (Iterator iter = node.getAllChildren().iterator(); iter.hasNext(); ) {
 			XbPackageNode child = (XbPackageNode) iter.next();
 			ArchiveNodeImpl childImpl = (ArchiveNodeImpl)createPackageNodeImpl(child, modelNode);
Index: org.jboss.ide.eclipse.archives.core/src/xml/packages.xsd
===================================================================
--- org.jboss.ide.eclipse.archives.core/src/xml/packages.xsd	(revision 42480)
+++ org.jboss.ide.eclipse.archives.core/src/xml/packages.xsd	(working copy)
@@ -139,6 +139,7 @@
         <xsd:sequence>
             <xsd:element maxOccurs="unbounded" minOccurs="0" name="package" type="package-type"/>
             <xsd:element maxOccurs="unbounded" minOccurs="0" name="fileset" type="fileset-type"/>
+            <xsd:element maxOccurs="unbounded" minOccurs="0" name="lib-fileset" type="lib-fileset-type"/>
             <xsd:element maxOccurs="unbounded" minOccurs="0" name="folder" type="folder-type"/>
             <xsd:element maxOccurs="1" minOccurs="0" name="properties" type="properties-type"/>
         </xsd:sequence>
Index: org.jboss.ide.eclipse.archives.core/META-INF/MANIFEST.MF
===================================================================
--- org.jboss.ide.eclipse.archives.core/META-INF/MANIFEST.MF	(revision 42480)
+++ org.jboss.ide.eclipse.archives.core/META-INF/MANIFEST.MF	(working copy)
@@ -12,17 +12,12 @@
  org.eclipse.core.resources;bundle-version="3.7.100",
  org.eclipse.core.runtime;bundle-version="3.7.0",
  org.eclipse.core.variables;bundle-version="3.2.500",
- org.jboss.tools.usage;resolution:=optional;x-installation:=greedy
+ org.jboss.tools.usage;resolution:=optional;x-installation:=greedy,
+ org.apache.xerces;bundle-version="2.9.0"
 Bundle-ActivationPolicy: lazy
 Eclipse-BundleShape: dir
 Bundle-ClassPath: archivescore.jar,
  archivescore-eclipse.jar,
- lib/concurrent-1.3.4.jar,
- lib/jboss-xml-binding.jar,
- lib/xercesImpl-2.9.1.jar,
- lib/jboss-common-logging-log4j-2.0.4.GA.jar,
- lib/jboss-common-logging-spi-2.0.4.GA.jar,
- lib/jboss-common-core-2.2.1.GA.jar,
  lib/truezip-6.6.jar
 Export-Package: de.schlichtherle.io;x-friends:="org.jboss.ide.eclipse.archives.test",
  de.schlichtherle.io.archive.spi,
Index: org.jboss.ide.eclipse.archives.core/build.properties
===================================================================
--- org.jboss.ide.eclipse.archives.core/build.properties	(revision 42480)
+++ org.jboss.ide.eclipse.archives.core/build.properties	(working copy)
@@ -5,12 +5,6 @@
                LICENSE-truezip.txt,\
                log4j.xml,\
                archivescore-eclipse.jar,\
-               lib/jboss-xml-binding.jar,\
-               lib/concurrent-1.3.4.jar,\
-               lib/xercesImpl-2.9.1.jar,\
-               lib/jboss-common-logging-log4j-2.0.4.GA.jar,\
-               lib/jboss-common-logging-spi-2.0.4.GA.jar,\
-               lib/jboss-common-core-2.2.1.GA.jar,\
                lib/truezip-6.6.jar,\
                plugin.properties,\
                about.html
Index: org.jboss.ide.eclipse.archives.core/.classpath
===================================================================
--- org.jboss.ide.eclipse.archives.core/.classpath	(revision 42480)
+++ org.jboss.ide.eclipse.archives.core/.classpath	(working copy)
@@ -5,12 +5,6 @@
 	<classpathentry kind="src" path="src/main"/>
 	<classpathentry kind="src" path="src/xml"/>
 	<classpathentry kind="src" path="src/eclipse"/>
-	<classpathentry exported="true" kind="lib" path="lib/concurrent-1.3.4.jar"/>
-	<classpathentry exported="true" kind="lib" path="lib/jboss-xml-binding.jar" sourcepath="/home/rob/code/xb/target/jboss-xml-binding-sources.jar"/>
-	<classpathentry exported="true" kind="lib" path="lib/xercesImpl-2.9.1.jar"/>
-	<classpathentry exported="true" kind="lib" path="lib/jboss-common-logging-log4j-2.0.4.GA.jar"/>
-	<classpathentry exported="true" kind="lib" path="lib/jboss-common-logging-spi-2.0.4.GA.jar"/>
-	<classpathentry exported="true" kind="lib" path="lib/jboss-common-core-2.2.1.GA.jar"/>
 	<classpathentry exported="true" kind="lib" path="lib/truezip-6.6.jar" sourcepath="/home/rob/code/truezip/truezip/src"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>
