private static void fixupNamespace(Document doc) throws MarshalException {

		Node n;
		Element el;
		String prefix;

		n = doc.getFirstChild();

		if (n.getNodeType() != Node.ELEMENT_NODE) {
			throw new RuntimeException("No element");
		}

		el = (Element) n;

		prefix = el.getPrefix();

		if (prefix != null && prefix.length() > 0) {
			el.setPrefix(null);
		} else {
			prefix = "";
		}

		dropNamespaceDecls(el);

		removePrefixFromChildren(el, prefix);
	}
private static void fixupNamespace ( Document doc ) throws MarshalException { Node n ; Element el ; String prefix ; n = doc . getFirstChild ( ) ; if ( n . getNodeType ( ) != Node . ELEMENT_NODE ) { throw new RuntimeException ( "No element" ) ; } el = ( Element ) n ; prefix = el . getPrefix ( ) ; if ( prefix != null && prefix . length ( ) > 0 ) { el . setPrefix ( null ) ; } else { prefix = "" ; } dropNamespaceDecls ( el ) ; removePrefixFromChildren ( el , prefix ) ; }
If the top-level element has a prefix associated with it, drop it.
Go recursively down and remove all prefixes. If we come across
a different prefix, throw a {@link MarshalException}...

@param doc
@throws MarshalException