XML viewer

Re: XML viewer

Postby Marc Vanzegbroeck » Sun Mar 03, 2013 8:28 am

Antonio Linares wrote:Marc,

Could you post your XML file here ? Or send it to me by email, thanks :-)


Just sended by email..
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: XML viewer

Postby Antonio Linares » Sun Mar 03, 2013 10:39 am

Marc,

Your XML has two incorrect characters at the beginning, not visibles, but make the XML functions to fail:

Please edit your XML file in hex mode (or binary mode) and remove the leading FF FE chars:

Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42092
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: XML viewer

Postby Marc Vanzegbroeck » Sun Mar 03, 2013 10:52 am

Antonio,

Thank you.
After deleting the FF and FE, I had the same problem.
Then I opened it with notepath, and saved it as an ANSI-file, and it works :D
This action also removed also the FF and FE!!
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: XML viewer

Postby Antonio Linares » Sun Mar 03, 2013 11:00 am

Very good :-)

Yes, I just noticed too, that there were zeroes after each char. I removed them this way:

MemoWrit( "test.xml", StrTran( SubStr( MemoRead( "test.xml" ), 3 ), Chr( 0 ), "" ) )

anyhow your notepad solution is even simpler :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42092
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: XML viewer

Postby Marc Vanzegbroeck » Sun Mar 03, 2013 11:05 am

Antonio Linares wrote:Very good :-)

Yes, I just noticed too, that there were zeroes after each char. I removed them this way:

MemoWrit( "test.xml", StrTran( SubStr( MemoRead( "test.xml" ), 3 ), Chr( 0 ), "" ) )

anyhow your notepad solution is even simpler :-)


Antonio,

Since I want to import more than 8000 XML-files in my program, I think it's better and faster to use
Code: Select all  Expand view
MemoWrit( "test.xml", StrTran( SubStr( MemoRead( "test.xml" ), 3 ), Chr( 0 ), "" ) )
than opening each file and save it again as ansi :lol:

I will search a way to convert if from UNICODE to ANSI in my code.
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: XML viewer

Postby cdmmaui » Wed Mar 06, 2013 8:36 pm

Hi Antonio,

I am using your XML viewer to load XML data to DBF (DBFCDX). However, when I load the XML data to the DBF it is corrupting the DBF. What could be causing that?

I use a back up of the structure and rename the corrupted DBF then run a DBF fix program that performs the following

function __dbFix( cSource, cDestination )
cDb = cDestination
DO WHILE (.T.)
USE (cDb) NEW EXCLUSIVE
IF NETERR()
MsgAlert( 'Unable to open ' + UPPER( cDb ) + ', process aborted...' )
lFail := .T.
ENDIF
EXIT
ENDDO
IF lFail
RETURN (.F.)
ENDIF
APPEND FROM (cSource)
nTotRec := (cDb)->( reccount() )
DbCloseAll()
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Re: XML viewer

Postby Antonio Linares » Thu Mar 07, 2013 8:35 am

Darrell,

Please post the code that you use to port your data from the XML to the DBF

Probably there are invalid chars i.e. chr( 255 ) or similars in the data read from the XML

Is it the same XML file that you emailed me ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42092
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: XML viewer

Postby cdmmaui » Thu Mar 07, 2013 8:47 am

Hi Antonio,

Here is code, I am e-mailing XML to you


#include "FiveWin.ch"

//----------------------------------------------------------------------------//
function _PashaIn( oSay1, oSay2 )

local lFail := .F. , ;
cSkipped := '' , ;
cSource := "C:\Winapps\vessel\xml\inbox\" , ;
cHistory := "C:\Winapps\vessel\xml\inbox\history\" , ;
nXmlCnt := 0 , ;
lXmlOk := .F.

IF Plive
cSource := "C:\Winapps\websvc\inbound\"
cHistory := "C:\Winapps\websvc\inbound\history\"
ENDIF

// Open...
IF ! _db( Pdd, "bkgreq" )
RETURN (.F.)
ENDIF
IF ! _db( Pdd, "bkgdet" )
RETURN (.F.)
ENDIF

// Init...
aXmlFile := Directory( cSource + "*.XML" )

FOR nXml1=1 TO LEN(aXmlFile)

