Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to extract the XML string
#1
How to extract the XML string.


1. I want to "<string name="?">(*.?)</string>" extract only the string.
2. If there is a "aa" and "aa" only want to change the aa string.
However, aa, which is included in the string of case aa and aab to use the find command is changed.
Only 'aa' how do I change?


<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="j">aa</string>
<string name="k">aab</string>
<string name="l">cc</string>
<string name="m">ddde</string>
<string name="n">fe</string>
<string name="o">f</string>
<string name="p">ggg</string>
<string name="q">hh1</string>
</resources>
#2
try this

Function Function6
Code:
Copy      Help
str new
str src=
;<?xml version="1.0" encoding="utf-8"?>
;<resources>
;<string name="j">aa</string>
;<string name="k">aab</string>
;<string name="l">cc</string>
;<string name="m">ddde</string>
;<string name="n">fe</string>
;<string name="o">f</string>
;<string name="p">ggg</string>
;<string name="q">hh1</string>
;</resources>
IXml x._create
x.FromString(src)
ARRAY(IXmlNode) a
x.Path("resources" a)

int i
for i 0 a.len
,IXmlNode n=a[i].FirstChild
,rep
,,if(!n) break
,,if(!StrCompare(n.Value "aa"))
,,,new ="this has been changed"
,,,,out "found"
,,,,n.Value=new
,,out "child=%s; childvalue=%s" n.AttributeValue("name") n.Value)
,,n=n.Next
#3
thank you very much. It has solved a big problem. : D


Forum Jump:


Users browsing this thread: 1 Guest(s)