1. Malek Taha
  2. PowerBuilder
  3. Friday, 15 September 2023 21:04 PM UTC

Hi

   I have struggled with this for a while with no success. It seems so simple and straightfoward.

i have this xml file

<?xml version="1.0"?>
<Shipment>
<Response>
<StatusCode>0</StatusCode>
<Error>
<ErrorSeverity>Hard</ErrorSeverity>
<ErrorCode>11111</ErrorCode>
<ErrorDescription>Help</ErrorDescription>
</Error>
</Response>
</Shipment>

 

I want to get the response element and make it the root of a document

Getting this (see below) in a string

Please help

Thanks

Malek

 

<Response>
<StatusCode>0</StatusCode>
<Error>
<ErrorSeverity>Hard</ErrorSeverity>
<ErrorCode>11111</ErrorCode>
<ErrorDescription>Help</ErrorDescription>
</Error>
</Response>

Malek Taha Accepted Answer Pending Moderation
  1. Monday, 18 September 2023 18:08 PM UTC
  2. PowerBuilder
  3. # 1

Thank you very much Rene very helpful thank you so much

regards

Malek

 

Comment
There are no comments made yet.
René Ullrich Accepted Answer Pending Moderation
  1. Monday, 18 September 2023 05:30 AM UTC
  2. PowerBuilder
  3. # 2

Hi Malek,

from source xml you have to get the "response" element.

Call the "clone" function to get a copy of it (use true as parameter to make a deep clone).

Then you can set the cloned element as root element (function setrootelement) e.g for a new created document (function newdocument).

Here a shortened example:

lpbdom_elem_response = lpbdom_elem_root.GetChildElement ("Response")
lpbdom_elem_response2 = lpbdom_elem_response.clone (true)
	
lpbdom_doc2 = create pbdom_document
lpbdom_doc2.NewDocument("none")  // <none> tag will be replaced
lpbdom_doc2.SetRootElement(lpbdom_elem_response2)
Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.