I want to catch the error in XML. When there is opening root tag but not closing one .......Example :- I have XML " <abc><xyz></xyz>" . Here there is no closing tag ... So when i write the code
Can Anyone please let me know how to handle this error.
Code:
DEF VAR hDoc AS HANDLE NO-UNDO.
DEF VAR hRoot AS HANDLE NO-UNDO.
DEF VAR good AS LOGICAL NO-UNDO.
DEF VAR cXML AS LONGCHAR NO-UNDO.
ASSIGN cXML = [B]"<?xml version='1.0' encoding='UTF-8'?>
<retConsStatServ xmlns='http://www.portalfiscal.inf.br/nfe' versao='1.07'>
<tpAmb>2</tpAmb>
<verAplic>SP_NFE_PL_005a_R01</verAplic>
<cStat>107</cStat>
<xMotivo>Serviço em Operação</xMotivo>
<cUF>35</cUF>
<dhRecbto>2008-06-14T12:07:48</dhRecbto>
<tMed>1</tMed>" --- THIS XML has no closing[COLOR=#ff0000] </retConsStatServ>[/COLOR] tag which is Root tag
[/B]CREATE X-DOCUMENT hDoc.
CREATE X-NODEREF hRoot.
[B]hDoc:LOAD("LONGCHAR",Cxml,FALSE[/B]). ---- This give me error [B]9082 --- closing tag not found......
So i gave
[B]hDoc:LOAD("LONGCHAR",Cxml,FALSE[/B]) No-error.
And checked with
if ERROR-STATUS:ERROR then
message "invalid XML" view-as alert-box.
BUT this error checking is not working as ERROR-STATUS is always returning NO in case of correct XML as well as ERROR XML.
[/B]...
Can Anyone please let me know how to handle this error.