move xml nodes

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi,
I have an infopath form xml which i need to change .
<pre class="prettyprint <span class="pun <?<span class="pln xml version<span class="pun =<span class="str "1.0"<span class="pln encoding<span class="pun =<span class="str "utf-8"<span class="pun ?><span class="pln
<span class="pun <?<span class="pln mso<span class="pun -<span class="pln infoPathSolution
name<span class="pun =<span class="str "urn:schemas-microsoft-com:office:infopath:lesson2:-myXSD-2011-11-16T10-48-36"<span class="pln
solutionVersion<span class="pun =<span class="str "1.0.0.266"<span class="pln
productVersion<span class="pun =<span class="str "12.0.0.0"<span class="pln
<span class="typ PIVersion<span class="pun =<span class="str "1.0.0.0"<span class="pln
href<span class="pun =<span class="str ".xsn"<span class="pun ?><span class="pln
<span class="pun <?<span class="pln mso<span class="pun -<span class="pln application progid<span class="pun =<span class="str "InfoPath.Document"<span class="pln
versionProgid<span class="pun =<span class="str "InfoPath.Document.2"<span class="pun ?><span class="pln

<span class="tag <my:Form><span class="pln
<span class="tag <my:TeacherID><span class="pln 851<span class="tag </my:TeacherID><span class="pln
<span class="tag <my:Error></my:Error><span class="pln

<span class="tag </my:Form> <span class="pln <span class="tag <my:FormName><span class="pln Alice <span class="tag </my:FormName><span class="pln
<span class="tag <my:FormStatus><span class="pln Submitted<span class="tag </my:FormStatus><span class="pln
<span class="tag <my:OverallGrade><span class="pln
<span class="tag </my:OverallGrade><span class="pln
<span class="pln [/code]

to
<pre class="prettyprint <span class="pun <?<span class="pln xml version<span class="pun =<span class="str "1.0"<span class="pln encoding<span class="pun =<span class="str "utf-8"<span class="pun ?><span class="pln
<span class="pun <?<span class="pln mso<span class="pun -<span class="pln infoPathSolution
name<span class="pun =<span class="str "urn:schemas-microsoft-com:office:infopath:Lesson:-myXSD-2011-11-16T10-48-36"<span class="pln
solutionVersion<span class="pun =<span class="str "1.0.0.193"<span class="pln
productVersion<span class="pun =<span class="str "12.0.0.0"<span class="pln
<span class="typ PIVersion<span class="pun =<span class="str "1.0.0.0"<span class="pln
href<span class="pun =<span class="str "5.xsn"<span class="pun ?><span class="pln
<span class="pun <?<span class="pln mso<span class="pun -<span class="pln application
progid<span class="pun =<span class="str "InfoPath.Document"<span class="pln
versionProgid<span class="pun =<span class="str "InfoPath.Document.2"<span class="pun ?><span class="pln
<span class="tag <my:Form><span class="pln
<span class="tag <my:TeacherID><span class="pln 63hg84<span class="tag </my:TeacherID><span class="pln
<span class="tag <my:Error></my:Error><span class="pln
<span class="tag <my:FormName><span class="pln Amber <span class="tag </my:FormName><span class="pln
<span class="tag <my:FormStatus><span class="pln Submitted<span class="tag </my:FormStatus><span class="pln
<span class="pln <span class="tag </my:Form> <span class="pln <span class="tag <my:OverallGrade><span class="pln 3<span class="tag </my:OverallGrade><span class="pln
[/code]

1) I need to change the value of the name,href in the <?mso-infopath > element from to the first xml to the second one.
2) The first xml format is wrong as the </my:form> closing tag needs to come after the <my:FormStatus> tag.
a) how do i iterate through the xml to get the attribute of mso-infopath ?
b) How do i iterate move the closing tag i.e. </my:Form> to the correct position.




View the full article
 
Back
Top