private void insertElementFragmentNsEnclosedAt(int offset, ElementFragmentNs ef) throws ModifyException{ if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } flb.append((long)offset | MASK_INSERT_FRAGMENT_NS_ENCLOSED); fob.append(ef); }
private void insertElementFragmentNsEnclosedAt(int offset, ElementFragmentNs ef) throws ModifyException{ if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } flb.append((long)offset | MASK_INSERT_FRAGMENT_NS_ENCLOSED); fob.append(ef); }
/** * Insert ns compensated element fragment into the document * @param ef * */ private void insertElementFragmentNsAt(int offset, ElementFragmentNs ef) throws ModifyException{ if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } flb.append((long)offset | MASK_INSERT_FRAGMENT_NS); fob.append(ef); }
/** * Insert ns compensated element fragment into the document * @param ef * */ private void insertElementFragmentNsAt(int offset, ElementFragmentNs ef) throws ModifyException{ if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } flb.append((long)offset | MASK_INSERT_FRAGMENT_NS); fob.append(ef); }
private void insertElementFragmentNsEnclosedAt(int offset, ElementFragmentNs ef) throws ModifyException{ if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } flb.append((long)offset | MASK_INSERT_FRAGMENT_NS_ENCLOSED); fob.append(ef); }
/** * Insert ns compensated element fragment into the document * @param ef * */ private void insertElementFragmentNsAt(int offset, ElementFragmentNs ef) throws ModifyException{ if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } flb.append((long)offset | MASK_INSERT_FRAGMENT_NS); fob.append(ef); }
/** * insert the byte content into XML * @param offset (in char, not byte) * @param content * */ public void insertBytesAt(int offset, byte[] content) throws ModifyException{ if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } flb.append( (long)offset | MASK_INSERT_BYTE); fob.append(content); }
/** * insert the byte content into XML * @param offset (in char, not byte) * @param content * */ public void insertBytesAt(int offset, byte[] content) throws ModifyException{ if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } flb.append( (long)offset | MASK_INSERT_BYTE); fob.append(content); }
/** * insert the byte content into XML and surround it with "<" and ">" * @param offset (in char, not byte) * @param content * */ private void insertBytesEnclosedAt(int offset, byte[] content) throws ModifyException{ if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } flb.append( (long)offset | MASK_INSERT_BYTE_ENCLOSED); fob.append(content); }
/** * insert the byte content into XML and surround it with ">" and "<" * @param offset (in char, not byte) * @param content * */ private void insertBytesEnclosedAt(int offset, byte[] content) throws ModifyException{ if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } flb.append( (long)offset | MASK_INSERT_BYTE_ENCLOSED); fob.append(content); }
/** * insert the byte content into XML and surround it with ">" and "<" * @param offset (in char, not byte) * @param content * */ private void insertBytesEnclosedAt(int offset, byte[] content) throws ModifyException{ if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } flb.append( (long)offset | MASK_INSERT_BYTE_ENCLOSED); fob.append(content); }
/** * insert the byte content into XML * @param offset (in char, not byte) * @param content * */ public void insertBytesAt(int offset, byte[] content) throws ModifyException{ if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } flb.append( (long)offset | MASK_INSERT_BYTE); fob.append(content); }
/** * This method will first call getCurrentIndex() to get the cursor index value * then insert the byte value of s after the element * @param s the string whose byte content will be inserted into the master document * */ public void insertAfterElement(String s) throws ModifyException,UnsupportedEncodingException,NavException{ int startTagIndex =md.getCurrentIndex(); int type = md.getTokenType(startTagIndex); if (type!=VTDNav.TOKEN_STARTING_TAG) throw new ModifyException("Token type is not a starting tag"); long l = md.getElementFragment(); int offset = (int)l; int len = (int)(l>>32); insertBytesAt(offset+len,s.getBytes(charSet)); }
/** * This method will first call getCurrentIndex() to get the cursor index value * then insert the byte value of s after the element * @param s the string whose byte content will be inserted into the master document * */ public void insertAfterElement(String s) throws ModifyException,UnsupportedEncodingException,NavException{ int startTagIndex =md.getCurrentIndex(); int type = md.getTokenType(startTagIndex); if (type!=VTDNav.TOKEN_STARTING_TAG) throw new ModifyException("Token type is not a starting tag"); long l = md.getElementFragment(); int offset = (int)l; int len = (int)(l>>32); insertBytesAt(offset+len,s.getBytes(charSet)); }
/** * This method will first call getCurrentIndex() to get the cursor index value * then insert the byte array b after the element * @param b * @throws ModifyException * @throws NavException * */ public void insertAfterElement(byte[] b) throws ModifyException,NavException{ int startTagIndex =md.getCurrentIndex(); int type = md.getTokenType(startTagIndex); if (type!=VTDNav.TOKEN_STARTING_TAG) throw new ModifyException("Token type is not a starting tag"); long l = md.getElementFragment(); int offset = (int)l; int len = (int)(l>>32); insertBytesAt(offset+len,b); }
/** * Insert a namespace compensated element after cursor element * @param ef (an ElementFragmentNs object) * @throws ModifyException * @throws NavException * */ public void insertAfterElement(ElementFragmentNs ef) throws ModifyException, NavException { int startTagIndex = md.getCurrentIndex(); int type = md.getTokenType(startTagIndex); if (type != VTDNav.TOKEN_STARTING_TAG) throw new ModifyException("Token type is not a starting tag"); long l = md.getElementFragment(); int offset = (int) l; int len = (int) (l >> 32); insertElementFragmentNsAt(offset + len, ef); }
/** * Insert a namespace compensated element after cursor element * @param ef (an ElementFragmentNs object) * @throws ModifyException * @throws NavException * */ public void insertAfterElement(ElementFragmentNs ef) throws ModifyException, NavException { int startTagIndex = md.getCurrentIndex(); int type = md.getTokenType(startTagIndex); if (type != VTDNav.TOKEN_STARTING_TAG) throw new ModifyException("Token type is not a starting tag"); long l = md.getElementFragment(); int offset = (int) l; int len = (int) (l >> 32); insertElementFragmentNsAt(offset + len, ef); }
/** * Remove an attribute name value pair from the master document. * @param attrNameIndex * */ public void removeAttribute(int attrNameIndex) throws ModifyException{ int type = md.getTokenType(attrNameIndex); if (type != VTDNav.TOKEN_ATTR_NAME&& type != VTDNav.TOKEN_ATTR_NS) throw new ModifyException("token type should be attribute name"); int os1 = md.getTokenOffset(attrNameIndex); int os2 = md.getTokenOffset(attrNameIndex+1); int len2 = md.getTokenLength(attrNameIndex+1); if (encoding < VTDNav.FORMAT_UTF_16BE) removeContent(os1,os2+len2-os1+1); else removeContent(os1<<1,(os2+len2-os1+1)<<1); }
/** * Remove an attribute name value pair from the master document. * @param attrNameIndex * */ public void removeAttribute(int attrNameIndex) throws ModifyException{ int type = md.getTokenType(attrNameIndex); if (type != VTDNav.TOKEN_ATTR_NAME&& type != VTDNav.TOKEN_ATTR_NS) throw new ModifyException("token type should be attribute name"); int os1 = md.getTokenOffset(attrNameIndex); int os2 = md.getTokenOffset(attrNameIndex+1); int len2 = md.getTokenLength(attrNameIndex+1); if (encoding < VTDNav.FORMAT_UTF_16BE) removeContent(os1,os2+len2-os1+1); else removeContent(os1<<1,(os2+len2-os1+1)<<1); }
/** * Remove an attribute name value pair from the master document. * @param attrNameIndex * */ public void removeAttribute(int attrNameIndex) throws ModifyException{ int type = md.getTokenType(attrNameIndex); if (type != VTDNav.TOKEN_ATTR_NAME&& type != VTDNav.TOKEN_ATTR_NS) throw new ModifyException("token type should be attribute name"); int os1 = md.getTokenOffset(attrNameIndex); int os2 = md.getTokenOffset(attrNameIndex+1); int len2 = md.getTokenLength(attrNameIndex+1); if (encoding < VTDNav.FORMAT_UTF_16BE) removeContent(os1,os2+len2-os1+1); else removeContent(os1<<1,(os2+len2-os1+1)<<1); }