Re: [xml] namespace problem
- From: Andreas Wagner <andreaswagner7 gmail com>
- To: xml gnome org
- Subject: Re: [xml] namespace problem
- Date: Mon, 4 Jan 2010 20:27:32 +0100
2010/1/4 Liam R E Quin
<liam holoweb net>
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??
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]