Re: [xml] namespace problem





On Mon, Jan 4, 2010 at 8:27 PM, Andreas Wagner <andreaswagner7 gmail com> wrote:


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?
If you don't mind that the namespaces don't appear in your nodes then you can simply parse the document with XML_PARSE_RECOVER | XML_PARSE_NOERROR. Keep in mind that this will hide other errors in the document and could bite you later!

cur = cur->xmlChildrenNode;
if (!xmlStrcmp(cur->name, (const xmlChar*) "param"){
 name = xmlGetProp(cur,(const xmlChar*) "parName");
}

// the name is never param ... its always text??
when the current node cur is parameter i try to read the attributes from the param line with:

You probably don't have a pointer to the right node, are you sure that cur->type == XML_ELEMENT_NODE? Perhaps you could use XPath to find the right nodes.


I used your original document as it is (with missing namespaces) and I was able to find the right attributes with the sample program attached to this email.

--
Emmanuel Rodriguez

Attachment: walk.c
Description: Text Data



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]