VS:GetCDATA

From Vectorworks Developer
Jump to: navigation, search

.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix

Description

Retrieves the CDATA section of the specified element. The parameter elementPath is specified as a path of element names.
FUNCTION GetCDATA(
XMLHandle  :LONGINT;
elementPath  :STRING;
VAR returnVal  :DYNARRAY [] OF CHAR) :INTEGER;
def vs.GetCDATA(XMLHandle, elementPath):
    return (INTEGER, returnVal)

Parameters

XMLHandle LONGINT
elementPath STRING
returnVal DYNARRAY [] OF CHAR Output parameter.

Example

VectorScript

PROCEDURE test;
VAR 	xml : LONGINT;
	err : INTEGER;
	mem : DYNARRAY OF CHAR;
	value : STRING;
	cdata : DYNARRAY OF CHAR;

BEGIN
	mem := '<root><value>34</value><data><![CDATA[custom data]]></data></root>';

	xml := InitXML;	

	err := ReadXMLMemory( xml, mem );
	err := GetElementValue( xml, '/root/value', value );
	err := GetCDATA( xml, '/root/data', cdata );


	AlrtDialog( Concat( 'value=', value, ' cdata=', cdata ) );

	err := ReleaseXML( xml );
END;
RUN(test);

Python

def test():
	mem = '<root><value>34</value><data><![CDATA[custom data]]></data></root>'
	xml = vs.InitXML()
	err = vs.ReadXMLMemory( xml, mem )
	err, value = vs.GetElementValue( xml, '/root/value' )
	err, cdata = vs.GetCDATA( xml, '/root/data',  )

	vs.AlrtDialog( vs.Concat( 'value=', value, ' cdata=', cdata ) )
	err = vs.ReleaseXML( xml )

test()

Version

Availability: from All Versions

This is drop-in function.

See Also

VS:SetCDATA
[[VS:SetCDATA]]
Personal tools
NamespacesFFFF

Variants
Actions
Advanced Search
See Also
Navigation
Toolbox