[xml] xmlValidNormalizeAttributeValue trouble

Hi all,
I have trouble with xmlValidNormalizeAttributeValue. It returns me always
NULL (in older version of libxml2 it return something different, but it is
I take a look at libxml2 valid source code and it looks, that this function
works only if namespace is defined. Is it true? I don't find anybody about 
this in API documentation.

I list example of my code (in shortcut version):

// firs I parse the file
        xmlDocPtr doc = xmlParseFile("file.xml");
// getting root element
        xmlNodePtr root = xmlDocGetRootElement(doc);
// creating root element attribute
        xmlNewProp(root, (xmlChar *)"attribute", (xmlChar *)"value");
// now I can change value of this created attribute and I need normalize it
        xmlChar * newValue = xmlValidNormalizeAttributeValue(doc, root,\
        (xmlChar *)"attribute", (xmlChar *)"New_value");

I thing that now may be "New_Value" in newValue variable, but there is NULL.
What is wrong?

I tested it on XML documents with DTD and on XML documents without DTD and there
is still NULL (there is NULL if I enter valid value and there is NULL if I
enter non-valid value).

Libxml2-2.5.11, gcc 3.3, platform: Red Hat 7.3, Red Hat 8.0, FreeBSD

(On libxml2-2.5.8 it is the same just it doesn't return NULL, but it return
"nothing" (not NULL and not empty string - I don't test it more thoroughly.

Petr Novak, Liberouter Project (www.liberouter.org)
Petr Novak
E-mail: novak merlot ics muni cz

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