It works. Thanks Sameer 

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] 
Sent: Friday, November 17, 2006 10:18 AM
To: [email protected]
Subject: Re: [magnolia-user] Browsing paragraphs. RC3

It depends what kind of sub nodes it has.
Try to use getChildren(ItemType.YOUR_NODE_TYPE);

ItemType is a class which defines default magnolia nodetypes like
CONTENT -> mgnl:content (a page in website repository has type  
mgnl:content)
CONTENTNODE -> mgnl:contentNode (its a paragraph)


Hope this helps
Regards
- Sameer





On Nov 17, 2006, at 10:04 AM, Ducret, Gilles (CH) wrote:

>  Hello,
>
> We want to access the different paragraphs of a page to print it.  
> We have written a servlet that is being called with a page  
> parameter. But when accessing the page, and browsing the paragraphs  
> we don't get any children.
>
> If we do the opposite. We directly go to the paragraph and walk up  
> through the containers we can access the page.
>
> I copy the code in this email. If somebody could tell us what is  
> wrong in the code.
>
> Many thanks
>
> // In the JSP tag of the source page
> String page = info.magnolia.cms.util.Resource.getActivePage 
> (request).getHandle();
> // Then I call the servlet with the page parameter
>
> // The servlet code
> Content content = MgnlContext.getHierarchyManager 
> (ContentRepository.WEBSITE).getContent(request.getParameter("page"));
> log.debug("Page handle : " + content.getHandle()) ;  // OK it  
> return the page handle
> if (content.getChildren().iterator().hasNext()) {
> log.debug("Page children handle : " + ((Content) content.getChildren 
> ().iterator().next()).getHandle());  // KO No children found
> } else {
> log.debug("Page children not found");
> }
>
> There is no children in my iterator. It's strange because when I  
> try to browse nodes from the paragraph to the paragraph container I  
> can reach the children :
>

Regards,

Sameer Charles
Magnolia International Ltd.

------------------------------------------------------------------------

---------
[EMAIL PROTECTED]       http://www.magnolia.info
Magnolia(r)  - Simple Enterprise Content Management
------------------------------------------------------------------------

---------







----------------------------------------------------------------
for list details see
http://www.magnolia.info/en/magnolia/developer.html
----------------------------------------------------------------

************************************************************************************
This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed.
If you have received this email in error, please notify the system manager 
([EMAIL PROTECTED]) and delete the message with any attached files from your 
system.
The confidentiality and integrity of this message cannot be guaranteed on the 
Internet and the sender does not accept liability for its content.

***********************************************************************************


----------------------------------------------------------------
for list details see
http://www.magnolia.info/en/magnolia/developer.html
----------------------------------------------------------------

Reply via email to