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 (curs.currentTokenType().isAttr())
if (!tt.isAttr() && !tt.isEnd() && !tt.isEnddoc())
if (tt.isAttr())
/** * * @param attrCurs * @return */ private XML createAttributeObject (XmlCursor attrCurs) { XML result = null; if (attrCurs.currentTokenType().isAttr()) { result = createAttributeXML(lib, attrCurs); } return result; }