c# - How to fix missing HTML<open> & <close> tags in middle of HTML string -


i have validate html string in project,

i have html :

<ul>     <li>test 1</li>     <ol>         <li>test 2</li>             </ol>     <li>test 1</li> </ul> 

required output :

<ul>     <li>test 1</li> </ul> <ol>     <li>test 2</li> </ol> <ul>     <li>test 1</li> </ul> 

in html code </ul> , <ul> tags missing. in case how search missing tag , how insert appropriate ending tag , beginning tags in proper places.

i tried html agility pack , tidy library, couldn't find better solution issue.

using dom manipulation library, need create ruleset describing elements can children of <ul> element. iterate on of children, , when find child (<ol>) that's not allowed, move subsequent children, including <ol> child, parent of <ul> element, placing @ index of <ul> element + 1.


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -