hallo everyone
  I am  very new to xalan and c++. 
I have an xml node like this
<object id="1">
I want to take the attribute text(ie value 1) from the above node
in to a c++ char.
I used the following code.

        XalanNode *tmpNode=p_NodeReflist.item(iNodeCnt );
        XalanElement  const *elem = static_cast<const XalanElement*>(tmpNode);
        XalanAttr *attr = elem->getAttributeNode(XalanDOMString("id"));
        XalanDOMString xmlstr = attr->getNodeValue();
        // convert from utf-16 to utf-8
        CharVectorType       myChar8bit;
        
        TranscodeToLocalCodePage(xmlstr,myChar8bit,false);
        char*  tmpstr;
        tmpstr = (char*)malloc(sizeof(c_str(myChar8bit)));
        tmpstr = &*myChar8bit.begin();

Now i had seen that the tmpstr is a character with 16 length(ie value is 
1...... after 1 some special charcters),and I want to use this is for getting 
another node which is not working because of this return value
Bye

Jimmy






-----Urspr�ngliche Nachricht-----
Von: Tobias Sch�tte [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 09. M�rz 2005 13:57
An: [email protected]
Betreff: AW: XalanDOMString Issue: Program Terminates upon Construction.


> However I have been experiencing strange results when trying to use
the
> XalanDOMString component, whenever the constructor is called it causes
> the program to instantly terminate.

XalanDOMString's dtor is called after ...::Terminate and the default
memory mgr that holds the string data was already deleted while
XalanDOMString destructor calls mgr->deallocate() on its bogus mem mgr
ptr when the XalanDOMString leaves the scope.

try out:

XMLPlatformUtils::Initialize();
XalanTransformer::initialize();

{
        // Generate an instance of a XalanDOMString...
        std::string path("/HOME/PTHOMAS/");
        XalanDOMString test = XalanDOMString(path.c_str());
}

// Terminate the various components.
XalanTransformer::terminate();
XMLPlatformUtils::Terminate();
XalanTransformer::ICUCleanUp();




tobias





Reply via email to