// Message...
oSay1:SetText( LTRIM( STR( ROUND( (nXml1/LEN(aXmlFile))*100, 0), 3) ) + '% . . . Parsing XML ' + cSource + aXmlFile[nXml1,1] )
SysRefresh()

// Process...
lXmlOk := _XmlRead2( cSource + aXmlFile[nXml1,1], @oSay1, @oSay2 )

// Copy...
IF lXmlOk
cC1 := cSource + aXmlFile[nXml1,1]
cC2 := cHistory + aXmlFile[nXml1,1]
COPY FILE (cC1) TO (cC2)

// Delete...
IF FILE( cC2 )
FERASE( cC1 )

// Counter...
nXmlCnt++
ENDIF
ENDIF
NEXT nXml1
DbCloseAll()

// Message...
oSay1:SetText( 'XML Processed = ' + LTRIM( TRANSF( nXmlCnt, "999,999" ) ) )
oSay2:SetText( 'Process Complete...' )
SysRefresh()

RETURN nil

//-----------------------------------------------------------------------------
function _XmlRead2( cFileName, oSay1, oSay2 )

LOCAL hFile , ;
oXmlDoc , ;
oXmlIter , ;
oTagActual

// Init...
cSenderDocumentId := ""
cDocTransDate := ""
cDetailCount := ""
cSenderName := ""
cDetailId := ""
cDetailAction := ""
cPashaShipmentId := ""
cShipmentNumber := ""
cDetailCarrier := ""
cDetailFirst := ""
cDetailLast := ""
cDetailPhone := ""
cDetailEmail := ""
cDetailWtCode := ""
cDetailVolCode := ""
cDetailVolume := ""
cDetailGrossWt := ""
cDetailTareWt := ""
cDetailNetWt := ""
cDetailPieces := ""
cDetailTotalPcs := ""
cDetailBkgDate := ""
cDetailDelvDate := ""
cDetailTranspId := ""
cDetailTransitId := ""
cDetailCtnrType := ""
cDetailContract := ""
cDetailClauses := ""
cDetailMoveType := ""
cDetailDesc := ""
cDetailCharges := ""
cDetailDocType := ""
cDetailDocRate := ""
cDetailPackage := ""
cDetailFrtPay := ""
cDetailPlaceRel := ""
cDetailItemCode := ""
cDetailPCtnrId := ""
cDetailContainer := ""
cDetailSeal := ""
cDetailSize := ""
cPashaGbl := ""
cPashaBkgNo := ""
cPashaExtNo := ""
cShipName := ""
cShipAdd1 := ""
cShipAdd2 := ""
cShipCity := ""
cShipState := ""
cShipZip := ""
cShipCountry := ""
cConsName := ""
cConsAdd1 := ""
cConsAdd2 := ""
cConsCity := ""
cConsState := ""
cConsZip := ""
cConsCountry := ""
cNotiName := ""
cNotiAdd1 := ""
cNotiAdd2 := ""
cNotiCity := ""
cNotiState := ""
cNotiZip := ""
cNotiCountry := ""
cForwName := ""
cForwAdd1 := ""
cForwAdd2 := ""
cForwCity := ""
cForwState := ""
cForwZip := ""
cForwCountry := ""
cEtd1 := ""
cEtdTime1 := ""
cEtd2 := ""
cEtdTime2 := ""
cEta := ""
cEtaTime := ""
cSteamshipLine := ""
cVessel := ""
cVoyage := ""
cEtdTime := ""
cPortOfDeparture := ""
cPortOfArrival := ""
cDetailDestArea := ""
cDetailDestBase := ""
Mcustid := "PASHAINTL"
Magentid := "PASHAUSCZL"
nDetailId := 0
cXmlOutBox := "c:\winapps\vessel\xml\outbox\"
cXmlOutHist := "c:\winapps\vessel\xml\outbox\history\"
cResponseType := "A"
nXml := 1
lFail := .F.
dDocRecvDate := DATE()
cDocRecvTime := TIME()
aXml997 := {}
nBkgRec := 0
nDetRec := 0
cSerial := ""
cSiId := ""
nDetCnt := 0
cResponseMessage := ""
cName := ""
cType := ""
cAddress1 := ""
cAddress2 := ""
cCity := ""
cState := ""
cZip := ""
cCountry := ""
lTransitXmlKey := .F.

If ! FILE(cFileName)
RETURN (.F.)
Endif

