Tag Content Extractor

  • + 0 comments

    I don't like this challenge. It has at least three (!) unstated constraints on the input:

    1. the content can not be an empty string
    2. the tag name can not be an empty string
    3. tags itself can not be content in all cases

    To make clear what I mean, let me show you how the outputs should look like according to the challenge rules.


    Empty content:

    input:

    <a></a>
    

    output:

    
    

    So an empty line instead of None.


    Empty tag name:

    input:

    <>abc</>
    

    output:

    abc
    

    So abc and instead of None.


    Tags as content:

    input:

    <a>...</a>...</a>
    

    output:

    ...
    ...</a>...
    

    So two lines instead of one. In the first line the first </a> is interpreted as closing tag. In the second line the first </a> is interpreted as part of the content and the second as closing tag.


    Please repair this challenge.