}
changeSet = null;
}
private void insertNode(StoredNode insertedNode, Receiver receiver, String changeMessage) throws XMLStreamException, IOException, SAXException {
ExtendedXMLStreamReader reader = broker.newXMLStreamReader(insertedNode, false);
reader.next();
int treeLevel = 0;
while (reader.hasNext()) {
int status = reader.next();
if ((status == XMLStreamReader.START_ELEMENT || status == XMLStreamReader.END_ELEMENT) &&
StandardDiff.NAMESPACE.equals(reader.getNamespaceURI())) {
if (status == XMLStreamReader.START_ELEMENT) {
if ("attribute".equals(reader.getLocalName())) {
int attrCount = reader.getAttributeCount();
for (int i = 0; i < attrCount; i++) {
QName qname = reader.getAttributeQName(i);
receiver.attribute(qname, reader.getAttributeValue(i));
}
} else if ("comment".equals(reader.getLocalName())) {
StringBuffer buf = new StringBuffer();
while (reader.hasNext()) {
status = reader.next();
if (status == XMLStreamReader.END_ELEMENT &&
reader.getNamespaceURI().equals(StandardDiff.NAMESPACE) &&
reader.getLocalName().equals("comment"))
break;
if (status == XMLStreamReader.CHARACTERS)
buf.append(reader.getText());
}
char[] ch = buf.toString().toCharArray();
receiver.comment(ch, 0, ch.length);
} else if ("start".equals(reader.getLocalName())) {
String namespace = reader.getAttributeValue("", "namespace");
String name = reader.getAttributeValue("", "name");
receiver.startElement(new QName(QName.extractLocalName(name), namespace, QName.extractPrefix(name)), null);
if (annotate)
receiver.attribute(ATTR_CHANGE, "tag-" + changeMessage);
} else if ("end".equals(reader.getLocalName())) {
String namespace = reader.getAttributeValue("", "namespace");
String name = reader.getAttributeValue("", "name");
receiver.endElement(new QName(QName.extractLocalName(name), namespace, QName.extractPrefix(name)));
}
}
} else {
copyNode(reader, receiver, status, treeLevel == 0, changeMessage);