IF Plive
cXmlOutBox := "C:\winapps\websvc\outbound\"
cXmlOutHist := "C:\winapps\websvc\outbound\history\"
ENDIF

// Open...
hFile := FOPEN( cFileName )

// Init...
oXmlDoc := TXmlDocument():New( hFile )
oXmlIter := TXmlIterator():New( oXmlDoc:oRoot )

WHILE .T.
oTagActual = oXmlIter:Next()
If oTagActual != nil
_XmlParse( oTagActual:cName, oTagActual:cData )
HEval( oTagActual:aAttributes, { | cKey, cValue | _XmlParse( cKey, cValue, oTagActual:cName ) } )
ELSE
EXIT
ENDIF
END

FClose( hFile )

// Process 997...
IF (nBkgRec>0)
_Xml997( nBkgRec, @oSay1, @oSay2, cResponseType )
ENDIF

RETURN (.T.)

//-----------------------------------------------------------------------------
FUNCTION _XmlParse( cKeyName, cKeyValue, cTagName )

local cKeyName1 := "" , ;
cKeyValue1 := "" , ;
cTagName1 := ""

IF PCOUNT()<3
cTagName := ""
ENDIF
IF cKeyName=nil
cKeyName := ""
ENDIF
IF cKeyValue=nil
cKeyValue := ""
ENDIF

// Init...
cTagName1 := UPPER( cTagName )
cKeyName1 := UPPER( cKeyName )
cKeyValue1 := UPPER( cKeyValue )

DO CASE
CASE cKeyName1=="SENDERDOCUMENTID"
cSenderDocumentId := cKeyValue1

CASE cKeyName1=="DOCUMENTTRANSMISSIONDATE"
cDocTransDate := cKeyValue1

CASE cKeyName1=="DETAILCOUNT"
cDetailCount := cKeyValue1

CASE cTagName1=="SENDER" .AND. cKeyName1=="FULLNAME"
cSenderName2 := cKeyValue1

CASE cKeyName1=="DETAIL" // Process Here...
IF ! EMPTY( ALLTRIM(cPashaBkgNo) )

// Open...
_db( Pdd, "bkgreq" )
_db( Pdd, "bkgdet" )

// Init...
nBkgRec := 0
nDetRec := 0
cSerial := ""
cSiId := ""
nDetCnt := 0

SELECT bkgreq
GO TOP
DO WHILE ! EOF()
IF ALLTRIM(bkgreq->pbno)==ALLTRIM(cPashaBkgNo)
nBkgRec := bkgreq->( recno() )
cSiId := ALLTRIM( bkgreq->siid )
cSerial := ALLTRIM( bkgreq->serial )
EXIT
ENDIF
SKIP
ENDDO

IF ! EMPTY( cSerial )
SELECT bkgdet
GO TOP
DO WHILE ! EOF()
IF ALLTRIM( bkgdet->serial )==cSerial
nDetRec := bkgdet->( recno() )
FOR nX1=1 TO 15
cTmp := RIGHT( "00" + LTRIM(STR(nX1,9)), 2)
IF ( ALLTRIM( bkgdet->pashacid&cTmp )== cDetailPCtnrId )
nDetailId := nX1
EXIT
ENDIF
NEXT nX1
IF (nDetRec>0)
EXIT
ENDIF
ENDIF
SKIP
ENDDO
ENDIF

// Get available record...
IF (nDetRec>0) .AND. (nDetailId<1)
SELECT bkgdet
GO nDetRec
FOR nX1=1 TO 15
cTmp := RIGHT( "00" + LTRIM(STR(nX1,9)), 2)
IF EMPTY( ALLTRIM( bkgdet->pashacid&cTmp ) )
nDetailId := nX1
EXIT
ENDIF
NEXT nX1
ENDIF
IF (nDetRec=0)
nDetailId := 1
ENDIF

// Init...
IF EMPTY( cSerial )
cSerial := _AsnNumber( Mcustid, "SERIAL" )
ENDIF
IF EMPTY( cSiId )
cSiid := _AsnNumber( Mcustid, "SHIPINST" )
ENDIF

