Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 10th, 2005, 08:35 AM
Registered User
 
Join Date: Jan 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default re: modify the column in a xml file

Hi

In c# program What you should do is store the field (i.e column name)of a xml schema file in an array . Then while looping thru’ your input name (a xml file say "first.xml" with a single column name same as the name as in the schema) you should find out where this column name lies in your input file (i.e the index. Could be 4th one). Then update the output file accordingly(write that column values from the xml file into the output xml file).How to do this. a coding help pls


ramyaa





 
Old January 20th, 2005, 04:50 AM
Authorized User
 
Join Date: Jan 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

<html>
<head>
<script language="javascript">
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.load("solu.xml")
//alert(xmlDoc.xml)

var orderlist = xmlDoc.getElementsByTagName("ORDER-LIST")
var orderListLen = orderlist.item(0).childNodes.length

for(i=0;i<orderListLen;i++)
{
  var childNodes = orderlist.item(0).childNodes(i).nodeName
  var attribProdId= orderlist.item(0).childNodes(i).getAttribute("Prod uct_Id")
  var attribProdName=orderlist.item(0).childNodes(i).get Attribute("Product_Name")
  var attribPrice = orderlist.item(0).childNodes(i).getAttribute("Pric e")
  document.write("( " + attribProdId + " ) " + " <a href='#' id='" + i + "'name='" + attribProdId + "' onclick='changeData(this.id)'>" + attribProdName + "</a> Price = " + attribPrice + "<br>")
}



function changeData(Id)
{
  var SetPrice = parseInt(prompt("Enter the new Price for this product : ",""))
  var SetProdName = prompt("Enter the new Name for this product : ","")

    //The new Price and Product Name would be saved here
    orderlist.item(0).childNodes(Id).setAttribute("Pro duct_Name",SetProdName)
    orderlist.item(0).childNodes(Id).setAttribute("Pri ce",SetPrice)

    //Update the xml file
    xmlDoc.save("solu.xml")

    alert("New Price = " + SetPrice + " New Product Name = " + SetProdName)
    window.location.reload(1)

}
</script>
</head>

<body>
</body>
</html>

If u can get the hint from the above code u can surely go ahead and do it in ASP.NET. What u need to do is generate hyperlinks or whatever using ASP.NET and add an "onclick" event using ASP.NET and then call a function called changeData(Id) using the same and the rest can be done using javascript.
  May be This Will help u.
Regards
Sibaji Basak






Similar Threads
Thread Thread Starter Forum Replies Last Post
Modify XML with XSLT aowen355 XSLT 4 December 26th, 2007 10:19 AM
Access / Modify Configuration File prasanna.nadgir C# 2 October 2nd, 2007 12:14 PM
Modify resource file with out recompile the proj ndc550 ASP.NET 2.0 Basics 0 November 2nd, 2006 05:19 PM
Modify header and footer of word file in ASP Andraw Classic ASP Basics 1 January 14th, 2005 08:04 PM
Javascript and using the XMLDOM to modify xml TheNinthPlayer Javascript 1 January 5th, 2005 05:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.