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);
}
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);
}
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);
}
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();
}
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;
}
Aggregations