--- Bruno Dumon <[EMAIL PROTECTED]> wrote:
...
> I don't know what you've attempted so far, but I think the following
> will work (warning: pseudo code):
> 
> XMLByteStreamCompiler comp = new XMLByteStreamCompiler();
> String mytext = "piet snot";
> comp.characters(mytext.toCharArray(), 0, mytext.length());
> Object compiledSAX = comp.getSAXFragment();
...

Thanks for the help.  I now have two working solutions:

function setLabel1 (widgetDefinition, labelString) {
  var comp = new Packages.org.apache.cocoon.components.sax.XMLByteStreamCompiler();
  var text = new java.lang.String(labelString);
  comp.characters(text.toCharArray(), 0, text.length());
  var compiledSAX = comp.getSAXFragment();
  widgetDefinition.setLabel(compiledSAX);
}

function setLabel2 (widgetDefinition, labelString) {
  var doc  = new Packages.org.apache.xerces.dom.DocumentImpl();
  var elem = doc.createElementNS("http://apache.org/cocoon/woody/definition/1.0";, 
"label");
  var text = doc.createTextNode(labelString);
  elem.appendChild(text);
  var label = 
Packages.org.apache.cocoon.woody.util.DomHelper.compileElementContent(elem);
  widgetDefinition.setLabel(label);
}

BTW: What do XMLByteStreamCompiler.writeString and friends do?

--Tim Larson


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to