// Update Header...
SELECT bkgreq
IF (nBkgRec<1)
APPEND BLANK
bkgreq->customer := Mcustid
bkgreq->agentid := Magentid
bkgreq->serial := cSerial
bkgreq->siid := cSiId
bkgreq->pbno := cPashaBkgNo
bkgreq->sireqtype := "9"
bkgreq->sireqdate := DATE()
bkgreq->sireqtime := TIME()
bkgreq->adduser := "PASHA WEB SERVICES"
bkgreq->adddate := DATE()
bkgreq->addtime := TIME()
ELSE
GO nBkgRec
ENDIF
DO WHILE (.T.)
IF bkgreq->( rlock() )
bkgreq->service := _Clean( cDetailMoveType )
bkgreq->ctref := cDetailContract
bkgreq->scac := _Map2Pasha( "PASHACARRIER", _Clean( cSteamshipLine ) )
bkgreq->vessel := _Clean( cVessel )
bkgreq->voyage := _Clean( cVoyage )
bkgreq->portload := _Map2Pasha( "PASHAPORT" , _Clean( cPortOfDeparture ) )
bkgreq->portload2 := _Map2Pasha( "PASHAPORT2", _Clean( cPortOfDeparture ) )
bkgreq->portdisc := _Map2Pasha( "PASHAPORT" , _Clean( cPortOfArrival ) )
bkgreq->portdisc2 := _Map2Pasha( "PASHAPORT2", _Clean( cPortOfArrival ) )
bkgreq->etd := CTOD( SUBSTR( cEtd1, 6, 2 ) + "/" + SUBSTR( cEtd1, 9, 2 ) + "/" + LEFT( cEtd1, 4 ) )
bkgreq->eta := CTOD( SUBSTR( cEta, 6, 2 ) + "/" + SUBSTR( cEta, 9, 2 ) + "/" + LEFT( cEta, 4 ) )
bkgreq->shipname := _Clean( cShipname )
bkgreq->shipadd1 := _Clean( cShipadd1 )
bkgreq->shipadd2 := _Clean( cShipadd2 )
bkgreq->shipcity := _Clean( cShipcity )
bkgreq->shipst := _Clean( cShipstate )
bkgreq->shipzip := _Clean( cShipZip )
bkgreq->shipiso := _Clean( cShipCountry )
bkgreq->consname := _Clean( cConsname )
bkgreq->consadd1 := _Clean( cConsadd1 )
bkgreq->consadd2 := _Clean( cConsadd2 )
bkgreq->conscity := _Clean( cConscity )
bkgreq->consst := _Clean( cConsstate )
bkgreq->conszip := _Clean( cConsZip )
bkgreq->consiso := _Clean( cConsCountry )
bkgreq->notiname := _Clean( cNotiname )
bkgreq->notiadd1 := _Clean( cNotiadd1 )
bkgreq->notiadd2 := _Clean( cNotiadd2 )
bkgreq->noticity := _Clean( cNoticity )
bkgreq->notist := _Clean( cNotistate )
bkgreq->notizip := _Clean( cNotiZip )
bkgreq->notiiso := _Clean( cNotiCountry )
bkgreq->forwname := _Clean( cForwname )
bkgreq->forwadd1 := _Clean( cForwadd1 )
bkgreq->forwadd2 := _Clean( cForwadd2 )
bkgreq->forwcity := _Clean( cForwcity )
bkgreq->forwst := _Clean( cForwstate )
bkgreq->forwzip := _Clean( cForwZip )
bkgreq->forwiso := _Clean( cForwCountry )
bkgreq->charges := _Map2Pasha( "PASHACHARGES", _Clean( cDetailCharges ) )
bkgreq->ctnr01qty := 1
bkgreq->ctnr01type := _Map2Pasha( "PASHACONTAINER", _Clean( cDetailCtnrType ) )
bkgreq->lastuser := "PASHA WEB SERVICES"
bkgreq->lastdate := DATE()
bkgreq->lasttime := TIME()
bkgreq->pdocid := _Clean( cSenderDocumentId )
bkgreq->pdetcnt := _Clean( cDetailCount )
bkgreq->psender := _Clean( cSenderName )
bkgreq->ptransdate := _Clean( cDocTransDate )
bkgreq->pextref := _Clean( cPashaExtNo )
bkgreq->( dbunlock() )
EXIT
ENDIF
ENDDO

