Search in sources :

Example 61 with QName

use of org.exist.dom.QName in project exist by eXist-db.

the class NamePoolTest method getSharedNameDifferentNamespace.

@Test
public void getSharedNameDifferentNamespace() throws Exception {
    NamePool pool = new NamePool();
    QName q1 = new QName("n1", "http://exist-db.COM", "x");
    QName q2 = new QName("n1", "http://exist-db.org", "x");
    pool.getSharedName(q1);
    QName qr = pool.getSharedName(q2);
    assertNotSame(q1, qr);
}
Also used : QName(org.exist.dom.QName) Test(org.junit.Test)

Example 62 with QName

use of org.exist.dom.QName in project exist by eXist-db.

the class NamePoolTest method getSharedNameIdentical.

@Test
public void getSharedNameIdentical() throws Exception {
    NamePool pool = new NamePool();
    QName q1 = new QName("n1", "http://exist-db.org", "x");
    QName q2 = new QName("n1", "http://exist-db.org", "x");
    pool.getSharedName(q1);
    QName qr = pool.getSharedName(q2);
    assertSame(q1, qr);
}
Also used : QName(org.exist.dom.QName) Test(org.junit.Test)

Example 63 with QName

use of org.exist.dom.QName in project exist by eXist-db.

the class HTML5WriterTest method testAttributeWithBooleanValue.

@Test
public void testAttributeWithBooleanValue() throws Exception {
    final String expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE html>\n<input checked>";
    final QName elQName = new QName("input");
    writer.startElement(elQName);
    writer.attribute("checked", "checked");
    writer.closeStartTag(true);
    final String actual = targetWriter.toString();
    assertEquals(expected, actual);
}
Also used : QName(org.exist.dom.QName) Test(org.junit.Test)

Example 64 with QName

use of org.exist.dom.QName in project exist by eXist-db.

the class IntersectTest method createInMemoryDocument.

private Document createInMemoryDocument() {
    final MemTreeBuilder memtree = new MemTreeBuilder();
    memtree.startDocument();
    memtree.startElement(new QName("m1", XMLConstants.NULL_NS_URI), null);
    memtree.startElement(new QName("m2", XMLConstants.NULL_NS_URI), null);
    memtree.characters("test data");
    memtree.endElement();
    memtree.endElement();
    memtree.endDocument();
    return memtree.getDocument();
}
Also used : MemTreeBuilder(org.exist.dom.memtree.MemTreeBuilder) QName(org.exist.dom.QName)

Example 65 with QName

use of org.exist.dom.QName in project exist by eXist-db.

the class NGramIndexWorker method getDefinedIndexes.

/**
 * Check index configurations for all collection in the given DocumentSet and return
 * a list of QNames, which have indexes defined on them.
 *
 * @param broker the database broker
 * @param docs   documents
 */
private List<QName> getDefinedIndexes(final DBBroker broker, final DocumentSet docs) {
    final List<QName> indexes = new ArrayList<>(20);
    for (final Iterator<Collection> i = docs.getCollectionIterator(); i.hasNext(); ) {
        final Collection collection = i.next();
        final IndexSpec idxConf = collection.getIndexConfiguration(broker);
        if (idxConf != null) {
            final Map<?, ?> config = (Map<?, ?>) idxConf.getCustomIndexSpec(NGramIndex.ID);
            if (config != null) {
                for (final Object name : config.keySet()) {
                    indexes.add((QName) name);
                }
            }
        }
    }
    return indexes;
}
Also used : IndexSpec(org.exist.storage.IndexSpec) QName(org.exist.dom.QName) Collection(org.exist.collections.Collection)

Aggregations

QName (org.exist.dom.QName)271 Test (org.junit.Test)54 Sequence (org.exist.xquery.value.Sequence)39 DBBroker (org.exist.storage.DBBroker)31 MemTreeBuilder (org.exist.dom.memtree.MemTreeBuilder)28 IOException (java.io.IOException)23 Document (org.w3c.dom.Document)23 DocumentSet (org.exist.dom.persistent.DocumentSet)20 Text (org.w3c.dom.Text)20 AttributesImpl (org.xml.sax.helpers.AttributesImpl)18 NameTest (org.exist.xquery.NameTest)17 XPathException (org.exist.xquery.XPathException)17 BrokerPool (org.exist.storage.BrokerPool)15 IllegalQNameException (org.exist.dom.QName.IllegalQNameException)13 Node (org.w3c.dom.Node)12 ReentrantLock (java.util.concurrent.locks.ReentrantLock)11 NodeSet (org.exist.dom.persistent.NodeSet)11 SAXException (org.xml.sax.SAXException)11 DefaultDocumentSet (org.exist.dom.persistent.DefaultDocumentSet)10 MutableDocumentSet (org.exist.dom.persistent.MutableDocumentSet)10