Package org.exist.xquery.update

Source Code of org.exist.xquery.update.UpdateInsertTest

package org.exist.xquery.update;

import org.junit.Test;
import org.xmldb.api.base.XMLDBException;
import org.xmldb.api.modules.XQueryService;

/**
* @author Adam Retter <adam@exist-db.org>
*/
public class UpdateInsertTest extends AbstractTestUpdate {

    @Test
    public void insertNamespacedAttribute() throws XMLDBException {

        final String docName = "pathNs2.xml";
        XQueryService service =
            storeXMLStringAndGetQueryService(docName, "<test/>");

        queryResource(service, docName, "//t[@xml:id]", 0);

        String update = "update insert <t xml:id=\"id1\"/> into /test";
        queryResource(service, docName, update, 0);

        queryResource(service, docName, "//t[@xml:id eq 'id1']", 1);
        queryResource(service, docName, "/test/id('id1')", 1);

        update = "update value //t/@xml:id with 'id2'";
        queryResource(service, docName, update, 0);

        queryResource(service, docName, "//t[@xml:id eq 'id2']", 1);
        queryResource(service, docName, "id('id2', /test)", 1);
    }
}
TOP

Related Classes of org.exist.xquery.update.UpdateInsertTest

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.