// Update Detail...
SELECT bkgdet
IF (nDetRec<1)
APPEND BLANK
bkgdet->customer := Mcustid
bkgdet->serial := cSerial
bkgdet->siid := cSiId
ELSE
GO nDetRec
ENDIF
DO WHILE (.T.)
IF bkgdet->( rlock() )
cTmp := RIGHT( "00" + LTRIM(STR(nDetailId,9)), 2)
bkgdet->pkgtype := _Clean( cDetailPackage )
bkgdet->desc := _Clean( cDetailDesc )
bkgdet->hscode := _Clean( cDetailItemCode )
bkgdet->gwtcode := _Clean( cDetailWtCode )
bkgdet->nwtcode := _Clean( cDetailWtCode )
bkgdet->volcode := _Clean( cDetailVolCode )
bkgdet->smfirst&cTmp := _Clean( cDetailFirst )
bkgdet->smlast&cTmp := _Clean( cDetailLast )
bkgdet->scac&cTmp := _Clean( cDetailCarrier )
bkgdet->area&cTmp := _Clean( cDetailDestArea )
bkgdet->gbloc&cTmp := _Clean( cDetailDestBase )
bkgdet->gbl&cTmp := _Clean( cShipmentNumber )
bkgdet->qty&cTmp := _Clean( cDetailPieces )
bkgdet->qty&cTmp.t := _Clean( cDetailTotalPcs )
bkgdet->grs&cTmp := VAL( _Clean( cDetailGrossWt ) )
bkgdet->net&cTmp := VAL( _Clean( cDetailNetWt ) )
bkgdet->vol&cTmp := VAL( _Clean( cDetailVolume ) )
bkgdet->ctnr&cTmp := _Clean( cDetailContainer )
bkgdet->seal&cTmp := _Clean( cDetailSeal )
bkgdet->size&cTmp := _Map2Pasha( "PASHACONTAINER", _Clean( cDetailCtnrType ) )
bkgdet->pasha&cTmp := _Clean( cPashaShipmentId )
bkgdet->ph&cTmp := _Clean( cDetailPhone )
bkgdet->transp&cTmp := _Clean( cDetailTranspId )
bkgdet->transit&cTmp := _Clean( cDetailTransitId )
bkgdet->pashacid&cTmp := _Clean( cDetailPCtnrId )
bkgdet->( dbunlock() )
EXIT
ENDIF
ENDDO

// Close...
_dbClose( "bkgreq" )
_dbClose( "bkgdet" )

ENDIF

// Init...
cDetailId := ""
cDetailAction := ""
cPashaShipmentId := ""
cShipmentNumber := ""
cDetailCarrier := ""
cDetailFirst := ""
cDetailLast := ""
cDetailPhone := ""
cDetailEmail := ""
cDetailWtCode := ""
cDetailVolCode := ""
cDetailVolume := ""
cDetailGrossWt := ""
cDetailTareWt := ""
cDetailNetWt := ""
cDetailPieces := ""
cDetailTotalPcs := ""
cDetailBkgDate := ""
cDetailDelvDate := ""
cDetailTranspId := ""
cDetailTransitId := ""
cDetailCtnrType := ""
cDetailContract := ""
cDetailClauses := ""
cDetailMoveType := ""
cDetailDesc := ""
cDetailCharges := ""
cDetailDocType := ""
cDetailDocRate := ""
cDetailPackage := ""
cDetailFrtPay := ""
cDetailPlaceRel := ""
cDetailItemCode := ""
cDetailPCtnrId := ""
cDetailContainer := ""
cDetailSeal := ""
cDetailSize := ""
cPashaGbl := ""
cPashaBkgNo := ""
cPashaExtNo := ""
cShipName := ""
cShipAdd1 := ""
cShipAdd2 := ""
cShipCity := ""
cShipState := ""
cShipZip := ""
cShipCountry := ""
cConsName := ""
cConsAdd1 := ""
cConsAdd2 := ""
cConsCity := ""
cConsState := ""
cConsZip := ""
cConsCountry := ""
cNotiName := ""
cNotiAdd1 := ""
cNotiAdd2 := ""
cNotiCity := ""
cNotiState := ""
cNotiZip := ""
cNotiCountry := ""
cForwName := ""
cForwAdd1 := ""
cForwAdd2 := ""
cForwCity := ""
cForwState := ""
cForwZip := ""
cForwCountry := ""
cEtd1 := ""
cEtdTime1 := ""
cEtd2 := ""
cEtdTime2 := ""
cEta := ""
cEtaTime := ""
cSteamshipLine := ""
cVessel := ""
cVoyage := ""
cEtdTime := ""
cPortOfDeparture := ""
cPortOfArrival := ""
cDetailDestArea := ""
cDetailDestBase := ""
lTransit := .F.
lTransportItem := .F.
lDetail := .F.
nDetailId := 0
cName := ""
cType := ""
cAddress1 := ""
cAddress2 := ""
cCity := ""
cState := ""
cZip := ""
cCountry := ""
lTransitXmlKey := .F.


