src/org/ohmage/domain/campaign/Campaign.java
public static Map<String, String> validateXml(
			final String xml) 
			throws DomainException {
		
		Document document;
		try {
			document = (new Builder()).build(new StringReader(xml));
		} 
		catch(IOException e) {
			// This should only be thrown if it can't read the 'xml', but
			// given that it is already in memory this should never happen.
			throw new DomainException("XML was unreadable.", e);
		}
		catch(XMLException e) {
			throw new DomainException("No usable XML parser could be found.", e);
		}
		catch(ValidityException e) {
			throw new DomainException("The XML is invalid.", e);
		}
		catch(ParsingException e) {
			throw new DomainException("The XML is not well formed.", e);
		}
		
		Element root = document.getRootElement();
		
		String id = getId(root, null);
		String name = getName(root, null);
		getIconUrl(root);
		getAuthoredBy(root);
		getSurveys(root);
		
		Map<String, String> result = new HashMap<String, String>();
		result.put(id, name);
		return result;
	}
/**
	 * Validates that some XML contains all required components of an ohmage
	 * XML document and that all values, even optional ones that are given, are
	 * valid values.
	 * 
	 * @param xml The XML as a String.
	 * 
	 * @return Returns a map with one key (the ID) and one value (the name).
	 * 
	 * @throws DomainException Thrown if the XML is not valid.
	 */
Validates that some XML contains all required components of an ohmage
XML document and that all values, even optional ones that are given, are
valid values.

@param xml The XML as a String.

@return Returns a map with one key (the ID) and one value (the name).

@throws DomainException Thrown if the XML is not valid.
Validates that some XML contains all required components of an ohmage XML document and that all values even optional ones that are given are valid values . @param xml The XML as a String . @return Returns a map with one key ( the ID ) and one value ( the name ) . @throws DomainException Thrown if the XML is not valid .
public static Map<String, String> validateXml(
			final String xml) 
			throws DomainException {
		Document document;
		try {
			document = (new Builder()).build(new StringReader(xml));
		} 
		catch(IOException e) {
			throw new DomainException("XML was unreadable.", e);
		}
		catch(XMLException e) {
			throw new DomainException("No usable XML parser could be found.", e);
		}
		catch(ValidityException e) {
			throw new DomainException("The XML is invalid.", e);
		}
		catch(ParsingException e) {
			throw new DomainException("The XML is not well formed.", e);
		}
		Element root = document.getRootElement();
		String id = getId(root, null);
		String name = getName(root, null);
		getIconUrl(root);
		getAuthoredBy(root);
		getSurveys(root);
		Map<String, String> result = new HashMap<String, String>();
		result.put(id, name);
		return result;
	}
public static Map < String , String > validateXml ( final String xml ) throws DomainException { Document document ; try { document = ( new Builder ( ) ) . build ( new StringReader ( xml ) ) ; } catch ( IOException e ) { throw new DomainException ( "XML was unreadable." , e ) ; } catch ( XMLException e ) { throw new DomainException ( "No usable XML parser could be found." , e ) ; } catch ( ValidityException e ) { throw new DomainException ( "The XML is invalid." , e ) ; } catch ( ParsingException e ) { throw new DomainException ( "The XML is not well formed." , e ) ; } Element root = document . getRootElement ( ) ; String id = getId ( root , null ) ; String name = getName ( root , null ) ; getIconUrl ( root ) ; getAuthoredBy ( root ) ; getSurveys ( root ) ; Map < String , String > result = new HashMap < String , String > ( ) ; result . put ( id , name ) ; return result ; }
Validates that some XML contains all required components of an ohmage
 XML document and that all values, even optional ones that are given, are
 valid values.
Validates that some XML contains all required components of an ohmage XML document and that all values even optional ones that are given are valid values .
// This should only be thrown if it can't read the 'xml', but // given that it is already in memory this should never happen.