Create a xml document

hi !

i tried the giraffe example to do a xml document with visual basic 6

[quote] // create an outer node called "ANIMALS"
XmlElement animalsList (“ANIMALS”);

for (int i = 0; i < numAnimals; ++i)
    // create an inner element..
    XmlElement* giraffe = new XmlElement ("GIRAFFE");

    giraffe->setAttribute ("name", "nigel");
    giraffe->setAttribute ("age", 10);
    giraffe->setAttribute ("friendly", true);

    // ..and add our new element to the parent node
    animalsList.addChildElement (giraffe);

// now we can turn the whole thing into a text document..
String myXmlDoc = animalsList.createDocument (String::empty);


but i get this :

[quote]error C2664: ‘void __thiscall juce::XmlElement::setAttribute(const unsigned short *const ,const class juce::String &)’ : cannot convert parameter 1 from ‘char [5]’ to 'const un
signed short *const '[/quote]

This error is caused by using the unicode build of juce and your application isn’t unicode

you have a few options:
rebuild juce as not unicode (its a flag in config.h)
build your app as unicode


use the T("") macro to convert your strings to whatever type of strings juce is using.

giraffe->setAttribute (T(“name”), T(“nigel”));

put T( ) around all your strings… so “GIRAFFE” would be written as T(“GIRAFFE”)

It works !
Thanks for your help !