use of org.xmldb.api.modules.XMLResource in project exist by eXist-db.
the class TestXPathOpOrSpecialCase method storeXML.
/**
* Store the XML string into the specified collection and document.
* @param collection The target collection.
* @param documentName The target document name.
* @param content The XML content to be stored.
* @throws XMLDBException See {@link XMLDBException}.
*/
private void storeXML(final Collection collection, final String documentName, final String content) throws XMLDBException {
final XMLResource doc = (XMLResource) collection.createResource(documentName, "XMLResource");
doc.setContent(content);
collection.storeResource(doc);
}
use of org.xmldb.api.modules.XMLResource in project exist by eXist-db.
the class NamespaceUpdateTest method setUp.
@Before
public void setUp() throws ClassNotFoundException, IllegalAccessException, InstantiationException, XMLDBException {
// initialize driver
final CollectionManagementService service = (CollectionManagementService) existEmbeddedServer.getRoot().getService("CollectionManagementService", "1.0");
testCollection = service.createCollection("test");
assertNotNull(testCollection);
final XMLResource doc = (XMLResource) testCollection.createResource("namespace-updates.xml", "XMLResource");
doc.setContent(namespaces);
testCollection.storeResource(doc);
}
use of org.xmldb.api.modules.XMLResource in project exist by eXist-db.
the class PersistentDescendantOrSelfNodeKindTest method storeTestDoc.
@BeforeClass
public static void storeTestDoc() throws XMLDBException {
final Collection root = existEmbeddedServer.getRoot();
final XMLResource res = (XMLResource) root.createResource(TEST_DOCUMENT_NAME, "XMLResource");
res.setContent(TEST_DOCUMENT);
root.storeResource(res);
}
use of org.xmldb.api.modules.XMLResource in project exist by eXist-db.
the class SpecialNamesTest method storeXMLStringAndGetQueryService.
/**
* stores XML String and get Query Service
* @param documentName to be stored in the DB
* @param content to be stored in the DB
* @return the XQuery Service
* @throws XMLDBException
*/
@SuppressWarnings("unused")
private XQueryService storeXMLStringAndGetQueryService(String documentName, String content) throws XMLDBException {
XMLResource doc = (XMLResource) testCollection.createResource(documentName, "XMLResource");
doc.setContent(content);
testCollection.storeResource(doc);
XQueryService service = (XQueryService) testCollection.getService("XPathQueryService", "1.0");
return service;
}
use of org.xmldb.api.modules.XMLResource in project exist by eXist-db.
the class UnionTest method storeCollectionConfig.
private void storeCollectionConfig() throws XMLDBException {
final Collection colConfig = getOrCreateCollection("/db/system/config/db/" + TEST_COLLECTION_NAME);
final XMLResource docConfig = (XMLResource) colConfig.createResource(DEFAULT_COLLECTION_CONFIG_FILE, "XMLResource");
docConfig.setContent(INDEX_CONFIG);
colConfig.storeResource(docConfig);
}
Aggregations