8
I imagine frameworks usually do the following to create a simple text field:
$campoTexto = new CampoTexto("nomeDoCampo", "valorDoCampo");
$campoTexto->gera();
The result would be:
<input type="text" name="nomeDoCampo" value="valorDoCampo">
My question is the following, is there any class/function that does a reverse engineering of the above code? I imagine something like this:
$tag = new ObjetoMilagroso("<input type=\"text\" name=\"nomeDoCampo\" value=\"valorDoCampo\">");
print $tag->type . " - " . $tag->name . " - " .$tag->value;
The result:
input - fieldName - fieldValue
Very interesting you could create a library with functions of this type to download NET.
– Rogers Corrêa
This is possible with a parser of HTML (as
DOMDocument
), but are you sure you need it? There’s no way around it?– bfavaretto
From a look at xml processors, after all html is an "xml", with its tags and attributes
– Fernando Leal
Is there an objective or is it just curiosity? It is even possible to build a specific domain framework, but it would take a certain amount of work.
– Bruno Augusto