Seite 1 von 1

XML-Interpretation

Verfasst: Do, 28. Feb 2013 15:44
von Benz
Hi,

Gibt es von Xbase oder sonst irgendwo ein fertiges Modul zur Interpretation von XML ?
Ansonsten müsste man das ja mit Strings auseinander nehmen.

Re: XML-Interpretation

Verfasst: Do, 28. Feb 2013 16:06
von Bertram Hansen
Hallo Benz,

dafür nutze ich Funktionen und Tools aus eXpress++ von Roger Donnay.
z.B.: DC_Xml2ObjectTree() oder DC_XmlNode()

Re: XML-Interpretation

Verfasst: Do, 28. Feb 2013 16:30
von Benz
okay, gibt es sonst noch etwas ?
Kannst du mir sagen wie ich an die express komme ? :P weil wenn ich auf die Homepage http://bb.donnay-software.com/Donnay/ gehe und versuche die Demo herunterzuladen kommen nur Fehlermeldungen

Re: XML-Interpretation

Verfasst: Do, 28. Feb 2013 16:36
von Rudolf
Hallo,
von Chilkat gibts eine sehr gute DLL, ist Freeware.
Grüße
Rudolf

Re: XML-Interpretation

Verfasst: Do, 28. Feb 2013 16:39
von Jan
Geh mal hier http://www.xbwin.com/forum.html in "ot4xb.examples", und such da nach "XML". Im Suchergebnis öffnest Du "TestXmlLite".

Ich benutze den JSON-Wrapper von Pablo, der funktioniert sehr gut (wenn man erstmal verstanden hat, wie das funktioniert).

Jan

Re: XML-Interpretation

Verfasst: Do, 28. Feb 2013 16:55
von Manfred
Express++ kannst Du problemlos über www.tobax.de beziehen. Anrufen und Frau Walerius regelt dann den Rest. Kann ich nur wärmstens empfehlen das Tool.

Re: XML-Interpretation

Verfasst: Fr, 01. Mär 2013 13:00
von Benz
okay danke ich probier mal bisschen rum ;)

Re: XML-Interpretation

Verfasst: Fr, 01. Mär 2013 19:23
von azzo

Re: XML-Interpretation

Verfasst: Fr, 01. Mär 2013 21:28
von georg
Hallo, Wolfgang -


schau mal auf dieser Seite nach: http://www.alaska-software.com/download ... section=40

Der letzte Eintrag auf der Seite ist ein (schon recht betagtes) Dokument, ein XML Technote von Alaska.

Re: XML-Interpretation

Verfasst: Mo, 04. Mär 2013 22:30
von azzo
Hallo,
ein einfacher XML-View in FW und Harbour.

mfg
Otto

Code: Alles auswählen

#include "FiveWin.ch"
#include "Splitter.ch"

static oSplit1, oSplit2, oLbxDatas, oLbxMethods

//----------------------------------------------------------------------------/

function Test()

   local oWnd

   DEFINE WINDOW oWnd TITLE "XML viewer" ;
      MENU BuildMenu()

   ACTIVATE WINDOW oWnd ;
      ON INIT BuildTree( oWnd ) ;
      ON RESIZE ( If( oSplit1 != nil, oSplit1:AdjLeft(),),;
                  If( oSplit2 != nil, oSplit2:AdjRight(),) )

return nil

//----------------------------------------------------------------------------/


function BuildMenu()

   local oMenu

   MENU oMenu
      MENUITEM "About" ACTION MsgAbout( "XML Viewer", "(c) FiveTech Software 2013" )
   ENDMENU

return oMenu

//----------------------------------------------------------------------------/


function BuildTree( oWnd )

   local oTree := TTreeView():New( 0, 0, oWnd )
   local oClass, cData, cMethod
   local hFile, oXmlDoc, oXmlIter, oTagActual
   local oTagLast, aRoots := {}

   oTree:nWidth = 180
   // oTree:SetImageList( oImageList )

   oTree:Expand()

   @ 0, 186 LISTBOX oLbxDatas VAR cData ITEMS {} ;
      SIZE 200, 200 PIXEL OF oWnd

   @ 0, 391 LISTBOX oLbxMethods VAR cMethod ITEMS {} ;
      SIZE 200, 200 PIXEL OF oWnd

   @ 0, 181 SPLITTER oSplit1 ;
      VERTICAL ;
      PREVIOUS CONTROLS oTree ;
      HINDS CONTROLS oLbxDatas ;
      LEFT MARGIN 150 ;
      RIGHT MARGIN oSplit2:nLast + 100 ;
      SIZE 4, 300  PIXEL ;
      OF oWnd STYLE

   @ 0, 386 SPLITTER oSplit2 ;
      VERTICAL ;
      PREVIOUS CONTROLS oLbxDatas ;
      HINDS CONTROLS oLbxMethods ;
      LEFT MARGIN oSplit1:nFirst + 120 ;
      RIGHT MARGIN 80 ;
      SIZE 4, 300 PIXEL ;
      OF oWnd STYLE

   hFile    = FOpen( "test.xml" )
   oXmlDoc  = TXmlDocument():New( hFile )
   oXmlIter = TXmlIterator():New( oXmlDoc:oRoot )

   AAdd( aRoots, oTree )

   while ( oTagActual := oXmlIter:Next() ) != nil
      if oTagLast != nil
         if oTagLast:Depth() < oTagActual:Depth()
            ASize( aRoots, Len( aRoots ) + 1 )
            aRoots[ oTagActual:Depth() + 1 ] = aRoots[ oTagActual:Depth() ]:Add( oTagActual:cName )
            aRoots[ oTagActual:Depth() + 1 ]:Cargo = oTagActual
         endif

         if oTagLast:Depth() > oTagActual:Depth()
            aRoots[ oTagActual:depth() + 1 ] = aRoots[ oTagActual:Depth() ]:Add( oTagActual:cName )
            aRoots[ oTagActual:depth() + 1 ]:Cargo = oTagActual
         endif

         if oTagLast:Depth() == oTagActual:Depth()
            aRoots[ Max( oTagLast:Depth(), 1 ) ]:Add( oTagActual:cName ):Cargo = oTagActual 
         endif
      else
         AAdd( aRoots, oTree:Add( oTagActual:cName ) )
         ATail( aRoots ):Cargo = oTagActual
      endif
      oTagLast = oTagActual
   end

   FClose( hFile )

   oTree:bChanged = { | oItem | oLbxDatas:SetItems( { oItem:GetSelected():Cargo:cData } ),;
                                oLbxMethods:Reset(),;
                                HEval( oItem:GetSelected():Cargo:aAttributes,;
                                { | cKey, cData | oLbxMethods:Add( cKey + " : " + cData ) } ) }

return nil

//----------------------------------------------------------------------------/