Package org.exist.memtree

Examples of org.exist.memtree.DocumentBuilderReceiver


            return seq;
          } else {
            final ValueSequence seq = new ValueSequence();
        context.pushDocumentContext();
        final MemTreeBuilder builder = context.getDocumentBuilder();
        final DocumentBuilderReceiver builderReceiver = new DocumentBuilderReceiver(builder, true);
        final SAXResult result = new SAXResult(builderReceiver);
        result.setLexicalHandler(builderReceiver);    //preserve comments etc... from xslt output
        handler.setResult(result);
            final Receiver receiver = new ReceiverToSAX(handler);
            final Serializer serializer = context.getBroker().getSerializer();
View Full Code Here


        context.pushDocumentContext();
        try {
            final InMemoryNodeSet result = new InMemoryNodeSet();
            final MemTreeBuilder builder = context.getDocumentBuilder();
            final DocumentBuilderReceiver receiver = new DocumentBuilderReceiver(builder, true);
            for (final SequenceIterator i = args[0].iterate(); i.hasNext(); ) {
                final int nodeNr = builder.getDocument().getLastNode();
                final NodeValue next = (NodeValue) i.nextItem();
                next.toSAX(context.getBroker(), receiver, serializeOptions);
                result.add(builder.getDocument().getNode(nodeNr + 1));
View Full Code Here

            str.append(text.getData());
        }
       
        // Second step: output the text
        ValueSequence result = new ValueSequence();
        final DocumentBuilderReceiver receiver = new DocumentBuilderReceiver(builder);
        int nodeNr;
        int currentWidth = 0;
        if (offsets == null) {
            // no matches: just output the entire text
            if (width > str.length())
View Full Code Here

       
        final Item a = args[0].itemAt(0);
       
        final MemTreeBuilder builder = new MemTreeBuilder(context);
        builder.startDocument();
        final DocumentBuilderReceiver receiver = new DocumentBuilderReceiver(builder);
       
        try {
            final Properties props = new Properties();
            a.toSAX(context.getBroker(), receiver, props);
           
        } catch (final SAXException e) {
            throw new XPathException(this, "Cannot Deep-copy Item");
        }
       
        builder.endDocument();
       
        return (NodeValue)receiver.getDocument().getDocumentElement();
    }
View Full Code Here

  }
 
  protected Sequence deepCopy(Sequence inSeq) throws XPathException {
    context.pushDocumentContext();
    final MemTreeBuilder builder = context.getDocumentBuilder();
    final DocumentBuilderReceiver receiver = new DocumentBuilderReceiver(builder);
    final Serializer serializer = context.getBroker().getSerializer();
    serializer.setReceiver(receiver);
   
    try {
      final Sequence out = new ValueSequence();
View Full Code Here

        MemTreeBuilder instanceBuilder = null;
        InputSource instance = null;

        if (isCalledAs("jaxp-parse")) {
            instanceBuilder = context.getDocumentBuilder();
            contenthandler = new DocumentBuilderReceiver(instanceBuilder, true); // (namespace?)

        } else {
            contenthandler = new ValidationContentHandler();
        }
View Full Code Here

                Item item;
                if (Type.subTypeOf(type, Type.NODE)) {
                    item = (Item) child.getFirstChild();
                    if (type == Type.DOCUMENT) {
                        final NodeImpl n = (NodeImpl) item;
                        final DocumentBuilderReceiver receiver = new DocumentBuilderReceiver();
                        try {
                            receiver.startDocument();
                            n.getDocument().copyTo(n, receiver);
                            receiver.endDocument();
                        } catch (final SAXException e) {
                            throw new XPathException("Error while demarshalling node: " + e.getMessage(), e);
                        }
                        item = (Item) receiver.getDocument();
                    }
                } else {
                    final StringBuilder data = new StringBuilder();
                    Node txt = child.getFirstChild();
                    while (txt != null) {
View Full Code Here

TOP

Related Classes of org.exist.memtree.DocumentBuilderReceiver

Copyright © 2018 www.massapicom. 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.