Click to See Complete Forum and Search --> : Is this valid xml ?


manishrathi
01-12-2010, 08:15 PM
following snippet is taken from workflow pdf manual ts.670.wf.pdf , page 62


<?xml version="1.0" standalone="no"?>
<!DOCTYPE workflow SYSTEM "iwwf.dtd">
<template_script><![CDATA[
TAG_info(
description => "<input type='text' value='dark and stormy
night'>",
job_name => "<input type='text' value='edit story'>",
);
]]></template_script>
<workflow name="__TAG__('job_name');"
owner="__TAG__('iw_areaowner');"
description="__TAG__('description');">

in this snippet, root element is 'template_script' but then again there is another 'workflow' element. so how there be an element outside root element ? As per xml syntax rules , all the elements have to be within root elemrnt only.

Can we have a code or CDATA anywhere in the xml doc ? inside or outside root element ? If I put a code at the beginning of the document as follows is it allowed ?

<template_script><![CDATA[
TAG_info(
description => "<input type='text' value='dark and stormy
night'>",
job_name => "<input type='text' value='edit story'>",
);
]]></template_script>
<?xml version="1.0" standalone="no"?>
<!DOCTYPE workflow SYSTEM "iwwf.dtd">
<workflow name="__TAG__('job_name');"
owner="__TAG__('iw_areaowner');"
description="__TAG__('description');">


Please explain this syntax about elements outside root element.

thanks

Webnerd
01-15-2010, 07:52 PM
That is not valid XML if there is no defined root element. A root element must contain all other elements.

Scriptage
01-16-2010, 12:34 PM
It looks like this isn't supposed to be an XML document, rather part of a program that when executed generates an XML document.