Home > database >  (help!!!!! ) about PBDOM to parse the XML string when submitted to the null object reference empty o
(help!!!!! ) about PBDOM to parse the XML string when submitted to the null object reference empty o

Time:09-22

String aa

Aa='& lt; ? The XML version="1.0" encoding="GB2312"?> '+ string (as_xml) & lt; br/>
PBDOM_BUILDER pbdom_builder_new & lt; br/>
PBDOM_DOCUMENT pbdom_doc & lt; br/>
Pbdom_builder_new=Create PBDOM_BUILDER & lt; br/>
Pbdom_doc=create PBDOM_DOCUMENT & lt; br/>
Pbdom_doc=pbdom_builder_new. BuildFromString (aa) & lt; br/>
//PBDOM elements & lt; br/>
PBDOM_ELEMENT pbdom_elem, pbdom_elem2 & lt; br/>
Pbdom_elem=Create PBDOM_ELEMENT & lt; br/>
Pbdom_elem2=Create PBDOM_ELEMENT & lt; br/>
//get with nodes & lt; br/>
Pbdom_elem=pbdom_doc. GetRootElement () & lt; br/>
PBDOM_ELEMENT pbdom_elems []

Pbdom_elem. GetChildElements (as_sxmc, pbdom_elems []) & lt; br/>
String st

//get attribute with the value of the value & lt; br/>
Int len

Len=upperbound (pbdom_elems) & lt; br/>
If len & gt; 0 then

St=pbdom_elems [1]. GetAttributeValue (" data ") & lt; br/>
Return st

Else

Return "" & lt; br/>
End if

This code, as_xml is incoming an XML string, as_sxmc is incoming node name, in order to get the node under the attribute, the outside loop transfer into an XML string XML string like this incoming lot of this kind of string, and then spread to the attribute value, before a few strings but good after coming to an empty string object references, pbdom_elem. GetChildElements (as_sxmc, pbdom_elems []), the fault of this code, I ask, what is the cause of this code shall be reported to the null object reference, first thank you
XML string is














CodePudding user response:

Your pbdom_doc. GetRootElement () have to value?
  • Related