1

リスト(文字列)を持つフィールドを含むデータベースレコードがあります。この文字列のリストをいくつかのxhtmlに変換して表示したいと思います。

私は次の関数を書きました:

display_lp(path) = (
  do List.mapi(x, characterlp -> <div class="show_content" id=#show_content > {x} :    <textarea class="edit_content" id=#edit_content_lp cols="20" rows="1"> {characterlp} </textarea></div> ), /characters[path]/lifepaths -> y
  XMLConvert.of_list_using("","","",y)
)

ただし、コンパイルされません。それは私に構文エラーを与えます:

行 270、列 188 の構文エラー エラーは次の引用にある可能性があり、通常は赤い部分 (⚐ で始まる) またはその直前にあります: <<) void )

display_lp(パス) = ( do List.mapi(x, characterlp -> {x} : {characterlp} )⚐, /characters[パス]/lifepaths -> y XMLConvert.of_list_using("","","",y ) )

表示 (パス) = (

> ヒント: 予想 (270 行目、188 列目から解析中) エラー 構文エラー

ここで何が間違っていますか?

4

1 に答える 1

1

This is what i guess what you wanted to do :

display_lp(path) =
  y = List.mapi(
    x, characterlp ->
      <div class="show_content" id=#show_content>
      {x}:
      <textarea class="edit_content" id=#edit_content_lp cols="20" rows="1">
      {characterlp}
      </textarea>
      </div>
  , /characters[path]/lifepaths)
  XmlConvert.of_list_using(<></>,<></>,<></>,y)
  1. First, your List.mapi is mis-parenthesed

  2. Secondly, I don't understand your -> y after /characters[path]/lifepaths, i guess you wanted to put the result of List.mapi in the y variable.

  3. Third, there is a typo : this is XmlConvert and NOT XMLConvert (uppercase)

  4. Finally, XmlConvert has for signature : xhtml, xhtml, xhtml, list(xhtml)

    That means you must provide type xhtml for the first 3 arguments, which is not compatible with the type string "" :)

    The equivalent of "" in xhtml is <>

Hope that solves your problem.

于 2011-09-02T00:12:32.160 に答える