The parent of the param Node where i should be is definitively parameter and
the child must be param and i am in the correct line ( cur->line).

2010/1/4 Rob Richards <[email protected]>

> Andreas Wagner wrote:
>
>>
>>
>> 2010/1/4 Liam R E Quin <[email protected] <mailto:[email protected]>>
>>
>>
>>    On Mon, 2010-01-04 at 17:35 +0100, Andreas Wagner wrote:
>>
>>    > <param parName="parameter1" type="DOUBLE" val="0.0"/>    <-----
>>    these
>>    > attributes ... but i cant ...strange ... the line above works
>>
>>    > do u have an idea what can be wrong?
>>
>>    Note that unprefixed attributes are not in any namespace.
>>
>>
>> I know, but i removed every namespace to test if i can get the attributes
>> of the param line, but i cant? and i do not know why. Some posts before i
>> send an example how the file looks like. I can read the variables and
>> constants in the header, but NOT the parameter.
>>
>>    > 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
>>    you need to fix the file. A possible way to do that would be to make a
>>    DTD with some FIXED attribute values declared, to add the
>>    "xmlns:scenario=..." and so forth.  Another might be to use
>>    entities in a wrapper,
>>    <!DOCTYPE wrapper [
>>     <!ENTITY include SYSTEM "myfile.xml">
>>    ]>
>>    <wrapper>&example;</wrapper>
>>
>>    With libxml, you may also be able to do this with xinclude.
>>
>>
>> It get the files like they are and just need to get the attribute values
>> in namespaces and without namespaces (like in my example i post). I added to
>> the root node the namespaces and so i can parse the file correctly. But the
>> params like in my example are in a namespace <pValue:scalar ...> and i need
>> the attributes from this line. But now i removed the namespaces just for
>> testing but i can not get the attributes from these "normal" nodes ( example
>> above with parName and type).
>>
>>
>> <parameters>
>>  <parameter>
>>    <param parName="parameter1" type="BOOL" value="true"/>
>>  </parameter>
>> </parameters>
>>
>> when the current node cur is parameter i try to read the attributes from
>> the param line with:
>>
>> cur = cur->xmlChildrenNode;
>> if (!xmlStrcmp(cur->name, (const xmlChar*) "param"){
>>  name = xmlGetProp(cur,(const xmlChar*) "parName");
>> }
>>
>> // the name is never param ... its always text??
>>
>>
>>
>
> You should run it through a debugger and make sure you are on the correct
> element when trying to access the attributes because based on your example
> the first child node of parameter is going to be a text node (linefeed) so
> obviously your xmlStrcmp comparison is going to fail. The sibling of that
> would be the param element.
>
> Rob
>
>
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml

Reply via email to