Innov-AI
    Documentation | MentDB Weak Server
Parse a HTML document and get data

  • html close_all;
    html load_from_str "domId1" "<html>
    	<body id='id0'>
    		<div id='id1'>
    			data1
    			<a href='index.html'>link1</a>
    		</div>
    		<div id='id2'>
    			<div id='id3'>
    				data3
    				<a href='index.html'>link2</a>
    			</div>
    		</div>
    	</body>
    </html>";
    html element "domId1" "jsonDoc0" "id0";
    html element "domId1" "jsonDoc1" "id1";
    html element "domId1" "jsonDoc2" "id2";
    html element "domId1" "jsonDoc3" "id3";
    json doc "jsonDoc3";
  • "{
      \"nodeName\": \"div\",
      \"formVal\": \"\",
      \"ownText\": \"data3\",
      \"attributes\": {
        \"id\": \"id3\"
      },
      \"classNames\": [],
      \"html\": \"data3 
    \u003ca href\u003d\\"index.html\\"\u003elink2\u003c/a\u003e\", \"text\": \"data3 link2\", \"id\": \"id3\", \"wholeText\": \"
    \t\t\t\tdata3
    \t\t\t\tlink2
    \t\t\t\", \"tagName\": \"div\", \"outerHtml\": \"\u003cdiv id\u003d\\"id3\\"\u003e
    data3
    \u003ca href\u003d\\"index.html\\"\u003elink2\u003c/a\u003e
    \u003c/div\u003e\" }"
    ;
  • log trace "####################";
    html parse "domId1" "jsonDoc4" "TAG" "a" "" {
    
    	#Execute MQL source code here;
    	log trace (json doc "jsonDoc4");
    
    };
    log show 32;
  • "2023-08-06 13:48:59.138+0400: ####################
    2023-08-06 13:48:59.139+0400: {
      \"nodeName\": \"a\",
      \"formVal\": \"\",
      \"ownText\": \"link1\",
      \"attributes\": {
        \"href\": \"index.html\"
      },
      \"classNames\": [],
      \"html\": \"link1\",
      \"text\": \"link1\",
      \"id\": \"\",
      \"wholeText\": \"link1\",
      \"tagName\": \"a\",
      \"outerHtml\": \"\u003ca href\u003d\\"index.html\\"\u003elink1\u003c/a\u003e\"
    }
    2023-08-06 13:48:59.139+0400: {
      \"nodeName\": \"a\",
      \"formVal\": \"\",
      \"ownText\": \"link2\",
      \"attributes\": {
        \"href\": \"index.html\"
      },
      \"classNames\": [],
      \"html\": \"link2\",
      \"text\": \"link2\",
      \"id\": \"\",
      \"wholeText\": \"link2\",
      \"tagName\": \"a\",
      \"outerHtml\": \"\u003ca href\u003d\\"index.html\\"\u003elink2\u003c/a\u003e\"
    }";
Services     Supporters     Contact     About     Legal notice © 2024