HBMXML Library Help

311 views
Skip to first unread message

rathinagiri subbiah

unread,
Oct 13, 2011, 2:26:44 PM10/13/11
to Harbour Users
Hi,

Does anybody use hbmxml library?

I want to clarify a doubt.

I have an element like the below: (taken from Harbour-hbmxml test
file:test.xml

<text>Media Source</text>

Now, if I want to get the string and give the following statement

nNum := MXML_TEXT
? mxmlGetText( hNode, @nNum )

It gives only 'Media' as the result. and not the 'Media Source' (ie.,
only the first word is retrieved.)

Can you help me out?

rathinagiri subbiah

unread,
Oct 14, 2011, 1:23:45 AM10/14/11
to Harbour Users
Hi,

As of now, I have a work around.

I am using another function to get the whole node string and strip the
tag. I know it may not give the accurate result always. However, now
it is working for most of the cases.



Code:
? striptag( mxmlSaveAllocString( hElement, MXML_NO_CALLBACK ),
'link:label' )

function striptag( cStr, cTag )
local nEnd := rat( '</' + cTag + '>', cStr )
local nStart := rat( '">', cStr )
if nStart > 0 .and. nEnd > 0
return substr ( cStr, nStart + 2, nEnd - ( nStart + 2 ) )
else
return cStr
endif
return nil






On Oct 13, 11:26 pm, rathinagiri subbiah <srathinag...@gmail.com>
wrote:

Marek MOL

unread,
Oct 15, 2014, 5:21:53 PM10/15/14
to harbou...@googlegroups.com
Did anybody foundsolution for retrieving whole text value from element, not first word only?
I can not use mxmlSaveAllocString for strange double conversion from utf8 to ??? Format

M., Ronaldo

unread,
Oct 15, 2014, 6:09:08 PM10/15/14
to harbou...@googlegroups.com
   LOCAL cXml := "test.xml"
   LOCAL oXml
   LOCAL aXml := ARRAY( 10 )

   oXml := mxmlLoadString( oXml, cXML, MXML_OPAQUE_CALLBACK )

   IF !( s_mxml_error )

      // *---------------------------------------------------------------------------*
      // text
      // *---------------------------------------------------------------------------*
      IF !( Empty( aXml[ 1 ] := mxmlFindElement( oXml, oXml, "text", NIL, NIL, MXML_DESCEND ) ) )
         aXml[ 2 ] := mxmlGetOpaque( aXml[ 1 ] )
         ? aXml[ 2 ]
      ENDIF

   ENDIF


see at:
http://www.hmgforum.com/viewtopic.php?p=36100#p36100

Reply all
Reply to author
Forward
0 new messages