Can anybody with 7.0 verify that the <Generator> tag is working?
I have a requirement to display a list of languages to a page designer when a component is inserted into a page and double-clicked, this list of languages will change in the future and we want to automatically generate this data for all components that will use this data. Here is a hard coded example:
[HTML]
English
en_US
Spanish
es_US
French
fr_CA
[/HTML]
Obviously this is not ideal for us. As we would have to update hundreds of components and then selectively update or replace them on over 10,000 pages.
So I wrote a little piece of Java that returns a Dom4j Document:
public Document getAvailableLanguages(RequestContext context)
{
Document doc = Dom4jUtils.newDocument();
Element Options = doc.addElement("Options");
Element Option = Options.addElement("Option");
Option.addElement("Display").addText("English");
Option.addElement("Value").addText("en_US");
Option = Options.addElement("Option");
Option.addElement("Display").addText("Spanish");
Option.addElement("Value").addText("es_US");
Option = Options.addElement("Option");
Option.addElement("Display").addText("French");
Option.addElement("Value").addText("fr_CA");
return doc;
}
This is the XML the above code returns when called from a component prefix tag:
[HTML]
English
en_US
Spanish
es_US
French
fr_CA
[/HTML]
The Document returned by Java must have a wrapper around the <Option> tags as a Document must have only one root element. This wrapper is suggested to be <Options> but when this is hard coded into the content XML, I get a validation error:
[HTML]
Blah
blah
Blah2
blah2
[/HTML]
Displays this error:
Component preview failed.
Could not load component data XML into XMLDOM.
com.interwoven.livesite.common.xml.ValidationError mColumn[10] mLine[8] mSystemID[null] mPublicID[null] mType[ERROR] mMessage[cvc-complex-type.2.4.a: Invalid content was found starting with element 'Options'. One of '{Font, Image, Date, Option, ContentTypes, DCR, Site, Generator, PropertyPrefix}' is expected.]
Ignoring this I created a simple Datum Generator:
[HTML]
[/HTML]
Which results in this error:
Component preview failed.
Could not load component XML into XMLDOM.
Datum ID=[blah]
Must have least one option
Isn't the point of a <Generator> to NOT use any <Option> tags? So I figure this is a glitch just like External Components requiring external Java to run when you use external parameters and do what is suggested:
[HTML]
English
en_US
[/HTML]
Results in this error message:
Component preview failed.
Could not load component data XML into XMLDOM.
com.interwoven.livesite.common.xml.ValidationError mColumn[103] mLine[7] mSystemID[null] mPublicID[null] mType[ERROR] mMessage[cvc-complex-type.2.4.a: Invalid content was found starting with element 'Generator'. One of '{Option}' is expected.]
So does anybody have any input?