hi guyz... i just want your idea of how to detect if the tag has the close tag... im talking about HTML...
vbscript, asp, javascript, css, etc... are accepted... any codes
or just give me a link
how? pls
thanks
yeah! bling bling men...abz'
hi guyz... i just want your idea of how to detect if the tag has the close tag... im talking about HTML...
vbscript, asp, javascript, css, etc... are accepted... any codes
or just give me a link
how? pls
thanks
yeah! bling bling men...abz'
Try kuno read ani http://tidy.sourceforge.net/
madala raman basin ni og stack bai...
steps:
collect tags...
while open ang tag imo i store sa stack...
kong maka kita nakag closing tag..
imo tong i pop sa stack.. nya i compare kong parihas ba sila..
as of now bai ako lang man gud gi loop then gamit ko ug VBSCRIPT
then nag-counter ko kung pila kabouk ang open ug close
ang problema ani kay dili nako ma-trace kung asa dapit ang walay close tag...
yeah! bling bling men...abz'
madala ra og stack bai.. "last in first out"..
kong naa kai content nga..
i push nimo ang mga tag nga "open" na iyang ma agi-an..Code:ex: <tag1><tag2><tag3> some content</tag3></tag2></tag1>
<tag1>
<tag2>
<tag3> <<-- current pointer
then
kong kita na sya og closing tag </>
imo to i pop...
</tag3> POP [<tag3>] <-- compare dayon kong same bana sila og tagname... kong dili gali flag dayon og error..
</tag2> POP [<tag2>] <-- compare
</tag1> POP [<tag1>] <-- compare
kong naai subra nabilin sa stack meaning naai kulang nga tag...
kong missmatch ang tagnames... then dili balance ang tag..
for self terminating tags <tagname />
imo lang na i ignore..di nimo i process..
wa ko kabaw sa code kai di ko kamao og vbscript hehe. pro ang concept parihas ra basin..
ok bai try lang nako... hehe... libog pa gamay unsaon ni nako pag-codes...
yeah! bling bling men...abz'
i have written a simple html document obfuscater.
https://www.istorya.net/forums/index....315#msg2452315
bro, naa koi code using c# to check if balance ba ang mga tags using stack... i convert nalang ang uban fuctions/method nga available sa imong language gamiton..
like indexof == instr for VB etc..
hope this helps
Code:public void CheckTags(string sContent) { List<string> sStack = new List<string>(); int iPos1 = 0; int iPos2 = 0; bool bChecking= true; do { iPos1 = sContent.IndexOf("<",iPos2); if (iPos1 > -1) { iPos2 = sContent.IndexOf(">", iPos1); if (iPos2 > -1) { string sTagName = sContent.Substring(iPos1, (iPos2 - iPos1) + 1); //check if tag is not end tag if (sTagName.StartsWith("</")) { if (sStack.Count > 0) { string sTagFromStack = sStack[sStack.Count - 1]; sStack.RemoveAt(sStack.Count - 1); // remove the tag from out stack // strip tags to get its tagname // this may used additional stripping method if tag contains attributes like // <tag1 attribute="val"> sTagFromStack = sTagFromStack.Replace("<", ""); sTagFromStack = sTagFromStack.Replace(">", ""); sTagName = sTagName.Replace("<", ""); sTagName = sTagName.Replace("/", ""); sTagName = sTagName.Replace(">", ""); if (sTagFromStack.ToUpper() != sTagName.ToUpper()) { MessageBox.Show("EndTag: " + sTagName + " not equal to: " + sTagFromStack); } } } else if (!sTagName.EndsWith("/>") && !sTagName.StartsWith("<!")) { //Store open tags to our risizable array sStack.Add(sTagName); } } } if (iPos1 == -1 || iPos2 == -1) bChecking = false; } while (bChecking); if (sStack.Count > 0) { MessageBox.Show("DOM NOT Balance!"); } }
thanks bro.... i will try to study this...
thank you very much
yeah! bling bling men...abz'
or maybe you can download an html parsing tool.
Similar Threads |
|