Superfish - how it loads list elements?

Superfish - how it loads list elements?

I have a bit general question and a bit problem with Superfish. I have this kind the structure of menu:

PageA
      SubPageA1
PageB
      SubPageB1
      SubPageB2
...

s I'm also writing a small php script to auto generate list elements for menu, I need to know how Superfish is remaking this kind of structure under specified html tags. To say it simpler - I used this kind a list

  1. <ul class="sf-menu">
  2.     <li class="sf-menu"><ul class="sf-menu"><li class="sf-menu"><a class="sf-menu" href=
    PageA">PageA</a></li>
  3.     <li class="sf-menu"><a class="sf-menu" href="SubPageA1">SubPageA1</a></li>
  4.         </ul>
  5. </ul>
and get no menu ( nothing shown, but all elements are in source of page ).

When I used this kind of code:
  1. <ul class="sf-menu">
  2.     <ul class="sf-menu"><li class="sf-menu"><li class="sf-menu"><a class="sf-menu" href=
    PageA">PageA</a></li>
  3.     <li class="sf-menu"><a class="sf-menu" href="SubPageA1">SubPageA1</a></li>
  4.         </ul>
  5. </ul>
I also get nothing.

And when I got this code, I got, obviously, got nice menu, but all on the same, main level.

  1. <ul class="sf-menu">
  2.     <li class="sf-menu"><li class="sf-menu"><a class="sf-menu" href="PageA">PageA</a></li>
  3.     <li class="sf-menu"><a class="sf-menu" href="SubPageA1">SubPageA1</a></li>
  4. </ul>

How should I distribute the ul and li marks to have the needed, drop-down structure?