Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

removeChild delete all my records

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
hi! please help me sort this out. badly urgent in need.

I am trying to delete a record on my XML file: the structure is here:

- <APPEND>
- <PACKAGE>
- <NEWPACKAGE id=&quot;7878&quot;>
<PID>7878</PID>
<ITEM>h</ITEM>
<DESCRIPTION>h</DESCRIPTION>
<VALUE>j</VALUE>
<HEIGHT>hj</HEIGHT>
<WEIGHT>j</WEIGHT>
<LENGTH>j</LENGTH>
<WIDTH>j</WIDTH>
<ARTICLES />
- <NEWARTICLE>
<ARTICLERANDID>343</ARTICLERANDID>
<SelectItemDesc>Ink</SelectItemDesc>
<ARTICLEQUANTITY>cgf</ARTICLEQUANTITY>
<ARTICLEUNITPRICE>d</ARTICLEUNITPRICE>
<ARTICLEINVOICE>df3</ARTICLEINVOICE>
<ArticleCopyID>7878</ArticleCopyID>
<ArticleCopyItem>h</ArticleCopyItem>
<xPACKAGEARTICLEID />
<xPACKAGEARTICLEDESCRIPTION />
<PACKAGEARTICLEID>7878</PACKAGEARTICLEID>
<PACKAGEARTICLEDESCRIPTION>h</PACKAGEARTICLEDESCRIPTION>
</NEWARTICLE>
</NEWPACKAGE>
</PACKAGE>
</APPEND>

I want to delete the record under NEWARTICLE specifically UNDER ARTICLERANDID=343.

And my code for the deletion is here:

set objXMLdelete = server.CreateObject(&quot;Microsoft.XMLDOM&quot;)
objXMLdelete.async = false
objXMLdelete.load strXMLFile
objXSLdelete.async = false
objXSLdelete.load strXSLFile

set objRootdelete = objXMLdelete.documentElement
set objNodedelete = objRootdelete.SelectSingleNode(&quot;PACKAGE[NEWPACKAGE[NEWARTICLE[ARTICLERANDID='&quot;&mystrID&&quot;']]]&quot;)

objRootdelete.removeChild(objNodedelete)

once i run this code: it removes all the records starting from NEWPACKAGE ... up to NEWARTICLES.

The thing is, i just want to delete the record under NEWARTICLES and data of PACKAGE should be retain.

Please help. tnx!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top