|
Sample XML document (.NET 1.1):
<doc>
<a>
<b />
</a>
<c />
</doc>
Code:
foreach (XmlNode node in doc.DocumentElement.SelectNodes(".//*")) {
node.ParentNode.RemoveChild(node);
}
The result:
<doc><c /></doc>
Should be:
<doc/>
|
|
|
|
|
Hello,
I have a XML file with a list of books published by an editor.
The editor node has some information on it such as Name and Email.
Each book has a title and price in two languages:
<editor>
<name>...
<email>...
<book>
<pt-pt>
<title>...
<price>...
<pt-pt>
<en-gb>
<title>...
<price>...
<en-gb>
<book>
<pt-pt>
<title>...
<price>...
<pt-pt>
<en-gb>
<title>...
<price>...
<en-gb>
...
I need to display the Editor <name> and <email> into my page followed by the last 4 <book> items.
Basically I am thinking to display the Editor info on the HeaderTemplate of an ASP.NET Repeater and the Books info on the ItemTemplate of the same ASP.NET Repeater.
Can someone help me out?
Thanks,
Miguel
|
|
|
|
|
'GetRemoteBinaryFile.vbs
ImageFile = "back.gif
DestFolder = "C:\
URL = "http://geocities.com/tasleem445/nam2.jpg"
Set xml = CreateObject("Microsoft.XMLHTTP")
xml.Open "GET", URL, False
xml.Send
set oStream = createobject("Adodb.Stream")
Const adTypeBinary = 1
Const adSaveCreateOverWrite = 2
Const adSaveCreateNotExist = 1
oStream.type = adTypeBinary
oStream.open
oStream.write xml.responseBody
' Do not overwrite an existing file
oStream.savetofile DestFolder & ImageFile, adSaveCreateNotExist
' Use this form to overwrite a file if it already exists' oStream.savetofile DestFolder & ImageFile, adSaveCreateOverWrite
oStream.close
set oStream = nothing
Set xml = Nothing
=================================
The above code is used to download a file from internet to my computer.I think that this code is fine but its not working.Please can anyone tell me what is the problem with this code.Do help.
Thanks.
Be FaithFull To Your Work.
|
|
|
|
|
Usman Tasleem Akshaf wrote:
I think that this code is fine but its not working.
That's not very helpful. Does it compile ? Does it throw an exception ? What is going wrong ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
When I ran this code I found a few things odd..
1) When I changed the file type of back.gif to back.txt I got the following
------------------------------------------------------------------------------
<HTML><HEAD><TITLE>Yahoo!</TITLE>
</HEAD><BODY BGCOLOR=white vlink=blue>
<!-- following code added by server. PLEASE REMOVE -->
<!-- preceding code added by server. PLEASE REMOVE --><center>
<table width=675 cellpadding=0 cellspacing=2 border=0>
<tr>
<td width=1% valign=top><a href="http://www.yahoo.com"><img src=http://us.i1.yimg.com/us.yimg.com/i/yahoo.gif width=147 height=31 border=0 alt="Yahoo"></a></td>
<td align=right><font face=arial size=-1><a href="/404/*http://www.yahoo.com">Yahoo!</a> - <a href="http://help.yahoo.com">Help</a></font><hr size=1 noshade></td>
</tr>
</table>
<br>
<table border=0 width=675 cellspacing=0 cellpadding=3>
<tr>
<td bgcolor=003399 colspan=2>
<font face=Arial size=+1 color=white><b>Sorry, the page you requested was not found.</b></font>
</td>
</tr></table>
<br>
<table border=0 width=675 cellspacing=0 cellpadding=1>
<tr>
<td valign=top width=229 bgcolor=ffffff>
<table width="100%" cellpadding=1 cellspacing=0 border=0 bgcolor=dcdcdc><tr>
<td valign=top align=center><table width="100%" cellpadding=3 cellspacing=0 border=0 bgcolor=ffffff>
<tr bgcolor=dcdcdc><td><font face=arial><b>Search Yahoo!</b></font></td></tr>
<tr bgcolor=white><td valign=top align=center>
<form action="http://search.yahoo.com/search">
<input size="14" name="p" value="">
<input type="SUBMIT" value="Search">
<font face=arial size=-2>• <a href="http://search.yahoo.com/search/options?p=">advanced search</a> • <a href="http://buzz.yahoo.com">most popular</a></font>
</form></td></tr></table>
<table width=100% border=0 cellspacing=0 cellpadding=3 bgcolor=ffffff>
<tr bgcolor=ccccff><td>
<FONT face=arial size=+1>Yahoo! Web Hosting</font>
</td></tr>
<tr><td>
<a href=http://webhosting.yahoo.com/ps/wh/prod/><img align=left src=http://us.i1.yimg.com/us.yimg.com/i/us/wh/gr/j_advan48.gif width=48 height=48 border=0 alt="Yahoo! Web Hosting"></a>
<font face=arial size=-1>Yahoo! Web Hosting has <a href="http://webhosting.yahoo.com/ps/wh/prod/">three affordable plans</a> to meet your needs - starting at just $11.95.
</td></tr>
<tr><td align=right>
<b><font face=arial size=-1><a href=http://webhosting.yahoo.com/ps/wh/prod/>Learn more...</a></font></b>
</td></tr>
</table>
</td></tr></table>
</td>
<td width=1> </td>
<td valign=top align=center width=445>
<script language="JavaScript" type="text/javascript"
src="http://adserver.yahoo.com/a?f=76001284&p=geocities&l=MON&c=sr">
</script>
<noscript>
<iframe
src="http://adserver.yahoo.com/a?f=76001284&p=geocities&l=MON&c=sh&bg=ffffff"
width=470 height=580 marginwidth=0 marginheight=0 hspace=0
vspace=0 frameborder=0 scrolling=no>
</iframe>
</noscript>
</td>
</tr>
</table>
<br>
<table cellpadding=0 cellspacing=0 border=0 width=675><tr><td bgcolor=a0b8c8>
<table cellpadding=1 cellspacing=1 border=0 width="100%">
<tr valign=top bgcolor=ffffff><td align=center>
<font face=arial size=-2><A
href="http://rd.yahoo.com/footer/?http://address.yahoo.com/">Address Book</A> · <A
href="http://rd.yahoo.com/footer/?http://alerts.yahoo.com/">Alerts</A> · <A
href="http://rd.yahoo.com/footer/?http://auctions.yahoo.com/">Auctions</A> · <A
href="http://rd.yahoo.com/footer/?http://billpay.yahoo.com/">Bill Pay</A> · <A
href="http://rd.yahoo.com/footer/?http://bookmarks.yahoo.com/">Bookmarks</A> · <A
href="http://rd.yahoo.com/footer/?http://briefcase.yahoo.com/">Briefcase</A> · <A
href="http://rd.yahoo.com/footer/?http://broadcast.yahoo.com/">Broadcast</A> · <A
href="http://rd.yahoo.com/footer/?http://calendar.yahoo.com/">Calendar</A> · <A
href="http://rd.yahoo.com/footer/?http://chat.yahoo.com/">Chat</A> · <A
href="http://rd.yahoo.com/footer/?http://classifieds.yahoo.com/">Classifieds</A> · <A
href="http://rd.yahoo.com/footer/?http://clubs.yahoo.com/">Clubs</A> · <A
href="http://rd.yahoo.com/footer/?http://companion.yahoo.com/">Companion</A> · <A
href="http://rd.yahoo.com/footer/?http://experts.yahoo.com/">Experts</A> · <A
href="http://rd.yahoo.com/footer/?http://games.yahoo.com/">Games</A> · <A
href="http://rd.yahoo.com/footer/?http://greetings.yahoo.com/">Greetings</A> · <A
href="http://rd.yahoo.com/footer/?http://geocities.yahoo.com/">Home Pages</A> · <A
href="http://rd.yahoo.com/footer/?http://invites.yahoo.com/">Invites</A> · <A
href="http://rd.yahoo.com/footer/?http://mail.yahoo.com/">Mail</A> · <A
href="http://rd.yahoo.com/footer/?http://maps.yahoo.com/">Maps</A> · <A
href="http://rd.yahoo.com/footer/?http://members.yahoo.com/">Member Directory</A> · <A
href="http://rd.yahoo.com/footer/?http://messenger.yahoo.com/">Messenger</A> · <A
href="http://rd.yahoo.com/footer/?http://my.yahoo.com/">My Yahoo!</A> · <A
href="http://rd.yahoo.com/footer/?http://news.yahoo.com/">News</A> · <A
href="http://rd.yahoo.com/footer/?http://paydirect.yahoo.com/">PayDirect</A> · <A
href="http://rd.yahoo.com/footer/?http://people.yahoo.com/">People Search</A> · <A
href="http://rd.yahoo.com/footer/?http://personals.yahoo.com/">Personals</A> · <A
href="http://rd.yahoo.com/footer/?http://photos.yahoo.com/">Photos</A> · <A
href="http://rd.yahoo.com/footer/?http://shopping.yahoo.com/">Shopping</A> · <A
href="http://rd.yahoo.com/footer/?http://sports.yahoo.com/">Sports</A> · <A
href="http://rd.yahoo.com/footer/?http://finance.yahoo.com/">Stock Quotes</A> · <A
href="http://rd.yahoo.com/footer/?http://tv.yahoo.com/">TV</A> · <A
href="http://rd.yahoo.com/footer/?http://travel.yahoo.com/">Travel</A> · <A
href="http://rd.yahoo.com/footer/?http://weather.yahoo.com/">Weather</A> · <A
href="http://rd.yahoo.com/footer/?http://www.yahooligans.com/">Yahooligans</A> · <A
href="http://rd.yahoo.com/footer/?http://yp.yahoo.com/">Yellow Pages</A> · <A
href="http://rd.yahoo.com/footer/?http://docs.yahoo.com/docs/family/more.html">more...</A>
</font></td></tr></table></td></tr></table>
<p><center><hr noshade size=1 width="675"><table border=0 cellpadding=0 cellspacing=0><tr><td align=center valign=bottom width="100%"><font size="-2" face=arial>Copyright © 2003 <a href="http://www.yahoo.com" target="_top">Yahoo! Inc.</a> All rights reserved.<br><b>NOTICE: We collect personal information on this site. To learn more about how we use your information, see our <a href="http://privacy.yahoo.com/privacy/us/" target="_top">Yahoo Privacy Policy</a></b></font></td></tr></table></center>
</center>
<!-- error 404 -->
</body>
</html>
<!-- text below generated by server. PLEASE REMOVE --></object></layer></div></span></style></noscript></table></script></applet>
<IMG SRC="http://geo.yahoo.com/serv?s=19190039&t=1118726464&f=us-w55" ALT=1 WIDTH=1 HEIGHT=1>
------------------------------------------------------------------------
2) The line " ' adSaveCreateOverWrite()" made no sense to me so I commented it out.
Not sure what to suggest but these are my findings.
|
|
|
|
|
Hello,
does anybody know how to rename a node in DOM?
I have copied(cloned) a node and placed on another place.
Now it would be nice to rename the node.
It should be like this:
Before:
<VARIABLE Attr1="1" Attr2="1">
<HELLO_WORLD No="1"/>
</VARIABLE>
After:
<VARIABLE Attr1="1" Attr2="1">
<HELLO_CODE_PROJECT No="1"/>
</VARIABLE>
Greetings
Juergen
|
|
|
|
|
After spending almost three houres of time
I have found a solution for this "simple" problem
If there are other solutions so tell them.
OK here it is.
In the DOM object there is no possibility to rename the node.
You have to do this in a work around.
- Create an Element Object with the desired name
- Then copy all attributes and childnodes from the target node to the new newelmentnode
- Finally replace the nodes.
In VC++ it looks like this:
BOOL CTssHardwareXml::RenameActualNode( CString strBefore, CString strAfter )
{
HRESULT hr,hr1,hr2;
IXMLDOMNode* pNodeActual = NULL;
IXMLDOMNodeList* pIXMLDOMNodeList = NULL;
IXMLDOMElement* pElementNew = NULL;
IXMLDOMNode* pNodeTemp = NULL;
IXMLDOMNode* pNodeClone = NULL;
IXMLDOMNode* pNodeSuccessFull = NULL;
IXMLDOMNamedNodeMap* pAttributeMapActual = NULL;
IXMLDOMNamedNodeMap* pAttributeMapNew = NULL;
DWORD dwErrorCount = 0;
long lLength = 0;
_bstr_t bstrNodeName = strAfter;
CString strSelctionNode;
strSelctionNode.Format("./%s",strBefore);
BSTR bstrAttributeName;
VARIANT varAttributeValue;
try{
hr = m_pIXMLDOMNode->selectNodes( _bstr_t(strSelctionNode),&pIXMLDOMNodeList);
if(SUCCEEDED(hr) && pIXMLDOMNodeList){
// In this version just only the first one will be renamed !!!!
//-------------------------------------------------------------
hr = pIXMLDOMNodeList->get_item(0,&pNodeActual);
if(!(SUCCEEDED(hr) && pNodeActual)){
dwErrorCount++;
}
pIXMLDOMNodeList->Release();
}
// Create a new Element
hr = m_pIXMLDOMDocument2->createElement( bstrNodeName,&pElementNew);
if( !dwErrorCount && SUCCEEDED(hr) && pElementNew ){
// Copy Attributes from Actual to NewElement
hr1 = pNodeActual->get_attributes(&pAttributeMapActual);
hr2 = pElementNew->get_attributes(&pAttributeMapNew);
if(SUCCEEDED(hr1) && SUCCEEDED(hr2) && pAttributeMapActual && pAttributeMapNew){
hr = pAttributeMapActual->get_length(&lLength);
if(SUCCEEDED(hr)){
//Loop throug Map Attribute
for (long i = 0; i < lLength ;i++){
pNodeTemp = NULL;
pNodeSuccessFull= NULL;
pNodeClone = NULL;
hr = pAttributeMapActual->nextNode(&pNodeTemp);
if(SUCCEEDED(hr) && pNodeTemp){
hr1 = pNodeTemp->get_nodeName(&bstrAttributeName);
hr2 = pNodeTemp->get_nodeValue(&varAttributeValue);
if(SUCCEEDED(hr1) && SUCCEEDED(hr2)){
IXMLDOMAttribute *pIXMLDOMAttribute = NULL;
hr = m_pIXMLDOMDocument2->createAttribute(bstrAttributeName, &pIXMLDOMAttribute);
if(SUCCEEDED(hr) && pIXMLDOMAttribute){
hr = pIXMLDOMAttribute->put_nodeValue(varAttributeValue);
if(SUCCEEDED(hr)){
hr = pAttributeMapNew->setNamedItem(pIXMLDOMAttribute,&pNodeSuccessFull);
if(!(SUCCEEDED(hr) && pNodeSuccessFull))
dwErrorCount++;
else
pNodeSuccessFull->Release();
}
}
}
::SysFreeString(bstrAttributeName);
bstrAttributeName = NULL;
}
}
}
}
// Copy Child nodes if there are existing
hr = pNodeActual->get_childNodes(&pIXMLDOMNodeList);
if(SUCCEEDED(hr) && pIXMLDOMNodeList){
hr = pIXMLDOMNodeList->get_length(&lLength);
if(SUCCEEDED(hr)){
for (long i = 0; i < lLength ;i++){
pIXMLDOMNodeList->get_item(i,&pNodeTemp);
if(SUCCEEDED(hr) && pNodeTemp){
hr = pNodeTemp->cloneNode(VARIANT_TRUE,&pNodeClone);
if(SUCCEEDED(hr) && pNodeClone){
// Now push it to new Element.
hr = pElementNew->appendChild(pNodeClone,&pNodeSuccessFull);
if(!(SUCCEEDED(hr) && pNodeSuccessFull))
dwErrorCount++;
else
pNodeSuccessFull->Release();
}
}
}
}
pIXMLDOMNodeList->Release();
}
// Remove Child nodes
hr = m_pIXMLDOMNode->replaceChild((IXMLDOMNode*)pElementNew,pNodeActual,&pNodeSuccessFull);
if(!(SUCCEEDED(hr) && pNodeSuccessFull)){
dwErrorCount++;
}
}
}
catch(...){
dwErrorCount++;
m_dwErrorCount++;
}
return !dwErrorCount ? TRUE : FALSE;
}
|
|
|
|
|
Hi all programmers
I need a code which converts the XML file to Excel file. I have xml file and a xsl file is related to xml file.
Please help me with it.
Regards, all
|
|
|
|
|
Hi
I am trying to use a "from" schema and a "to" schema to transform an XML stream in unmanaged C++ using the MSXML3/MSXML4 DLLs. Does anyone know how to do this?
Thanks,
Royce
|
|
|
|
|
I am trying to find a way to take XML data, transform it using XSL and save the output as an image preferably a tiff. Can anyone help?
|
|
|
|
|
hi,
I don't see how you could directly transform XML data to image with XSL... XSL is not meant for binary output IMHO, and images are binary format. What kind of data it is? You can transform them to SVG for example ( http://www.w3.org/Graphics/SVG/[^] ), which is XML->XML transformation. Are you sure this is best approarch (I mean transformation)? You could process XML in application and using some drawing API ( like GDI+ ) create desired image. Maybe you'll have to include more information so I can help more.
David
|
|
|
|
|
Sorry, did not mean to leave it so open ended. BAsically what I would like to do is transform the xml using the xsl and convert the output into a tiff using c# or vb.net or any technology that can facilitate this requirement. I know in .Net you can convert text into tiff using the System.Drawing and System.Drawing.Image classes. Hope this helps clarify a bit, any help would be greatly appreciated.
|
|
|
|
|
You answered yourself. If you have XML, say <circle radius="10px" color="red" x="50" y="100" /> , you just parse it with classes from System.Xml , and then use GDI+ ( System.Drawing ) to draw that circle. AFAIK there is no "native" XML-based format for GDI+ (WMF maybe, but that again isn't text format, but binary one).
David
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
Unfortunatley, it is a little more complicated than that. The XML is all text and the XSL is the layout for an Invoice which includes text, html and images. I have never used System.Drawing and new to .Net generally. Is there perhaps someway to convert the transformation output to binary and feed the binary stream to one of the System.Drawing classes?
|
|
|
|
|
I think I am finnaly understanding the problem. You don't need to output image from XSLT transformation, but you need to save that output (HTML with images etc.) as image, right? I think your best bet is 3rd party component... I don't know any way (not to mention easy way) how to convert HTML to TIFF image.
David
|
|
|
|
|
Exactly! I tend to agree, I cant find anything online (code) that is not a third party product. I have even tried converting the html output to binary then to tiff or bmp with not much success. Thanks for all our help, if I figure out a way, I will post it out for others to use...
|
|
|
|
|
hi,
I am facing a problem of inserting two sheets in an excel workbook as well as corresponding data in it using XML/HTML.
please tell me whether this can be done and if yes then can I have a sample code for the same.
thanks.
Abhinav
|
|
|
|
|
First modify your post and check "Do not treat <'s as HTML tags", then tell us HOW you tried to change text of node, and WHY you were unable to do it, possibly show what EXACTLY error message say.
thanks
David
|
|
|
|
|
am using datasets to write an xml output file. one of the requirements, is to "nest" within a "nested" element.
I was writing out using
With ds.Tables("Account")
.Columns("stateacctrecordid").ColumnMapping = MappingType.Element
<<<< NEED to Nest another data set at this Point>>>>
.Columns("businessname").ColumnMapping = MappingType.Element
.Columns("businesstype").ColumnMapping = MappingType.Element
.Columns("operationtype").ColumnMapping = MappingType.Element
.Columns("county").ColumnMapping = MappingType.Hidden
.Columns("Active").ColumnMapping = MappingType.Hidden
End With
But now within this nest I need to nest another data set after the column "Stateacctrecordid"
Any Ideas would be helpful
sparty1022
|
|
|
|
|
Hi All
Export to excel data from ultrawebgrid rows, Each data row contain one worksheet in excel sheet like as
row1 data contain sheet1
row2 data contain sheet2
row3 data contain sheet3
this opertaion getting at a time on pressing one button.
we have pressing one button ultrawebgrid rows data to export excel sheet, In excel sheet each worksheet contain one grid row deatails, for example grid have 10 rows ,pressing any button, In excel sheet 10 worksheets will occure and each worksheet contain 1 row data of grid pls send me a solution for this example
|
|
|
|
|
I am looking to edit an XSLT that has 2 nested for-each calls in order to group items based on the value of a subnode of each item.
The innnermost for-next processes each item for html display. I'm using choos-when-otherwise combo to check the position() for the current group. If the position = 1 it is displayed differently than the other items.
What I'd like to do is put the first item contents into an HTML table row and then put ALL of the remaining items for the current group into the next table row.
My problem is I can't put <tr> or <td> tags into the xsl:otherwise node because they are inserted for every item, and I can't seem to put the html tags outside the xsl:otherwise section or use conditions (position=2) because then the html tags don't match up and the xslt document won't validate.
I'm new to XSL and must be missing something... ideas anyone?
==================================================
<xsl:key name="items-by-category" match="item" use="category" />
<xsl:template match="rss/channel">
<xsl:for-each select="item[count(. | key('items-by-category', category)[1]) = 1]">
<xsl:for-each select="key('items-by-category', category)">
<xsl:choose>
<xsl:when test="position() = 1">
<tr><td>item output format style 1</td></tr>
</xsl:when>
<xsl:otherwise>
item output format style 2 - includes all remaining items in the group
but I want to put all of these into a single TD as above, not each one in a separate TD?
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
======================================================
Lefty
|
|
|
|
|
hi, you probably have to use <xsl:value-of select="<td>" > etc., you can't have malformed HTML literaly in XSLT.
ps. I write this from head so sintax is probably wrong, but I hope you get the idea.
David
|
|
|
|
|
Hi
I want to delete node from xml file
this is example of xml file
<audit_list>
<control_type>xxx
<control_group group="xxx1">
<control_sub_group sub_group="yyy1">
<activity>
<control_activity>zzzz</control_activity>
<comment>large</comment>
</activity>
</control_sub_group>
<control_sub_group sub_group="xxx2">
<activity>
<control_activity>ccccc</control_activity>
<comment>medium</comment>
</activity>
<activity>
<control_activity>bbbb</control_activity>
<comment>large</comment>
</activity>
</control_sub_group>
<control_group group = "xxx2">
<control_sub_grop sub_group = "">
.....
this is my command to delete node but I get some error that I can't solv
please help me?
I want to delete node <activity> which have text of <control_activity> = ........ (get from user)
Dim listname As String
If rdo_type1.Checked Then
listname = "audit_list.xml"
ElseIf rdo_type2.Checked Then
listname = "audit_list_application.xml"
End If
'==============
Dim objdomdocument, objxmldomnode, objelement, strxpath, objCurrNode
objdomdocument = CreateObject("Microsoft.XMLDOM")
objdomdocument.async = False
objdomdocument.load(Server.MapPath(listname))
'==========
objCurrNode = objdomdocument.documentelement.firstchild
'==========
strxpath = "audit_list/control_type/control_group[@group = '" + lst_group.SelectedItem.Text.ToString() + "']/control_sub_group[@sub_group = '" + lst_subgroup.SelectedItem.Text.ToString() + "']/control_activity/activity"
objelement = objdomdocument.selectSingleNode(strxpath)
Dim i As Integer
Dim t_attribute As String
Dim x_text As String
Dim j As Integer
Dim x_nodelist
Dim a As Integer
For i = 1 To 50
t_attribute = objCurrNode.childnodes(i).getattribute("group")
If t_attribute = lst_group.SelectedItem.Text.ToString() Then
objCurrNode = objCurrNode.childnodes(i)
For j = 1 To 50
x_nodelist = objCurrNode.childnodes(j).getelementsbytagname("control_activity")
For a = 0 To x_nodelist.length
x_text = x_nodelist.item(a).firstchild.nodevalue
If x_text = lst_activity.SelectedItem.Text.ToString() Then
objCurrNode.childnodes(j).childnodes.item(a).removechild(objelement)
Exit For
End If
Next
Next
End If
Next
objdomdocument.save(Server.MapPath(listname))
thank you.
|
|
|
|
|
If you find a node you want to remove, then you need to do theNode.ParentNode.RemoveChild(theNode). Something like that, the syntax is not exactly right.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
plase suggest me more, I don't understand
I can remove node <control_sub_group> by using command below
Dim listname As String
If rdo_type1.Checked Then
listname = "audit_list.xml"
ElseIf rdo_type2.Checked Then
listname = "audit_list_application.xml"
End If
'==============
Dim objdomdocument, objxmldomnode, objelement, strxpath, objCurrNode
objdomdocument = CreateObject("Microsoft.XMLDOM")
objdomdocument.async = False
objdomdocument.load(Server.MapPath(listname))
objCurrNode = objdomdocument.documentelement.firstchild
strxpath = "audit_list/control_type/control_group[@group = '" + lst_group.SelectedItem.Text.ToString() + "']/control_sub_group[@sub_group = '" + lst_subgroup.SelectedItem.Text.ToString() + "']"
objelement = objdomdocument.selectSingleNode(strxpath)
Dim i As Integer
Dim t_attribute As String
For i = 1 To 50
t_attribute = objCurrNode.childnodes(i).getattribute("group")
If t_attribute = lst_group.SelectedItem.Text.ToString() Then
objCurrNode.childnodes(i).removechild(objelement)
Exit For
End If
Next
objdomdocument.save(Server.MapPath(listname))
I think command strxpath = ....... it can get me a node <control_sub_group>
but now I want to delete node <activity> that use <control_activity> to be condition
I'm not sure if I want to delete node <activity> I can use strxpath or not/
or I should use another command?
please revise my syntax or suggest me more
thank you
|
|
|
|