我想解析完整的HTML儿童及其子女,其中我不会有任何属性ID放置标记。如何获得HTML儿童
对于如:
<html>
<head>
<script>
function blah(){
alert("hi");
}
</script>
<style>
body{
font:10px;
}
</style>
</head>
<body>
<h1> My Header </h1>
<div class="container">
<div class="colone">Hai22</div>
<div class="coltwo">Hai44</div>
</div>
</body>
</html>
现在我想分析整个HTML和获得它的孩子们一个个并将其转换成JSON字符串。 像
{
"html":{
"head":{
"script":
.
.
.
.
.
.
.
}
重复的问题:http://stackoverflow.com/questions/2303713/how-to-serialize-dom-node-to-json – Kolban 2014-11-22 16:25:19
为什么你想转换成json ..任何理由? – Girish 2014-11-22 16:26:15