static XmlObject parseWithNamespaces(Element element, Map namespaceMap) throws XmlException {
ArrayList errors = new ArrayList();
XmlOptions xmlOptions = XmlBeansUtil.createXmlOptions(errors);
SchemaDocument parsed = SchemaDocument.Factory.parse(element, xmlOptions);
if (errors.size() != 0) {
throw new XmlException(errors.toArray().toString());
}
XmlCursor cursor = parsed.newCursor();
try {
cursor.toFirstContentToken();
for (Iterator namespaces = namespaceMap.entrySet().iterator(); namespaces.hasNext();) {