Hi,
thx for ur example. The example works, but not my file. An example of a real
file could be:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<example>
<header>
<channels>
<channel description="" group="can" name="headlight" path=""
recordmode="3" type="BOOLEAN" value="false"/>
<channel description="" group="can" name="light_intensity" path=""
recordmode="3" type="DOUBLE" value="0.0"/>
<channel description="" group="can" name="light_switch" path=""
recordmode="3" type="UINT8" value="0"/>
</channels>
<const/>
<parameters>
<parameter description="" exchangeMode="EXCHANGE" group=""
name="parameter_one" path="">
<pValue:scalar parName="parameter_one" type="BOOL" val="TRUE"/>
</parameter>
<parameter description="" exchangeMode="EXCHANGE" group=""
name="parameter_two" path="">
<pValue:scalar parName="parameter_two" type="BOOL" val="FALSE"/>
</parameter>
</parameters>
<assessments>
<assess description="" name="headlightOff_ok" path="" recordmode="3"
type="BOOLEAN" value="false"/>
<assess description="" group="" name="headlightOn_ok" path=""
recordmode="3" type="BOOLEAN" value="false"/>
<assess description="" name="switchAuto_ok" path="" recordmode="3"
type="BOOLEAN" value="false"/>
</assessments>
<measurments/>
<assessmentheader/>
</header>
<body>
<testlet id="0" isref="false" name="main" zoomscale="1.0">
<signature>
<input name="headlight"/>
<output name="light_intensity"/>
<output name="light_switch"/>
</signature>
<content:tpdiagram>
<state id="0" posX="235" posY="111">
<testlet id="1" isref="false" name="init light switch">
<signature>
<output name="light_switch"/>
</signature>
<content:dd/>
<scenario:group assessment="" description="" id="2" name="all
scenarios">
<scenario:dd assessment="" description="" id="3" name="off">
<eqn channel="light_switch" source="0"/>
</scenario:dd>
<scenario:dd assessment="" description="" id="4" name="on">
<eqn channel="light_switch" source="1"/>
</scenario:dd>
<scenario:dd assessment="" description="" id="17" name="auto">
<eqn channel="light_switch" source="2"/>
</scenario:dd>
</scenario:group>
</testlet>
</state>
<state id="1" posX="253" posY="321">
<testlet id="3" isref="false" name="constant light intensity">
<signature>
<output name="light_intensity"/>
</signature>
<content:dd/>
<scenario:group assessment="" description="" id="6" name="all
scenarios">
<scenario:dd assessment="" description="" id="7"
name="bright">
<eqn channel="light_intensity" source="100.0"/>
</scenario:dd>
<scenario:dd assessment="" description="" id="9" name="dark">
<eqn channel="light_intensity" source="0.0"/>
</scenario:dd>
</scenario:group>
</testlet>
</state>
<state id="2" posX="259" posY="402">
<testlet id="4" isref="false" name="changing light intensity">
<signature>
<output name="light_intensity"/>
</signature>
<content:dd/>
<scenario:group assessment="" description="" id="13" name="all
scenarios">
<scenario:dd assessment="" description="" id="14"
name="getting darker">
<signal:embedded channel="light_intensity"
chunkType="irregular" data_type="DOUBLE" endtime="60s"
linear_interpolation="true" startTime="0" time="0, 20788732, 35s, 37s,
44760564, 49112676, 60s" value="0x1.9p6, 0x1.4bp6, 0x1.ep5, 0x1.9p5,
0x1.3p4, 0x1.9p2, 0x1.4p2"/>
</scenario:dd>
<scenario:dd assessment="" description="" id="19"
name="getting lighter">
<eqn channel="light_intensity" source="[signal from 0s to
50s]"/>
</scenario:dd>
</scenario:group>
</testlet>
</state>
<state id="3" posX="455" posY="110">
<testlet id="2" isref="true" name="set light switch"
references="1">
<signature>
<output name="light_switch"/>
</signature>
</testlet>
</state>
<junction id="4" posX="75" posY="321"/>
<junction id="5" posX="77" posY="111"/>
<junction id="6" posX="80" posY="406"/>
<final id="7" posX="457" posY="353"/>
<final id="8" posX="629" posY="109"/>
<transition from="4" id="9" name="" namePosX="161" namePosY="322"
to="1">
<transspec actions="" id="1" index="0" name="default"/>
</transition>
<transition from="5" id="10" name="" namePosX="158" namePosY="109"
to="0">
<transspec actions="" id="2" index="0" name="default"/>
</transition>
<transition from="6" id="11" name="" namePosX="169" namePosY="404"
to="2">
<transspec actions="" id="3" index="0" name="default"/>
</transition>
<transition from="0" id="12" name="wait" namePosX="341"
namePosY="150" to="3">
<transspec actions="" condition="t >= 10" id="4" index="0"
name="10s"/>
</transition>
<transition from="0" id="13" name="wait" namePosX="439"
namePosY="32" to="8">
<point posX="437" posY="10"/>
<transspec actions="" condition="t >= 60" id="5" index="0"
name="60s"/>
</transition>
<transition from="1" id="14" name="" namePosX="342" namePosY="321"
to="7">
<transspec actions="" id="6" index="0" name="default"/>
</transition>
<transition from="2" id="15" name="" namePosX="358" namePosY="377"
to="7">
<transspec actions="" id="7" index="0" name="default"/>
</transition>
<transition from="3" id="16" name="wait" namePosX="556"
namePosY="149" to="8">
<transspec actions="" condition="t >= 60" id="8" index="0"
name="60s"/>
</transition>
<line yPos="226"/>
</content:tpdiagram>
<scenario:group assessment="" description="" id="0" name="all
scenarios">
<scenario:group assessment="#####ON-OFF-MODE##### #
=================== # Whenever switch is turned to OFF the lights should
be turned off immediately and stay off # immediately, i.e. after one
cycle at the latest # =================== headlight_off =
TPT.regexp([headlight(t) == false]); if
(abs(headlight_off[0].getStartTime()) <= 0.01 and
abs(headlight_off[0].getLength() - 10) <= 0.01): headlightOff_ok :=
true; headlightOff_ok.setComment("light switch OFF is
okay"); else: headlightOff_ok := false;
headlightOff_ok.setComment("switch is OFF but headlights are
on!"); # =================== # Whenever switch is turned
to ON the lights should be turned on immediately and stay on #
immediately, i.e. after one cycle at the latest #
=================== headlight_on = TPT.regexp([headlight(t) ==
true]); if (abs(headlight_on[0].getStartTime() - 10) <= 0.01 and
abs(headlight_on[0].getLength() - 60) <= 0.01): headlightOn_ok :=
true; headlightOn_ok.setComment("light switch ON is
okay"); else: headlightOn_ok := false;
headlightOn_ok.setComment("switch is ON but headlights are
off!");" description="" id="11" name="On-Off-Mode">
<scenario:tp assessment="" description="" id="1" name="headlight
off -> on (dark)" stateIds="0,1,3" subScenIds="3,9,4"
transitionIds="9,10,12,14,16" transitionSpecs="1,2,4,6,8"/>
<scenario:tp assessment="" description="" id="10" name="headlight
off -> on (bright)" stateIds="0,1,3" subScenIds="3,7,4"
transitionIds="9,10,12,14,16" transitionSpecs="1,2,4,6,8"/>
</scenario:group>
<scenario:group assessment="" description="" id="12"
name="Auto-Mode">
<scenario:tp assessment="#####AUTO-MODE-DARK##### #
=================== # When switch is in position AUTO the lights should
be turned immediately off if brightness is 70% or below # immediately,
i.e. after one cycle at the latest #
=================== headlight_off = TPT.regexp([(t >= 0.01) and
(headlight(t) == false)]); # look for failure situations, i.e.
where headlights are off if (headlight_off.getSize() == 0): # never
off switchAuto_ok := true;
switchAuto_ok.setComment("Headlights have been turned on correctly in
AUTO mode"); else: # off at least once switchAuto_ok :=
false; switchAuto_ok.setComment("It is dark in AUTO mode, but
headlights are turned off!!");" description="" id="15" name="auto
(dark)" stateIds="0,1" subScenIds="17,9" transitionIds="9,10,13,14"
transitionSpecs="1,2,5,6"/>
<scenario:tp
assessment=" #####AUTO-MODE-GETTING-DARKER##### #
=================== # When switch is in position AUTO and if the
brightness falls below 60% for at least 2 seconds, # the lights should
go on immediately # immediately, i.e. after one cycle at the
latest # =================== headlight_off = TPT.regexp([(t
>= 0.01) and (headlight(t) == false)]); headlight_on = TPT.regexp([(t
>= 0.01) and (headlight(t) == true)]); # look for failure
situations, i.e. where headlights are
off if(abs(headlight_off[0].getStartTime()) <= 0.01 and
abs(headlight_off[0].getLength() - (35 + 2)) <= 0.01 and
abs(headlight_on[0].getLength() - (60-37)) <= 0.01): switchAuto_ok
:= true; switchAuto_ok.setComment("Headlights have been turned on
correctly in AUTO mode"); else: switchAuto_ok := false;
switchAuto_ok.setComment("It is dark in AUTO mode, but headlights are
turned off!!");" description="" id="16" name="auto (getting darker)"
stateIds="0,2" subScenIds="17,19" transitionIds="10,11,13,15"
transitionSpecs="2,3,5,7"/>
</scenario:group>
</scenario:group>
</testlet>
</body>
</example>
The problem is that there are namespace (as you can see). But they are never
declared and i can not parse the file correctly. So i thought with a small
hack (insert in line two the namespace declaration with xmlns:pValue="
http://dummies.org" xmlns:content=http://example.org" xmlns:scenario="
http://thethirdone.com") but when i try to read the <pValue:scalar
parName="parameter_one" type="BOOL" val="TRUE"/> node with its attributes, i
get shit ;-) Is my declaration wrong? I can read attributes without
namespace without problems, thats not the point, but just the namespaces are
stupid.
With this line i can check that i am in the correct line of the file
cout << "in the correct line " << cur->line <<endl; // but when i try to
read the parName or the type, it is not possible
name = *xmlGetProp*(cur,(*const* xmlChar *)"type"); // name = NULL ??
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml