Exemple #1
0
 /// <summary>
 /// Insert a namespace compensated element fragment after cursor element
 /// </summary>
 /// <param name="ef"></param>
 public void insertAfterElement(ElementFragmentNs ef)
 {
     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);
 }
Exemple #2
0
 /**
  * This method will insert a namespace compensated fragment before the tail of cursor element, 
  * @param ef
  * @throws ModifyException
  * @throws NavException
  */
 public void insertBeforeTail(ElementFragmentNs ef){
     long i = md.getOffsetBeforeTail();
     if (i<0){
         //throw new ModifyException("Insertion failed");
     	insertAfterHead(ef);
     	return;
     }
     insertElementFragmentNsAt((int)i, ef);
 }
Exemple #3
0
 /// <summary>
 /// This method will insert an ElementFragmentNs instance 
 /// after the head of cursor element, 
 /// </summary>
 /// <param name="ef"></param>
 public void insertAfterHead(ElementFragmentNs ef)
 {
     long i = md.getOffsetAfterHead();
     if (i < 0)
     {
         //throw new ModifyException("Insertion failed");
         insertElementFragmentNsEnclosedAt((int)i - 1, ef);
         insertEndingTag(i);
         return;
     }
     insertElementFragmentNsAt((int)i, ef);
 }
Exemple #4
0
 private void insertElementFragmentNsEnclosedAt(int offset, ElementFragmentNs ef)
 {
     if (insertHash.isUnique(offset) == false)
     {
         throw new ModifyException("There can be only one insert per offset");
     }
     unchecked
     {
         flb.append((long)offset | (long)MASK_INSERT_FRAGMENT_NS_ENCLOSED);
         fob.append(ef);
     }
 }
Exemple #5
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="ef"></param>

        public void insertBeforeElement(ElementFragmentNs ef)
        {
            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");

            int offset = md.getTokenOffset(startTagIndex) - 1;

            if (encoding < VTDNav.FORMAT_UTF_16BE)
                insertElementFragmentNsAt(offset, ef);
            else
                insertElementFragmentNsAt((offset) << 1, ef);
        }