IBM Support

Using QueryService to access top-level site areas in IBM Web Content Manager

Technote (troubleshooting)


If you are trying to use the QueryService to find top-level site areas within a web content library in a scenario where you do not know any of the site area names. You can see below QueryService API to

retrieve only the top level site areas of a library.

Resolving the problem

The query below will return the top level site Areas of the given library, i.e. all site areas under

Solution 1:

'/contentRoot/icm:libraries[7]/Content/'//element(*, icm:documentLibrary)[@icm:title = 'Library Name']/Content/element(*,ibmcontentwcm:siteArea)

Replace the icm:title property value in bold with the library name you want to query.

The above query might take longer if you have lots of libraries, in that scenario the below query can be used as it does not rely on deprecated code and uses the QueryService

Solution 2:
DocumentLibrary lib = workspace.getDocumentLibrary("Web Content");
Identity contentFolder = lib.getPresetFolder(PresetFolderType.CONTENT).getIdentity();
QueryService service = workspace.getQueryService();

Query topLevelSiteAreas = service.createQuery(SiteArea.class);
topLevelSiteAreas.addParentId(contentFolder, QueryDepth.CHILDREN);

ResultIterator resultIterator = queryService.execute(topLevelSiteAreas);
while (resultIterator.hasNext()) {
Object o =;
%><%= o %><br><%

Document information

More support for: IBM Web Content Manager
Web Content Integration

Software version:

Operating system(s): AIX, Linux, Solaris, Windows

Software edition: Java edition

Reference #: 1640860

Modified date: 03 July 2013

Translate this page: