xml_parse_set_colon_replacement()

 
Syntax
xml_parse_set_colon_replacement( colon )
User Annotations: xml_parse_set_colon_replacement
Scott : cyberfunkr at, yahoo d0t com
09/23/2011 15:35 p.m.
Namespaced XML will contain colons in the nodes names such as <foo:note>. The xml_parse() function, when invoked on this data, will create structures with member names containing colons making them inaccessible. To overcome this, use xml_parse_set_colon_replacement() to convert the colon in the name to something more MivaScript friendly like an underscore.
<MvASSIGN NAME = "l.change" VALUE = "{ xml_parse_set_colon_replacement( '_' ) }">

Which turns this:
Code:
<foo:note>
	<to>Steve</to>
	<from>Janice</from>
	<heading>Reminder</heading>
	<body>Don't forget me this weekend!</body>
</foo:note>

Into this:
Code:
:FOO_NOTE:CHILDREN[1]:LINENO=3
:FOO_NOTE:CHILDREN[1]:NAME=to
:FOO_NOTE:CHILDREN[1]:OFFSET=13
:FOO_NOTE:CHILDREN[1]:VALUE=Steve
:FOO_NOTE:CHILDREN[2]:LINENO=4
:FOO_NOTE:CHILDREN[2]:NAME=from
:FOO_NOTE:CHILDREN[2]:OFFSET=29
:FOO_NOTE:CHILDREN[2]:VALUE=Janice
:FOO_NOTE:CHILDREN[3]:LINENO=5
:FOO_NOTE:CHILDREN[3]:NAME=heading
:FOO_NOTE:CHILDREN[3]:OFFSET=50
:FOO_NOTE:CHILDREN[3]:VALUE=Reminder
:FOO_NOTE:CHILDREN[4]:LINENO=6
:FOO_NOTE:CHILDREN[4]:NAME=body
:FOO_NOTE:CHILDREN[4]:OFFSET=79
:FOO_NOTE:CHILDREN[4]:VALUE=Don't forget me this weekend!
:FOO_NOTE:LINENO=2
:FOO_NOTE:NAME=foo:note
:FOO_NOTE:OFFSET=1
:FOO_NOTE:TAGS:BODY[1]:LINENO=6
:FOO_NOTE:TAGS:BODY[1]:NAME=body
:FOO_NOTE:TAGS:BODY[1]:OFFSET=79
:FOO_NOTE:TAGS:BODY[1]:VALUE=Don't forget me this weekend!
:FOO_NOTE:TAGS:FROM[1]:LINENO=4
:FOO_NOTE:TAGS:FROM[1]:NAME=from
:FOO_NOTE:TAGS:FROM[1]:OFFSET=29
:FOO_NOTE:TAGS:FROM[1]:VALUE=Janice
:FOO_NOTE:TAGS:HEADING[1]:LINENO=5
:FOO_NOTE:TAGS:HEADING[1]:NAME=heading
:FOO_NOTE:TAGS:HEADING[1]:OFFSET=50
:FOO_NOTE:TAGS:HEADING[1]:VALUE=Reminder
:FOO_NOTE:TAGS:TO[1]:LINENO=3
:FOO_NOTE:TAGS:TO[1]:NAME=to
:FOO_NOTE:TAGS:TO[1]:OFFSET=13
:FOO_NOTE:TAGS:TO[1]:VALUE=Steve
:FOO_NOTE:VALUE=