Code:
- /* */
- /* Out: 8/05/04 9:20 Ver: 0. 0 Level40 CHRISTEN, DUANE J. - IT&S */
- /* Ref: ANIN090402 ANI Inventory/ANI API Redesign (Code) */
- /* DJC: Initial program creation */
- /* */
-
- /* Copyright McLeod, Inc., as an unpublished work created in
- /* 2004. This program is CONFIDENTIAL, unpublished work of
- /* authorship. IT IS A TRADE SECRET which is the property of
- /* McLeod, Inc. All use, disclosure, and/or reproduction not
- /* specifically authorized by McLeod, Inc., is prohibited.
- /* This program may also be protected under the copyright
- /* and/or trade secret laws of non-U.S. countries. All rights
- /* reserved.
-
- /*=============================================================================================
- /* Notes
- /*=============================================================================================
-
- /* Compile with ACTGRP(*CALLER)
-
- /*=============================================================================================
- /* Control Specifications
- /*=============================================================================================
-
- H NoMain
-
- /*=============================================================================================
- /* File Specifications
- /*=============================================================================================
-
-
- /*=============================================================================================
- /* Prototype Specifications
- /*=============================================================================================
-
- /Include QRPGCBSRC,XMRM9800
- /Include QRPGCBSRC,QXMLPARSER
-
- /*=============================================================================================
- /* Data Specifications
- /*=============================================================================================
-
-
- /*---------------------------------------------------------------------------------------------
- /* Data Structure Specifications
- /*---------------------------------------------------------------------------------------------
-
-
- /*---------------------------------------------------------------------------------------------
- /* Array Specifications
- /*---------------------------------------------------------------------------------------------
-
-
- /*---------------------------------------------------------------------------------------------
- /* Indicator Specifications
- /*---------------------------------------------------------------------------------------------
-
-
- /*---------------------------------------------------------------------------------------------
- /* Standalone Data Specifications
- /*---------------------------------------------------------------------------------------------
-
-
- /*---------------------------------------------------------------------------------------------
- /* Constant Specifications
- /*---------------------------------------------------------------------------------------------
-
-
- /*#############################################################################################
- /* Procedure Deleclaration - Convert DOM Element To String
- /*#############################################################################################
-
- P convertDOMElementToString... Convert DOM
- P B Export Element to String
-
- /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- /* Procedure Interface
- /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
- D convertDOMElementToString... Convert DOM
- D PI 10U 0 Element to String
- D element * Value Element Node
- D string * Value Resulting String
- D stringLength 10U 0 Value Resulting String Len
- D stringCCSID 10I 0 Value Resulting CCSID
-
- /*=============================================================================================
- /* Procedure Data Specifications
- /*=============================================================================================
-
-
- /*---------------------------------------------------------------------------------------------
- /* Procedure Data Structure Specifications
- /*---------------------------------------------------------------------------------------------
-
-
- /*---------------------------------------------------------------------------------------------
- /* Procedure Array Specifications
- /*---------------------------------------------------------------------------------------------
-
-
- /*---------------------------------------------------------------------------------------------
- /* Procedure Indicator Specifications
- /*---------------------------------------------------------------------------------------------
-
-
- /*---------------------------------------------------------------------------------------------
- /* Procedure Standalone Data Specifications
- /*---------------------------------------------------------------------------------------------
-
- D bytesAvailable...
- D S 10U 0
- D bytesProvided...
- D S 10U 0
-
- D x S 10U 0
-
- D elementLength...
- D S 10U 0
- D elementChild...
- D S *
- D elementSibling...
- D S *
-
- D attributeList...
- D S *
- D attribute...
- D S *
- D attributeCount...
- D S 10U 0
-
- /*---------------------------------------------------------------------------------------------
- /* Procedure Constant Specifications
- /*---------------------------------------------------------------------------------------------
-
-
- /*---------------------------------------------------------------------------------------------
- /* Procedure Key Lists
- /*---------------------------------------------------------------------------------------------
-
-
- /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- /* Procedure Code
- /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
- /Free
-
- elementLength = concatenateConstant(string : '<'); // Element Start
- bytesProvided = stringLength - elementLength;
-
- QxmlTransCode(QxmlDOMNode_getNodeName(element) : // Element Name
- Qxml_UniCode :
- string + elementLength :
- %Addr(bytesProvided) :
- %Addr(bytesAvailable) :
- stringCCSID);
-
- elementLength = strlen(string);
-
- ExSr elementAttributes;
-
- elementLength += concatenateConstant(string : '>'); // Close Element Start
-
- ExSr elementBody; // Element Body
-
- elementLength += concatenateConstant(string : '</'); // Element End
- bytesProvided = stringLength - elementLength;
-
- QxmlTransCode(QxmlDOMNode_getNodeName(element) : // Element Name
- Qxml_UniCode :
- string + elementLength :
- %Addr(bytesProvided) :
- %Addr(bytesAvailable) :
- stringCCSID);
-
- elementLength = strlen(string);
-
- elementLength += concatenateConstant(string : '>'); // Close Element End
-
- Return elementLength;
-
- //===========================================================================================
- // Element Attributes
- //===========================================================================================
-
- BegSr elementAttributes;
-
- attributeList = QxmlDOMNode_getAttributes(element); // List of Attributes
- attributeCount = QxmlDOMNamedNodeMap_getLength(attributeList); // Number of Attributes
-
- For x = attributeCount DownTo 1;
- attribute = QxmlDOMNamedNodeMap_Item(attributeList : x - 1);
-
-
- elementLength += // Attribute Start
- concatenateConstant(string + elementLength : ' ');
- bytesProvided = stringLength - elementLength;
-
- QxmlTransCode(QxmlDOMNode_GetNodeName(attribute) : // Attribute Name
- Qxml_UniCode :
- string + elementLength :
- %Addr(bytesProvided) :
- %Addr(bytesAvailable) :
- stringCCSID);
-
- elementLength = strlen(string);
-
- elementLength +=
- concatenateConstant(string + elementLength : '="'); // Attribute Value Start
- bytesProvided = stringLength - elementLength;
-
- QxmlTransCode(QxmlDOMNode_GetNodeValue(attribute) : // Attribute Value
- Qxml_UniCode :
- string + elementLength :
- %Addr(bytesProvided) :
- %Addr(bytesAvailable) :
- stringCCSID);
-
- elementLength = strlen(string);
-
- QxmlDOMNode_delete(attribute);
-
- elementLength +=
- concatenateConstant(string + elementLength : '"'); // Attribute End
- EndFor;
-
- QxmlDOMNamedNodeMap_delete(attributeList);
-
-
- EndSr;
-
- //===========================================================================================
- // Element Body
- //===========================================================================================
-
- BegSr elementBody;
-
- elementChild = QxmlDOMNode_GetFirstChild(element); // Element Child Node(s)
-
- DoW QxmlDOMNode_IsNULL(elementChild) = Qxml_NodNotNul;
-
- elementLength +=
- convertDOMNodeToString(elementChild :
- string + elementLength :
- stringLength -
- elementLength :
- stringCCSID);
-
- elementSibling = QxmlDOMNode_GetNextSibling(elementChild);
-
- QxmlDOMNode_delete(elementChild);
-
- elementChild = elementSibling;
- EndDo;
-
- QxmlDOMNode_delete(elementChild);
-
- EndSr;
-
- /End-Free
-
- P convertDOMElementToString...
- P E
-
- //===========================================================================================
|
|