× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



You first need to check to see if <Status> has any "children" and also check
the Qxml_DOMRTNCOD and Qxml_ErrorType provided fields for errors before
continuing.  Here is how I do it in my DOMParse API's which are downloadable
from http://mowyourlawn.com

HTH,
Aaron Bartell


     P DOMNode_getValue...
     P                 B                   Export
     D DOMNode_getValue...
     D                 PI         32767A   Varying
     D pNode                           *   Value

     D DOMStr          S               *
     D child           S               *
     D value           S          32767A   Varying Inz
      /Free

       If DOMNode_hasChildNodes(pNode) = Qxml_HASCHILD;
         child = DOMNode_getFirstChild(pNode);
         If DOMNode_getNodeType(child) = Qxml_TEXT_NOD;
           DOMStr = QxmlDOM_Node_getNodeValue(child);
           value = %Str(QxmlDOMString_transcode(DOMStr));
           QxmlDOMString_delete(DOMStr);
         EndIf;
         DOMNode_delete(child);
       EndIf;

       Return value;

      /End-Free
     P  DOMNode_getValue...
     P                 E 

     P DOMNode_hasChildNodes...
     P                 B                   Export
     D DOMNode_hasChildNodes...
     D                 PI            10I 0
     D pNode                           *   Value

     D result          S             10I 0
      /Free

       result = QxmlDOM_Node_hasChildNodes(pNode);
       checkForErrors();
       Return result;

      /End-Free
     P DOMNode_hasChildNodes...
     P                 E  

 
//--------------------------------------------------------------------------
------------------
      // @Name - DOMNode_getFirstChild
      // @Description - Get the first child of this Node.
      // @Author - Aaron Bartell
      // @Usage - Node = DOMNode_getFirstChild(Node)
      // @Throws -
 
//--------------------------------------------------------------------------
------------------
     P DOMNode_getFirstChild...
     P                 B                   Export
     D DOMNode_getFirstChild...
     D                 PI              *
     D pNode                           *   Value

     D result          S               *
      /Free

       result = QxmlDOM_Node_getFirstChild(pNode);
       checkForErrors();
       Return result;

      /End-Free
     P DOMNode_getFirstChild...
     P                 E 

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Jaime Lopez Ortega
Sent: Monday, June 07, 2004 8:02 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: QxmlDOM_Node_getNodeValue and error from the parser


Hi,

I am doing a small application that uses the XML toolkit to read/write files
in the IFS.
I am reading one file that has an empty tag, f.e. <Status></Status>

When I do:

     C                   EVAL      p_ChlNode = QxmlDOM_Node_getFirstChild
     C                                 (p_Node)
     C                   IF        QxmlDOM_Node_getNodeType(p_ChlNode) =
     C                             Qxml_TEXT_NOD
     C                   EVAL      p_ChlValue = QxmlDOM_Node_getNodeValue
     C                                 (p_ChlNode)

And the tag is empty, I get the error message MCH3601 when performing the
QxmlDOM_Node_getNodeValue operation.
How can I avoid it?
Thanks for your time.

Jaime López Ortega


--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or
change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.