Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Xml childvalue tag output problem.
#1
Subtag is not output, it is output as follows.
What should I do if I want to be included in the google childvalue?

output
child=a; childvalue=abcde
child=c; childvalue=aabbcc
child=d; childvalue=?
child=b_0; childvalue=bbaacc

Function xmltest
Code:
Copy      Help
str new
str xml =
;<?xml version="1.0" encoding="utf-8" ?>
;<resources>
,;<string name="a">abcde</string>
,;<string name="c">aabbcc</string>
,;<string name="d">
,,;<a href="http://google.com">google</a>
,;</string>
,;<string name="b_0">bbaacc</string>
;</resources>

IXml x._create
x.FromString(xml)
ARRAY(IXmlNode) a
x.Path("resources" a)

int i
for i 0 a.len
,IXmlNode n=a[i].FirstChild
,rep
,,if(!n) break
,,out "child=%s; childvalue=%s" n.AttributeValue("name") n.Value()
,,n=n.Next
#2
Macro Macro2826
Code:
Copy      Help
ARRAY(IXmlNode) b
a[0].GetAll(1 b)
for(_i 0 b.len)
,XMLNODE p; b[_i].Properties(p)
,out "%.*m%i %s = %s" p.level 9 p.xtype p.name p.value
#3
child=a; childvalue=abcde
child=c; childvalue=aabbcc
child=d; childvalue=<a href="http://google.com">google</a>
child=b_0; childvalue=bbaacc

Thank you for your help.
Well I do not understand.
Example To output as, what should I do?

And
To save the xml after the removal of the blank of the child value string is, what should I do?

Ex output
childvalue=apple
to apple

↓↓↓↓↓↓↓↓↓↓↓

childvalue=apple to apple

xml new save to "test.xml"
#4
whole macro
Macro Macro2826
Code:
Copy      Help
out
str new
str xml =
;<?xml version="1.0" encoding="utf-8" ?>
;<resources>
,;<string name="a">abcde</string>
,;<string name="c">aabbcc</string>
,;<string name="d">
,,;<a href="http://google.com">google</a>
,;</string>
,;<string name="b_0">bbaacc</string>
;</resources>

IXml x._create
x.FromString(xml)
ARRAY(IXmlNode) a
x.Path("resources" a)

ARRAY(IXmlNode) b
a[0].GetAll(1 b)
for(_i 0 b.len)
,XMLNODE p; b[_i].Properties(p)
,out "%.*m%i %s = %s" p.level 9 p.xtype p.name p.value


Forum Jump:


Users browsing this thread: 3 Guest(s)