Examples of DocumentFragment


Examples of com.intellij.openapi.editor.DocumentFragment

  private static void annotateBasePath(@NotNull BasePathInfo basePathInfo,
                                       @NotNull AnnotationHolder holder) {
    YAMLKeyValue keyValue = basePathInfo.getKeyValue();
    if (keyValue != null) {
      DocumentFragment documentFragment = basePathInfo.getValueAsDocumentFragment();
      if (documentFragment == null) {
        int offset = keyValue.getTextRange().getEndOffset();
        holder.createErrorAnnotation(TextRange.create(offset - 1, offset), "path is unspecified");
      }
      else {
View Full Code Here

Examples of js.dom.DocumentFragment

            // fire page load event
            // window.trigger(UIAction.PageLoad);

            // create element cradle
            DocumentFragment cradle = document.createDocumentFragment();

            // build page element
            page.load(cradle);

            // clear old page and append new page
View Full Code Here

Examples of mf.org.w3c.dom.DocumentFragment

             throw new RangeExceptionImpl(
        RangeException.BAD_BOUNDARYPOINTS_ERR,
                DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "BAD_BOUNDARYPOINTS_ERR", null));
        }

      DocumentFragment frag = extractContents();
      insertNode(newParent);
      newParent.appendChild(frag);
      selectNode(newParent);
    }
View Full Code Here