CASE cTagName1=="DETAIL" .AND. cKeyName1=="ACTION"
cDetailAction := cKeyValue1

CASE cTagName1=="DETAIL" .AND. cKeyName1=="ID"
cDetailId := cKeyValue1

CASE cTagName1=="IDENTIFIERS" .AND. cKeyName1=="CARRIERSCAC"
cDetailCarrier := cKeyValue1
CASE cTagName1=="IDENTIFIERS" .AND. cKeyName1=="SHIPMENTNUMBER"
cShipmentNumber := cKeyValue1
CASE cTagName1=="IDENTIFIERS" .AND. cKeyName1=="PASHASHIPMENTRECORDID"
cPashaShipmentId := cKeyValue1
CASE cTagName1=="IDENTIFIERS" .AND. cKeyName1=="PASHACONTAINERRECORDID"
cDetailPCtnrId := cKeyValue1
CASE cTagName1=="IDENTIFIERS" .AND. cKeyName1=="TRANSPORTITEMNUMBER"
cDetailContainer := cKeyValue1
CASE cTagName1=="IDENTIFIERS" .AND. cKeyName1=="SEALNUMBER"
cDetailSeal := cKeyValue1
CASE cTagName1=="IDENTIFIERS" .AND. cKeyName1=="BOOKINGNUMBER"
IF lTransitXmlKey
cPashaBkgNo := cKeyValue1
lTransitXmlKey := .F.
ENDIF
CASE cTagName1=="IDENTIFIERS" .AND. cKeyName1=="EXTERNALREFERENCEVALUE"
cPashaExtNo := cKeyValue1

CASE cTagName1=="SHIPPERDETAILS" .AND. cKeyName1=="CONTACTGIVENNAME"
cDetailFirst := cKeyValue1
CASE cTagName1=="SHIPPERDETAILS" .AND. cKeyName1=="CONTACTFAMILYNAME"
cDetailLast := cKeyValue1
CASE cTagName1=="SHIPPERDETAILS" .AND. cKeyName1=="PHONE1"
cDetailPhone := cKeyValue1
CASE cTagName1=="SHIPPERDETAILS" .AND. cKeyName1=="EMAIL1"
cDetailEmail := cKeyValue1

CASE cTagName1=="ORIGIN" .AND. cKeyName1=="PORTOFDEPARTURE"
cPortOfDeparture := cKeyValue1

CASE cTagName1=="DESTINATION" .AND. cKeyName1=="PORTOFARRIVAL"
cPortOfArrival := cKeyValue1
CASE cTagName1=="DESTINATION" .AND. cKeyName1=="DESTINATIONAREA"
cDetailDestArea := cKeyValue1
CASE cTagName1=="DESTINATION" .AND. cKeyName1=="DESTINATIONBASEABBREVIATION"
cDetailDestBase := cKeyValue1

CASE cTagName1=="PHYSICAL" .AND. cKeyName1=="WEIGHTUNITS"
cDetailWtCode := cKeyValue1
CASE cTagName1=="PHYSICAL" .AND. cKeyName1=="VOLUMEUNITS"
cDetailVolCode := cKeyValue1
CASE cTagName1=="PHYSICAL" .AND. cKeyName1=="CUBEVOLUME"
cDetailVolume := cKeyValue1
CASE cTagName1=="PHYSICAL" .AND. cKeyName1=="GROSSWEIGHT"
cDetailGrossWt := cKeyValue1
CASE cTagName1=="PHYSICAL" .AND. cKeyName1=="TAREWEIGHT"
cDetailTareWt := cKeyValue1
CASE cTagName1=="PHYSICAL" .AND. cKeyName1=="NETWEIGHT"
cDetailNetWt := cKeyValue1
CASE cTagName1=="PHYSICAL" .AND. cKeyName1=="PIECECOUNT"
cDetailPieces := cKeyValue1

