public void fromXML(String xml,XMLNoteImageIcon.Provider prov) throws BadDocumentException {
		//System.out.println(xml);
		InputSource source=new InputSource(new StringReader(xml));
		if (prov!=null) { _doc.setXMLNoteImageIconProvider(prov); }
		boolean ignore=_doc.getUndoManager().setIgnore(true);
		try {
			SAXParser parser=_factory.newSAXParser();
			try {
				parser.parse(source, this);
				Enumeration<MXMLNoteMark> en=_marks.elements();
				while(en.hasMoreElements()) {
					MXMLNoteMark mark=en.nextElement();
					if (mark.endOffset()==-1) {
						throw new BadDocumentException(String.format(_translator.translate("E10003:xmlnote Mark without end (mark id='%s')"),
																	 mark.id()
																	)
													   );
					} else {
						try {
							_doc.insertMark(mark.id(),mark.markClass(), mark.offset(), mark.endOffset()-mark.offset());
						} catch (BadLocationException e) {
							throw new BadDocumentException(e);
						} catch (MarkExistsException e) {
							throw new BadDocumentException(e);
						}
					}
				}
				if (_incompleteMarks.size() > 0) {
					throw new BadDocumentException(String.format(_translator.translate("E10004:%d xmlnote End Mark(s) without start"),
												    			 _incompleteMarks.size()
												    			 )
												    
												    );
				}
			} catch (IOException e) {
				throw new BadDocumentException(e);
			}
		} catch (ParserConfigurationException e) {
			throw new BadDocumentException(e);
		} catch (SAXException e) {
			throw new BadDocumentException(e);
		}
		_doc.getUndoManager().setIgnore(ignore);
		_doc.getUndoManager().discardAllEdits();
	}