* @param text
* @return a DocInitialization
* @throws XmlParseException
*/
public static DocInitialization docInitializationFromXml(String text) throws XmlParseException {
XmlPullParser p = XmlParserFactory.unbuffered(text);
DocOpBuilder builder = new DocOpBuilder();
while (p.hasNext()) {
switch (p.next()) {
case START_ELEMENT:
builder.elementStart(p.getTagName(), AttributesImpl.fromStringMap(p.getAttributes()));
continue;
case END_ELEMENT:
builder.elementEnd();
continue;
case TEXT:
builder.characters(p.getText());
continue;
case PROCESSING_INSTRUCTION:
String name = p.getProcessingInstructionName();
AnnotationBoundaryMapBuilder anBuilder = new AnnotationBoundaryMapBuilder();
if (PI_TARGET.equals(name)) {
List<Pair<String, String>> parseAnnotations =
AnnotationParser.parseAnnotations(p.getProcessingInstructionValue());
for (Pair<String, String> ann : parseAnnotations) {
final String key = ann.first;
final String oldValue = null;
final String newValue = ann.second;
if (newValue == null) {