S
sina9386
Guest
<?xml version='1.0' encoding='UTF-8' ?>
<root>
<input>
<![CDATA[
<ServerLicence>abc</ServerLicence>
<inputData>
<CreationPreferences></CreationPreferences>
<SelectObj1>
(?xml version="1.0" encoding="UTF-8"?)(FILTER
CASESENSITIVE="TRUE" DEPTH="-1" RESULTSPERPAGE="-1"
COMMAND="QUERY" )
(SELECT)
(/SELECT)
(WHERE)
(CONDITION)
(EXPRESSION)
(VALUE)
Replace_Placeholder
(VALUE)
(/EXPRESSION)
(/CONDITION)
(/WHERE)
</SelectObj1>
</inputData>
]]>
</input>
</root>
I have an xml file as seen, and it has some CData content, which is also xml format. I have a requirement to replace text inside Cdata- "Replace_Placeholder" in the code according to some arguments it recieves. So when there is more than 1 argument , the xml should look like:
<?xml version='1.0' encoding='UTF-8' ?>
<root>
<input>
<![CDATA[
<ServerLicence>abc</ServerLicence>
<inputData>
<CreationPreferences></CreationPreferences>
<SelectObj1>
(?xml version="1.0" encoding="UTF-8"?)(FILTER
CASESENSITIVE="TRUE" DEPTH="-1" RESULTSPERPAGE="-1"
COMMAND="QUERY" )
(SELECT)
(/SELECT)
(WHERE)
(CONDITION)
(EXPRESSION)
(VALUE)
Replace_Placeholder
(VALUE)
(/EXPRESSION)
(/CONDITION)
(/WHERE)
</SelectObj1>
<SelectObj1>
(?xml version="1.0" encoding="UTF-8"?)(FILTER
CASESENSITIVE="TRUE" DEPTH="-1" RESULTSPERPAGE="-1"
COMMAND="QUERY" )
(SELECT)
(/SELECT)
(WHERE)
(CONDITION)
(EXPRESSION)
(VALUE)
Replace_Placeholder
(VALUE)
(/EXPRESSION)
(/CONDITION)
(/WHERE)
</SelectObj1>
</inputData>
]]>
</input>
</root>
It should create one more node of type "SelectObj1" and replace text in Replace_Placeholder with the value from the argument. I am stuck as to how to create the same node and replace and finally save the xml! I hope my problem is clear!
Continue reading...
<root>
<input>
<![CDATA[
<ServerLicence>abc</ServerLicence>
<inputData>
<CreationPreferences></CreationPreferences>
<SelectObj1>
(?xml version="1.0" encoding="UTF-8"?)(FILTER
CASESENSITIVE="TRUE" DEPTH="-1" RESULTSPERPAGE="-1"
COMMAND="QUERY" )
(SELECT)
(/SELECT)
(WHERE)
(CONDITION)
(EXPRESSION)
(VALUE)
Replace_Placeholder
(VALUE)
(/EXPRESSION)
(/CONDITION)
(/WHERE)
</SelectObj1>
</inputData>
]]>
</input>
</root>
I have an xml file as seen, and it has some CData content, which is also xml format. I have a requirement to replace text inside Cdata- "Replace_Placeholder" in the code according to some arguments it recieves. So when there is more than 1 argument , the xml should look like:
<?xml version='1.0' encoding='UTF-8' ?>
<root>
<input>
<![CDATA[
<ServerLicence>abc</ServerLicence>
<inputData>
<CreationPreferences></CreationPreferences>
<SelectObj1>
(?xml version="1.0" encoding="UTF-8"?)(FILTER
CASESENSITIVE="TRUE" DEPTH="-1" RESULTSPERPAGE="-1"
COMMAND="QUERY" )
(SELECT)
(/SELECT)
(WHERE)
(CONDITION)
(EXPRESSION)
(VALUE)
Replace_Placeholder
(VALUE)
(/EXPRESSION)
(/CONDITION)
(/WHERE)
</SelectObj1>
<SelectObj1>
(?xml version="1.0" encoding="UTF-8"?)(FILTER
CASESENSITIVE="TRUE" DEPTH="-1" RESULTSPERPAGE="-1"
COMMAND="QUERY" )
(SELECT)
(/SELECT)
(WHERE)
(CONDITION)
(EXPRESSION)
(VALUE)
Replace_Placeholder
(VALUE)
(/EXPRESSION)
(/CONDITION)
(/WHERE)
</SelectObj1>
</inputData>
]]>
</input>
</root>
It should create one more node of type "SelectObj1" and replace text in Replace_Placeholder with the value from the argument. I am stuck as to how to create the same node and replace and finally save the xml! I hope my problem is clear!
Continue reading...