cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically create enumeration values in xsd

blijevis
Champ in-the-making
Champ in-the-making
Hello,

I am creating a webform for creating games. But a game must be connected to a tournament. Now I would like to create a dropdownlist in my xsd, with the enumeration values dynamically created based on the previously created tournaments, so the user can only select an existing tournament. Can somebody get me started on how to read all the tournament xml's, and insert the name of the tournament in my games webform?

Thanks

Eric
1 REPLY 1

jbilderback
Champ in-the-making
Champ in-the-making
I have not done this myself, but the Alfresco WCM 2.1 Product Evaluation Guide has an example of this.  The example is a press release web form that allows you to select a company footer from previously entered company footer xml.  There is a CompanyFooterBean class that looks up the xml.



public static List<CompanyFooterBean> getCompanyFooterChoices(final PageContext pageContext)
053          throws Exception
054       {
055          final FormDataFunctions ef =
056             new ServletContextFormDataFunctionsAdapter(pageContext.getServletContext());
057   
058          final Map<String, Document> entries =
059             ef.parseXMLDocuments("company-footer", "/media/releases/content");
060          final List<CompanyFooterBean> result = new ArrayList<CompanyFooterBean>(entries.size());
061          for (Map.Entry<String, Document> entry : entries.entrySet())
062          {
063             final String fileName = entry.getKey();
064             final Document d = entry.getValue();
065             final Element n = (Element)d.getElementsByTagName("pr:name").item(0);
066             result.add(new CompanyFooterBean(n.getFirstChild().getNodeValue(),
067                                              fileName));
068          }
069          return result;
070       }
071