XmlDocument Vs StringBuilder

A

Anup Daware

Hi Group,

You might have found the Title a little strange :); well following is
the problem description:
I want to form a SOAP xml request to a servlet, I have my Request xml
template ready.
Now I have following options:
1. Load the xml template in an XmlDocument object and manipulate it.
2. Load the xml template in a StringBuilder object, manipulate it and
then load it in XmlDocument.
3. Not using any template and creating the xml from scratch.
Following is the sample xml template which I will use:
<?xml version="1.0" encoding="UTF-8"?>
<MT_MaterialSearchRequest>
<!-- Customer Data -->
<CUSTOMER> CUSTOMER _PLACEHOLDER</CUSTOMER>
<SALES_ORG> SALES_ORG _ PLACEHOLDER </SALES_ORG>
<!-- Limit on the size of the search result -->
<DEFAULT_SORTING> DEFAULT_SORTING _PLACEHOLDER</DEFAULT_SORTING>
<!-- Material Data -->
<WIDTH> WIDTH _HOLDER</WIDTH>
<SERIE> SERIE _HOLDER</SERIE>
<!-- Material List -->
<VISIBILITY_ITEM_IN>
<ITEM> <!-NOTE: Number of <ITEM> nodes is dynamic>
<MATERIAL></MATERIAL>
</ITEM>
<ITEM>
<MATERIAL></MATERIAL>
</ITEM>
</VISIBILITY_ITEM_IN>
</MT_MaterialSearchRequest>

My Questions:
1. For this scenario which of the above mentioned options which is
more suitable?
2. In General which options is more preferable?
3. I know that second option of using StringBuilder is going to be
very easy for implementation, but which option is better in terms of
speed of execution and memory considerations?

Hoping to get some expert comments on this :)

Thanks,
Anup Daware
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,835
Latest member
lila30

Latest Threads

Top