Graphical Dynamics user community

Get tech support, suggest new features ... let's help each other get the most out of AutoIntern.
It is currently September 9th, 2010, 1:11 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: unicode in xml files assembled w/DOM Extender
PostPosted: February 10th, 2010, 2:30 pm 
Offline

Joined: September 12th, 2008, 1:43 pm
Posts: 5
Here are some functions I use to accept unicode chars:
(Thought it would be greedy to keep it to myself)

Code:
#Definefunction addNode(parent,name,value)
   if ChrUnicodeToString(value)!=value then value=ChrUnicodeToHex(value)
   if value == "" then newnode=DOMCreateElement(name)
      else newnode=DOMCreateElement(name,value)
   DOMAppendChild(parent,newnode)
   return newnode
#Endfunction
#Definefunction hex2Uni(value)
   return ChrHexToUnicode(value)
#Endfunction
#Definefunction setUniAttr(node,attr,value)
   if ChrUnicodeToString(value)!=value || StrClean(value,'"',"",@FALSE,2)!="" then value=ChrUnicodeToHex(value)
   DOMSetAttr(node,attr,value)
   return
#Endfunction
#Definefunction getUniAttr(node,attr)
   value=DOMGetAttr(node,attr)
   if StrTypeInfo(StrTypeInfo(value,0),-1)=="HexDg" && StrCmp(value,strupper(value))==0 && strlen(value)>3 then value=hex2Uni(value)
   return value
#Endfunction
#Definefunction setUniInnerText(node,value,def)
   if ChrUnicodeToString(value)!=value || StrClean(value,'</>',"",@FALSE,2)!="" then value=ChrUnicodeToHex(value)
   DOMSetInnerHTML(node,value,def)
   return
#Endfunction
#Definefunction getUniInnerText(node)
   value=DOMGetInnerText(node)
   if StrTypeInfo(StrTypeInfo(value,0),-1)=="HexDg" && StrCmp(value,strupper(value))==0 && strlen(value)>3 then value=hex2Uni(value)
   return value
#Endfunction
#Definefunction getElementByAttrValue(parentnode,nodename,attrname,value)
   nodelist=DOMChildElementItemize(parentnode,nodename)
   for i=1 to itemcount(nodelist,@TAB)
      curitem=itemextract(i,nodelist,@TAB)
      if strlower(getUniAttr(curitem,attrname))==strlower(value) then return curitem
   next
   return @FALSE
#Endfunction


have fun,
-Trent


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group