CASE cTagName1=="DATES" .AND. cKeyName1=="BOOKINGDATE"
cDetailBkgDate := cKeyValue1
CASE cTagName1=="DATES" .AND. cKeyName1=="REQUESTEDDELIVERYDATE"
cDetailDelvDate := cKeyValue1
CASE cTagName1=="DATES" .AND. cKeyName1=="ESTIMATEDTIMEOFDEPARTUREDATE"
cEtd1 := cKeyValue1
CASE cTagName1=="DATES" .AND. cKeyName1=="ACTUALTIMEOFDEPARTUREDATE"
cEtd2 := cKeyValue1
CASE cTagName1=="DATES" .AND. cKeyName1=="ESTIMATEDTIMEOFARRIVALDATE"
cEta := cKeyValue1

CASE cTagName1=="FACTS" .AND. cKeyName1=="CONTAINERTYPE"
cDetailCtnrType := cKeyValue1
CASE cTagName1=="FACTS" .AND. cKeyName1=="CONTRACTNUMBER"
cDetailContract := cKeyValue1
CASE cTagName1=="FACTS" .AND. cKeyName1=="SHIPPINGINSTRUCTION"
cDetailClauses := cKeyValue1
CASE cTagName1=="FACTS" .AND. cKeyName1=="MOVETYPE"
cDetailMoveType := cKeyValue1
CASE cTagName1=="FACTS" .AND. cKeyName1=="DESCRIPTIONOFGOODS"
cDetailDesc := cKeyValue1
CASE cTagName1=="FACTS" .AND. cKeyName1=="FREIGHTCHARGETYPE"
cDetailCharges := cKeyValue1
CASE cTagName1=="FACTS" .AND. cKeyName1=="DOCUMENTTYPE"
cDetailDocType := cKeyValue1
CASE cTagName1=="FACTS" .AND. cKeyName1=="DOCUMENTTYPERATING"
cDetailDocRate := cKeyValue1
CASE cTagName1=="FACTS" .AND. cKeyName1=="PACKAGETYPE"
cDetailPackage := cKeyValue1
CASE cTagName1=="FACTS" .AND. cKeyName1=="PLACEOFFREIGHTPAYMENT"
cDetailFrtPay := cKeyValue1
CASE cTagName1=="FACTS" .AND. cKeyName1=="PLACEOFBOLRELEASE"
cDetailPlaceRel := cKeyValue1
CASE cTagName1=="FACTS" .AND. cKeyName1=="ITEMCODE"
cDetailItemCode := cKeyValue1
CASE cTagName1=="FACTS" .AND. cKeyName1=="SHIPMENTTOTALPIECECOUNT"
cDetailTotalPcs := cKeyValue1

CASE cKeyName1=="CONTACTDETAILS"
IF ! EMPTY( cName )
DO CASE
CASE cType="SHIPPER"
cShipName := cName
cShipAdd1 := cAddress1
cShipAdd2 := cAddress2
cShipCity := cCity
cShipState := cState
cShipZip := cZip
cShipCountry := cCountry

CASE cType="CONSIGNEE"
cConsName := cName
cConsAdd1 := cAddress1
cConsAdd2 := cAddress2
cConsCity := cCity
cConsState := cState
cConsZip := cZip
cConsCountry := cCountry

CASE cType="NOTIFYPARTY"
cNotiName := cName
cNotiAdd1 := cAddress1
cNotiAdd2 := cAddress2
cNotiCity := cCity
cNotiState := cState
cNotiZip := cZip
cNotiCountry := cCountry

CASE cType="FORWARDER"
cForwName := cName
cForwAdd1 := cAddress1
cForwAdd2 := cAddress2
cForwCity := cCity
cForwState := cState
cForwZip := cZip
cForwCountry := cCountry
ENDCASE
ENDIF
cName := ""
cType := ""
cAddress1 := ""
cAddress2 := ""
cCity := ""
cState := ""
cZip := ""
cCountry := ""

