Skip to main content

How to get the contents of a merged view?

2 replies [Last post]
chimshaw
Offline
Joined: 2003-11-21

Hi,
Is there a way to get the contents of a view after merging?
Here's what we are trying:
* We have a helpset which is merged at runtime.
* We also want to display the merged TOC as a HTML file.

So is there any way we can get the xml file after merging. We can then convert this xml to HTML and display to the user.

Regards,
Chimshaw

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Roger Brinkley

javahelp1@JAVADESKTOP.ORG wrote:

> Hi, Is there a way to get the contents of a view after merging?
> Here's what we are trying:
>
> * We have a helpset which is merged at
> * We also want to display the merged TOC as a HTML file.
>
> So is there any way we can get the xml file after merging. We can
> then convert this xml to HTML and display to the user.

It's not going to be a merged xml file. Merging isn't handled that way.
Essentially you'll have to do everything that is done in the BasicTOCUI
or in TOCItemTAG for the servlet help.

Essentiallly that would be

topNode = view.getDataAsTree();

String mergeType = view.getMergeType();
HelpSet hs = view.getHelpSet();
Locale locale = hs.getLocale();

// Make sure the children are all handled correctly
MergeHelpUtilities.mergeNodeChildren(mergeType, topNode);

// add all the subhelpsets
addSubHelpSets(hs);

treeEnum = topNode.preorderEnumeration();
}

/** Adds subhelpsets
*
* @param hs The HelpSet which subhelpsets will be added
*/
private void addSubHelpSets(HelpSet hs){
for( Enumeration e = hs.getHelpSets(); e.hasMoreElements(); ) {
HelpSet ehs = (HelpSet) e.nextElement();
if (ehs == null) {
continue;
}
// merge views
NavigatorView[] views = ehs.getNavigatorViews();
for(int i = 0; i < views.length; i++){
if (views[i] instanceof TOCView) {
Merge mergeObject =
Merge.DefaultMergeFactory.getMerge(view, views[i]);
if (mergeObject != null) {
mergeObject.processMerge(topNode);
}
}
}
addSubHelpSets( ehs );
}
}

Binky

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

You may leave the list at any time by sending message with no subject and
"SIGNOFF JAVAHELP-INTEREST" in the body to LISTSERV@JAVA.SUN.COM. Archives
are available at http://archives.java.sun.com/archives/javahelp-interest.html.
Submit bug reports at http://java.sun.com/cgi-bin/bugreport.cgi.

chimshaw
Offline
Joined: 2003-11-21

Thanks, I'll give it a try.