Home > database >  Pb7 with MSXML2. DOMDocument. 3.0 to parse the XML characters is stil who know how to solve?
Pb7 with MSXML2. DOMDocument. 3.0 to parse the XML characters is stil who know how to solve?

Time:09-22

Oleobject lole_xml_document lole_xsl_document//, lole_result
String ls_result
XML string ls_filename="C: \ NHDK."
XML string ls_xslfilename="C: \ NHDK."
//Create the OLE Object
Lole_xml_document=CREATE oleobject
Lole_xsl_document=CREATE oleobject

The Integer li_rc

Li_rc=lole_xml_document. ConnectToNewObject (" MSXML2. DOMDocument. 3.0 ")

IF li_rc & lt; 0 THEN

MessageBox (" Connecting to the COM Object Failed ", "Error:" + String (li_rc))

DESTROY lole_xml_document

Return

END the IF


The Integer li_rc1

Li_rc=lole_xsl_document. ConnectToNewObject (" MSXML2. DOMDocument. 3.0 ")

IF li_rc1 & lt; 0 THEN

MessageBox (" Connecting to the COM Object Failed ", "Error:" + String (li_rc))

DESTROY lole_xsl_document

Return

END the IF

//Load the file into memory (this will parse it)
Boolean lb_test
Lb_test=lole_xml_document. Load (ls_filename)
IF lb_test=false THEN
//KK - Demonstrate the parseError attribute
MessageBox (" the Load of the Failed of XML doc ", "ErrorCode:" + string (lole_xml_document. ParseError. ErrorCode) + "~ n ~ r & amp;"
+ "FilePosition:" + string (lole_xml_document. ParseError. Filepos) + "~ n ~ r & amp;"
+ "Line:" + string (lole_xml_document. ParseError. Line) + "~ n ~ r & amp;"
+ "LinePosition:" + string (lole_xml_document. ParseError. Linepos) + "~ n ~ r & amp;"
+ "" Reason:" + string (lole_xml_document. ParseError. "Reason) +" ~ n ~ r & amp;"
+ "SourceText:" + string (lole_xml_document. ParseError. SrcText))

DESTROY lole_xml_document

Return

END the IF


//Load the file into memory (this will parse it)
Boolean lb_test1
Lb_test1=lole_xsl_document. Load (ls_xslfilename)
IF lb_test1=false THEN
//KK - Demonstrate the parseError attribute
MessageBox (" the Load of the Failed of XML doc ", "ErrorCode:" + string (lole_xsl_document. ParseError. ErrorCode) + "~ n ~ r & amp;"
+ "FilePosition:" + string (lole_xsl_document. ParseError. Filepos) + "~ n ~ r & amp;"
+ "Line:" + string (lole_xsl_document. ParseError. Line) + "~ n ~ r & amp;"
+ "LinePosition:" + string (lole_xsl_document. ParseError. Linepos) + "~ n ~ r & amp;"
+ "" Reason:" + string (lole_xsl_document. ParseError. "Reason) +" ~ n ~ r & amp;"
+ "SourceText:" + string (lole_xml_document. ParseError. SrcText))

DESTROY lole_xsl_document

Return

END the IF





//KK - Load the file name as the first treeviewitem
String ls_label//
Ls_label=ls_filename
Tv_xml. InsertItemLast (0, ls_label, 1)

//KK - root node element can be determined
//lole_xml_document documentElement


//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//THE XML FILE from THE then PARSED AND IS IN THE MEMORY
//YOU CAN INVOKE the PARSER the METHODS TO file IT
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Wf_parse_node (1, lole_xml_document documentElement)


Ls_result=lole_xml_document. TransformNode (lole_xsl_document)
Is_html_result=ls_result

Mle_1. Text=ls_result
//Disconnect from the XML parser
Lole_xml_document. DisConnectObject ()

Lole_xsl_document. DisConnectObject ()


//Destroy the OLE object
DESTROY lole_xml_document
DESTROY lole_xsl_document


//oleobject aole_node//The node to process
//long al_treeview_parent//The treeview item to add nodes to
//

//local variables
String ls_node_type//The type of The current node
String ls_node_name//The name of The current node
String ls_node_value//The value of The current node
Oleobject lole_attribute_node_list//The attributes for this node
Oleobject lole_attribute_node//An attribute for this node
Oleobject lole_child_node_list//The child nodes for this node
Oleobject lole_child_node//The current child node
Long ll_max_attribute_nodes//The number of attribute nodes
Long ll_max_child_nodes//The number of child nodes
Long ll_attribute_idx//A counter
Long ll_child_idx//A counter
String ls_label//The label for The treeview
Long ll_treeview//The newly inserted treeview item
Int li_pictureindex//KK - Added pictureindex
Ls_node_value=https://bbs.csdn.net/topics/Space (100)

//Determine the node 's name, type and value
Ls_node_name=aole_node. Nodename
Ls_node_type=Upper (aole_node nodetypestring)
Ls_node_value=https://bbs.csdn.net/topics/string (aole_node nodevalue)

IF IsNull (ls_node_value) THEN
Ls_node_value="https://bbs.csdn.net/topics/"
END the IF



//Add this node to the treeview
//I am using a picture index of 1 or
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related