Examples of mf.org.w3c.dom.DocumentFragment

     *         parameter was <code>DELETE_CONTENTS</code>, the
     *         return value is null.
     */
    private DocumentFragment traverseSameContainer( int how )
    {
        DocumentFragment frag = null;
        if (how != DELETE_CONTENTS) {
            frag = fDocument.createDocumentFragment();
        }

        // If selection is empty, just return the fragment
        if (fStartOffset == fEndOffset) {
            return frag;
        }

        // Text, CDATASection, Comment and ProcessingInstruction nodes need special case handling
        final short nodeType = fStartContainer.getNodeType();
        if (nodeType == Node.TEXT_NODE ||
            nodeType == Node.CDATA_SECTION_NODE ||
            nodeType == Node.COMMENT_NODE ||
            nodeType == Node.PROCESSING_INSTRUCTION_NODE) {
            // get the substring
            String s = fStartContainer.getNodeValue();
            String sub = s.substring(fStartOffset, fEndOffset);

            // set the original text node to its new value
            if (how != CLONE_CONTENTS) {
                ((CharacterDataImpl)fStartContainer).deleteData(fStartOffset,
                     fEndOffset-fStartOffset);
                // Nothing is partially selected, so collapse to start point
                collapse(true);
            }
            if (how == DELETE_CONTENTS) {
                return null;
            }
            if (nodeType == Node.TEXT_NODE) {
                frag.appendChild(fDocument.createTextNode(sub));
            }
            else if (nodeType == Node.CDATA_SECTION_NODE) {
                frag.appendChild(fDocument.createCDATASection(sub));
            }
            else if (nodeType == Node.COMMENT_NODE) {
                frag.appendChild(fDocument.createComment(sub));
            }
            else { // nodeType == Node.PROCESSING_INSTRUCTION_NODE
                frag.appendChild(fDocument.createProcessingInstruction(fStartContainer.getNodeName(), sub));
            }
            return frag;
        }

        // Copy nodes between the start/end offsets.
        Node n = getSelectedNode( fStartContainer, fStartOffset );
        int cnt = fEndOffset - fStartOffset;
        while( cnt > 0 ) {
            Node sibling = n.getNextSibling();
            Node xferNode = traverseFullySelected( n, how );
            if ( frag!=null )
                frag.appendChild( xferNode );
            --cnt;
            n = sibling;
        }

        // Nothing is partially selected, so collapse to start point
View Full Code Here

Examples of mf.org.w3c.dom.DocumentFragment

     *         return value is null.
     */
    private DocumentFragment
        traverseCommonStartContainer( Node endAncestor, int how )
    {
        DocumentFragment frag = null;
        if ( how!=DELETE_CONTENTS)
            frag = fDocument.createDocumentFragment();
        Node n = traverseRightBoundary( endAncestor, how );
        if ( frag!=null )
            frag.appendChild( n );

        int endIdx = indexOf( endAncestor, fStartContainer );
        int cnt = endIdx - fStartOffset;
        if ( cnt <=0 )
        {
            // Collapse to just before the endAncestor, which
            // is partially selected.
            if ( how != CLONE_CONTENTS )
            {
                setEndBefore( endAncestor );
                collapse( false );
            }
            return frag;
        }

        n = endAncestor.getPreviousSibling();
        while( cnt > 0 )
        {
            Node sibling = n.getPreviousSibling();
            Node xferNode = traverseFullySelected( n, how );
            if ( frag!=null )
                frag.insertBefore( xferNode, frag.getFirstChild() );
            --cnt;
            n = sibling;
        }
        // Collapse to just before the endAncestor, which
        // is partially selected.
View Full Code Here

Examples of mf.org.w3c.dom.DocumentFragment

     *         return value is null.
     */
    private DocumentFragment
        traverseCommonEndContainer( Node startAncestor, int how )
    {
        DocumentFragment frag = null;
        if ( how!=DELETE_CONTENTS)
            frag = fDocument.createDocumentFragment();
        Node n = traverseLeftBoundary( startAncestor, how );
        if ( frag!=null )
            frag.appendChild( n );
        int startIdx = indexOf( startAncestor, fEndContainer );
        ++startIdx;  // Because we already traversed it....

        int cnt = fEndOffset - startIdx;
        n = startAncestor.getNextSibling();
        while( cnt > 0 )
        {
            Node sibling = n.getNextSibling();
            Node xferNode = traverseFullySelected( n, how );
            if ( frag!=null )
                frag.appendChild( xferNode );
            --cnt;
            n = sibling;
        }

        if ( how != CLONE_CONTENTS )
View Full Code Here

Examples of mf.org.w3c.dom.DocumentFragment

     *         return value is null.
     */
    private DocumentFragment
        traverseCommonAncestors( Node startAncestor, Node endAncestor, int how )
    {
        DocumentFragment frag = null;
        if ( how!=DELETE_CONTENTS)
            frag = fDocument.createDocumentFragment();

        Node n = traverseLeftBoundary( startAncestor, how );
        if ( frag!=null )
            frag.appendChild( n );

        Node commonParent = startAncestor.getParentNode();
        int startOffset = indexOf( startAncestor, commonParent );
        int endOffset = indexOf( endAncestor, commonParent );
        ++startOffset;

        int cnt = endOffset - startOffset;
        Node sibling = startAncestor.getNextSibling();

        while( cnt > 0 )
        {
            Node nextSibling = sibling.getNextSibling();
            n = traverseFullySelected( sibling, how );
            if ( frag!=null )
                frag.appendChild( n );
            sibling = nextSibling;
            --cnt;
        }

        n = traverseRightBoundary( endAncestor, how );
        if ( frag!=null )
            frag.appendChild( n );

        if ( how != CLONE_CONTENTS )
        {
            setStartAfter( startAncestor );
            collapse( true );
View Full Code Here

Examples of nu.validator.saxtree.DocumentFragment

        try {
            treeBuilder.setFragmentContext(context.intern());
            tokenize(input);
        } finally {
            if (saxTreeBuilder != null) {
                DocumentFragment fragment = saxTreeBuilder.getDocumentFragment();
                new TreeParser(contentHandler, lexicalHandler).parse(fragment);
            }
        }
    }
View Full Code Here

Examples of org.w3c.dom.DocumentFragment

    public Object unmarshal(Object obj, IUnmarshallingContext ictx)
        throws JiBXException {
       
        // verify the entry conditions
        boolean created = false;
        DocumentFragment frag = null;
        if (obj == null) {
            frag = m_document.createDocumentFragment();
            created = true;
        } else if (obj instanceof DocumentFragment) {
            frag = (DocumentFragment)obj;
        } else {
            throw new JiBXException
                ("Supplied object is not an org.w3c.dom.DocumentFragment");
        }
        if (!(ictx instanceof UnmarshallingContext)) {
            throw new JiBXException
                ("Unmarshalling context not of expected type");
        }
       
        // unmarshal content to document model
        m_unmarshalContext = (UnmarshallingContext)ictx;
        try {
            Node node;
            while ((node = unmarshalNode()) != null) {
                frag.appendChild(node);
            }
            if (created && !frag.hasChildNodes()) {
                return null;
            } else {
                return frag;
            }
    } catch (IOException e) {
View Full Code Here

Examples of org.w3c.dom.DocumentFragment

        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Decrypted octets:\n" + octets);

        Node sourceParent =  element.getParentNode();

        DocumentFragment decryptedFragment =
      _serializer.deserialize(octets, sourceParent);


    // The de-serialiser returns a fragment whose children we need to
    // take on.
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.