protected void changeNS (String oldURI, String newURI) { XmlCursor curs = newCursor(); while (curs.toParent()) { /* Goto the top of the document */ } TokenType tt = curs.currentTokenType(); if (tt.isStartdoc()) { tt = curs.toFirstContentToken(); } if (tt.isStart()) { do { if (tt.isStart() || tt.isAttr() || tt.isNamespace()) { javax.xml.namespace.QName currQName = curs.getName(); if (oldURI.equals(currQName.getNamespaceURI())) { curs.setName(new javax.xml.namespace.QName(newURI, currQName.getLocalPart())); } } tt = curs.toNextToken(); } while (!tt.isEnddoc() && !tt.isNone()); } curs.dispose(); }
while(!cursor.toNextToken().isEnddoc())
else if (tt.isEnddoc())
else if (tt.isEnddoc())
} while (!tt.isStart() && !tt.isEnd() && !tt.isEnddoc());
/** * */ void remove () { XmlCursor childCurs = newCursor(); if (childCurs.currentTokenType().isStartdoc()) { // Remove on the document removes all children. TokenType tt = childCurs.toFirstContentToken(); while (!tt.isEnd() && !tt.isEnddoc()) { removeToken(childCurs); tt = childCurs.currentTokenType(); // Now see where we're pointing after the delete -- next token. } } else { removeToken(childCurs); } childCurs.dispose(); }