CASE cTagName1=="CONTACTDETAILS" .AND. cKeyName1=="BUSINESSNAME"
cName := cKeyValue1
CASE cTagName1=="CONTACTDETAILS" .AND. cKeyName1=="CONTACTDETAILTYPE"
cType := cKeyValue1
CASE cTagName1=="CONTACTDETAILS" .AND. cKeyName1=="ADDRESSLINE1"
cAddress1 := cKeyValue1
CASE cTagName1=="CONTACTDETAILS" .AND. cKeyName1=="ADDRESSLINE2"
cAddress2 := cKeyValue1
CASE cTagName1=="CONTACTDETAILS" .AND. cKeyName1=="CITY"
cCity := cKeyValue1
CASE cTagName1=="CONTACTDETAILS" .AND. cKeyName1=="STATE"
cState := cKeyValue1
CASE cTagName1=="CONTACTDETAILS" .AND. cKeyName1=="POSTALCODE"
cZip := cKeyValue1
CASE cTagName1=="CONTACTDETAILS" .AND. cKeyName1=="COUNTRY"
cCountry := cKeyValue1

CASE cTagName1=="TRANSPORTITEM" .AND. cKeyName1=="ID"
cDetailTranspId := cKeyValue1

CASE cTagName1=="TRANSITXMLKEY" .AND. cKeyName1=="VALUE"
cDetailTransitId := cKeyValue1
lTransitXmlKey := .T.

CASE cTagName1=="SHIPPINGDETAILS" .AND. cKeyName1=="STEAMSHIPCOMPANY"
cSteamshipLine := cKeyValue1
CASE cTagName1=="SHIPPINGDETAILS" .AND. cKeyName1=="VESSEL"
cVessel := cKeyValue1
CASE cTagName1=="SHIPPINGDETAILS" .AND. cKeyName1=="VOYAGE"
cVoyage := cKeyValue1
CASE cTagName1=="SHIPPINGDETAILS" .AND. cKeyName1=="PORTOFDEPARTURE"
cPortOfDeparture := cKeyValue1
CASE cTagName1=="SHIPPINGDETAILS" .AND. cKeyName1=="PORTOFARRIVAL"
cPortOfArrival := cKeyValue1

ENDCASE

RETURN (.T.)
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Re: XML viewer

Postby Antonio Linares » Thu Mar 07, 2013 9:01 am

Darrell,

Please post the code for your function _Clean(), thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42092
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: XML viewer

Postby cdmmaui » Thu Mar 07, 2013 12:54 pm

Hi Antonio,

Here is the code

//-----------------------------------------------------------------------------
FUNCTION _Clean( cXmlData )

local cReturn := "" , ;
nX0 := 0 , ;
lPass := .T.

FOR nX0=1 TO LEN(cXmlData)
cChar := SUBSTR( cXmlData, nX0, 1 )
IF (ASC(cChar)>31) .AND. (ASC(cChar)<127)
cReturn += cChar
ELSE
IF "ABCHOU" $ Pmod
cReturn += SPACE(1)
ENDIF
lPass := .F.
ENDIF
NEXT nX0

IF ! lPass
MsgInfo( cXmlData )
ENDIF

RETURN (UPPER(cReturn))
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Re: XML viewer

Postby Antonio Linares » Fri Mar 08, 2013 10:19 am

Darrell,

I have not tried it but its simple and seems fine, just a missing local cChar at the top.

How do you know that the DBFs are corrupted ? Does your app reports it when it tries to use them ?

Please email me the corrupted DBF, thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42092
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: XML viewer

Postby cdmmaui » Fri Mar 08, 2013 1:10 pm

Hi Antonio,

I have sent you the DBF/FPT
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Re: XML viewer

Postby cdmmaui » Mon Mar 11, 2013 8:12 am

Hi Antonio,

Were you able to look at DBF/FPT I sent you? Do you think there could be an issue with TXmlDocument() and DBFCDX?

Sincerely,
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Re: XML viewer

Postby Antonio Linares » Tue Mar 12, 2013 1:39 am

Darrell,

I have been reviewing the DBFs that you sent me, and I think we need to check if the problem comes from the reading of the XML data.

Please create a log file, at the same time that you save the data to the DBF, in example:

LogFile( "log.txt", { value1, ..., valueN } )
alias->field1 := value1
etc...

so we can see if the same error appears in log.txt
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42092
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: XML viewer

Postby cdmmaui » Wed Mar 13, 2013 4:00 am

Hi Antonio,

There was an issue with memo fields, once I changed memo fields to character, the corruption issue went away.

Sincerely,
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Antonio Linares, Google [Bot] and 94 guests