Jump to content

Decode predefined entities in XML/HTML


 Share

Recommended Posts

Well, i need decode predefined entities in XML/HTML to their original form - is there are some easy way to do it according all rules? Maybe in java or vb scipt - something like unescape() function...

http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Predefined_entities_in_XML

basically i need to convert "&" to "&" and so on

Link to comment
Share on other sites

yeah, but i already have something like this

Local $PredefinedEntitiesInXML[5][2] = [["&quot;",'"'],["&amp;","&"],["&apos;","'"],["&lt;","<"],["&gt;",">"]]
For $k = 0 To UBound($PredefinedEntitiesInXML,1) - 1
    $sSting = StringRegExpReplace($sSting,$PredefinedEntitiesInXML[$k][0],$PredefinedEntitiesInXML[$k][1])
Next

what i wanted is

$code  = "Function func_unescape(x)" & @CRLF
$code &= "func_unescape=unescape(x)" & @CRLF
$code &= "end Function"

$vbs = ObjCreate("ScriptControl")
$vbs.language="vbscript"
$vbs.addcode($code)

$sString = $vbs.run("func_unescape",$sString)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...