Post by Jerry Muelver on Jan 19, 2008 20:04:36 GMT -5
I can't get xmlParser to show element values if the value is a multi-line CDATA entry:
I can't read that and get anything that's not on the same line as the key, even if I concatenate the lines with LINE INPUT:
I get this:
Am I expecting something xmlParser is not designed for?
<?xml version="1.0" ?>
<!-- ZuluPad Document -->
<ZuluDoc>
<date>1197130393</date>
<docname>
<![CDATA[]]>
</docname>
<index>
<name>Index Page</name>
<content>
<![CDATA[Home page
First page
Second page
]]>
</content>
</index>
<content>
<page>
<name>
<![CDATA[First page]]>
</name>
<content>
<![CDATA[First page
text here
Link to Second page]]>
</content>
</page>
<page>
<name>
<![CDATA[Second page]]>
</name>
<content>
<![CDATA[Second page
Text here
Link to First page
]]>
</content>
</page>
</content>
</ZuluDoc>
I can't read that and get anything that's not on the same line as the key, even if I concatenate the lines with LINE INPUT:
open "zfmin.zulu" for input as #f
while not(eof(#f))
line input #f, a$
s$ = s$ + a$
wend
print s$
close #f
xmlparser #doc, s$
print #doc key$()
call displayElements #doc, ""
end
sub displayElements #xmlDoc, indent$
indent$ = indent$ + " "
count = #xmlDoc elementCount()
for x = 1 to count
#elem = #xmlDoc #element(x)
print indent$; "Key: "; #elem key$();
value$ = #elem value$()
if value$ <> "" then
print " Value: "; value$;
end if
print
call displayElements #elem, indent$
next x
end sub
I get this:
ZuluDoc
Key: date Value: 1197130393
Key: docname Value:
Key: index Value:
Key: name Value: Index Page
Key: content Value:
Key: content Value:
Key: page Value:
Key: name Value:
Key: content Value:
Key: page Value:
Key: name Value:
Key: content Value:
Am I expecting something xmlParser is not designed for?