示例#1
0
 __INLINE String
 ElementRef::getPIName ()
 {
     AssertBug(isPI(), "Element is not a PI !\n");
     const char* piName = getKeyCache().getLocalKey(KeyCache::getLocalKeyId(getKeyId()));
     return String(piName);
 }
示例#2
0
void DocumentBuilder::consumeContent(Node *root){
  while(peek() != -1){
    consumeText(root);
    if (isElement()){
      consumeElement(root);
      continue;
    }
    if (isComment()){
      consumeComment(root);
      continue;
    }
    if (isCDataSection()){
      consumeCDataSection(root);
      continue;
    }
    if(isPI()){
      consumePI(root);
      continue;
    }
    if (isCharRef()){
      StringBuffer *sb = new StringBuffer(2);
      sb->append(consumeCharRef());
      appendToLastTextNode(root, sb);
      continue;
    }
    if (isEntityRef()){
      String *entext = consumeEntityRef(true);
      appendToLastTextNode(root, entext);
      continue;
    }
    if (peek(0) == '<') break;
  };
}
示例#3
0
void DocumentBuilder::consumeMisc(Node *root){
  consumeSpaces();
  bool hasTokens = true;
  while(hasTokens){
    if(isComment()){
      consumeComment(root);
      consumeSpaces();
    }else if(isPI()){
      consumePI(root);
      consumeSpaces();
    }else{
      hasTokens = false;
    }
  }
}
示例#4
0
    /*
     * Textual contents setting
     */
    __INLINE void
    ElementRef::setText (const char* text, DomTextSize textSize)
    {
        AssertBug(isText() || isPI() || isComment(), "Not a text element ! id=%llx, path=%s\n", getElementId(), generateVersatileXPath().c_str());

        ElementSegment* me = getMe<Write>();
        AssertBug(me->flags & ElementFlag_HasTextualContents, "Invalid flags %x\n", me->flags);

        if (me->textualContents.size > me->textualContents.shortFormatSize)
        {
            // We shall reuse a bit here... Nevermind...
            getDocumentAllocator().freeSegment(me->textualContents.contentsPtr, me->textualContents.size);
        }

        if (textSize <= me->textualContents.shortFormatSize)
        {
            getDocumentAllocator().alter(me);
            me->textualContents.size = textSize;
            memcpy(me->textualContents.contents, text, textSize);

            getDocumentAllocator().protect(me);
        }
        else
        {
            SegmentPtr contentsPtr = getDocumentAllocator().getFreeSegmentPtr(textSize, getAllocationProfile());

            char* textSegment = getDocumentAllocator().getSegment<char, Write>(contentsPtr, textSize);
            getDocumentAllocator().alter(textSegment, textSize);
            memcpy(textSegment, text, textSize);
            getDocumentAllocator().protect(textSegment, textSize);

            getDocumentAllocator().alter(me);
            me->textualContents.size = textSize;
            me->textualContents.contentsPtr = contentsPtr;
            getDocumentAllocator().protect(me);
        }
        if ( getFather() )
        {
            getDocument().appendJournal(*this, JournalOperation_UpdateTextNode, *this, 0);
        }
    }
示例#5
0
 __INLINE bool
 ElementRef::isRegularElement ()
 {
     return (!isText() && !isComment() && !isPI());
 }