• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
RE: problem in getting WString Attribute
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: problem in getting WString Attribute


  • Subject: RE: problem in getting WString Attribute
  • From: "Ivan Cavero Belaunde" <email@hidden>
  • Date: Thu, 27 Jul 2006 10:37:21 -0700
  • Thread-topic: problem in getting WString Attribute

XMLCh and wchar_t are not synonymous under Xcode; XMLCh is 16 bits wide, typedef'd from unsigned short, while wchar_t is 32 bits wide. Since getAttribute returns a const XMLCh*, this shouldn't even be compiling (std::wstring doesn't have a constructor that matches XMLCh*). Unless, of course, you've changed wchar_t to be a short with -fshort-wchar, in which case you have to provide all the wchar_t library functions yourself (which may explain the app termination problem if you're weak-linking against those functions; you're trying to call unresolved symbols).

Another approach is to typedef something like this:

#if TARGET_OS_MAC
typedef UniChar utf16char;
typedef std::basic_string<UniChar> utf16string;
#elif _WIN32
typedef wchar_t utf16char;
typedef std::wstring utf16string;
#endif

And use utf16char/utf16string everywhere instead of explicitly referencing wchar_t and std::wstring. I believe UniChar and XMLCh are synonymous under Xcode (both are unsigned shorts).

-Iván
---
Iván Cavero Belaunde (email@hidden)
Flash Video Architect
Adobe Systems Inc.

> -----Original Message-----
> From: xcode-users-bounces+icavero=email@hidden [mailto:xcode-
> users-bounces+icavero=email@hidden] On Behalf Of Aby
> Sent: Thursday, July 27, 2006 2:58 AM
> To: xcode-users at apple.com
> Subject: problem in getting WString Attribute
>
> Hi,
>
>     I am porting one application to mac OS X from windows. Windows
> application is using xerces, I haven't used xerces earlier,   now
> downloaded the source and made a framework and included in the
> project....., but my application terminate from the following funtion
> GetWStringAttribute()
>
> //------------
>
> std::wstring GetWStringAttribute( DOMNode* pnode, char* pAttributeName)
> {
>      DOMElement* pElement = static_cast<DOMElement*> (pnode);
>      return std::wstring( pElement -> getAttribute( Transcode (
> pAttributeName)));
> }
>
> //-------------
>
> XMLCh* Transcode( const char* pstr )
> {
>         static  XMLCh   achBuffer[2048];
>         XMLString::transcode(pstr,  achBuffer,2047);
>         return achBuffer;
> }
>
> //--------------
>
> could anyone please she
>
> thanking in advance
>
> Aby
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Xcode-users mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >problem in getting WString Attribute (From: Aby <email@hidden>)

  • Prev by Date: Re: XCode, Subversion and Nib files
  • Next by Date: Array Byte swapping with SSE
  • Previous by thread: problem in getting WString Attribute
  • Next by thread: How do I create apps with the Pro grey interfaces ?
  • Index(es):
    • Date
    • Thread