Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

java - Achieve the xml hierarchy structure having an ordered list with level numbers -


i have list of numbers represents levels in xml tree. example have folowwing list:

 0, 1, 2, 2, 1 

and xml (with 'lev' elements) needs be:

<lev>   <lev>          <lev>     </lev>      <lev>     </lev>     </lev>   <lev>   </lev> </lev> 

how can form xml having list? need recursive method, need xsl file, great having java code - parsing list.

i'm not sure if possible, having list. great! thanks.

later edit:

for above list let's introduce position too:

level     position    0        0    1        1    2        2    2        3    1        4   

if having in list number(level) x , after having number(level) y y<=x know @ point last element(s) (x, x-1, ..., y) needs closed when creating xml.

ex.:

  • when @ position 3 (level 2) know element @ position 2 (also level 2) needs closed

  • when @ position 4 (level 1) know element @ position-s 3 (level 2) , 1 (level 1) needs closed

recursion overkill this. also, there's no need "position" value. here's pseudocode solution

assume function next() returns next input value, or 0 eof.

curlevel = 0 n        = next();  {   while(curlevel <= n)   {     open tag     ++curlevel   }   n = next();   while(curlevel > n)   {     --curlevel     close tag   } } while(curlevel > 0) 

note corner case of empty input file produce 1 open/close pair. check eof different way , modify code handle if that's not desired.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -