473,385 Members | 2,243 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

I need help modifying a value in an XML file

Hi I am trying to change a value in my Metadata.xml file (the IIS configuration file). I'm trying to use XMLstarlet to do it, so if you can help me with that then great, but if you can show me another way (like with an XSLT file or something) that would be great too - what ever work!

Here's an excerpt of the xml file:
Expand|Select|Wrap|Line Numbers
  1. <?xml version ="1.0"?>
  2. <configuration xmlns="urn:microsoft-catalog:XML_Metabase_V64_0">
  3. <MBProperty>
  4. <IIsWebVirtualDir    Location ="/LM/W3SVC/1/ROOT/Auditor"
  5.               AccessFlags="AccessRead | AccessScript"
  6.               AppFriendlyName="Auditor"
  7.               AppIsolated="2"
  8.               AppRoot="/LM/w3svc/1/ROOT/Auditor"
  9.               DefaultDoc="Default.htm"
  10.               DirBrowseFlags="EnableDefaultDoc"
  11.               DontLog="FALSE"
  12.               Path="C:\inetpub\wwwroot\Auditor"
  13.        >
  14. </IIsWebVirtualDir>
  15. <IIsWebVirtualDir    Location ="/LM/W3SVC/1/ROOT/Reporter"
  16.               AccessFlags="AccessRead | AccessScript"
  17.               AppFriendlyName="Bally Live Reporter Website"
  18.               AppIsolated="2"
  19.               AppRoot="/LM/W3SVC/1/ROOT/Reporter"
  20.               DefaultDoc="Default.htm"
  21.               DirBrowseFlags="EnableDefaultDoc"
  22.               DontLog="FALSE"
  23.               Path="C:\inetpub\wwwroot\Reporter\"
  24.        >
  25. </IIsWebVirtualDir>
  26. </MBProperty>
  27. </configuration>
  28.  
I want to change the DefaultDoc attribute of a specific IIsWebVirtualDir element. I can identify this element by either the Location or the AppFriendlyName attribute.

This command will change all of them:
Expand|Select|Wrap|Line Numbers
  1. XML ed -N ns="urn:microsoft-catalog:XML_Metabase_V64_0" -u "//ns:IIsWebVirtualDir/@DefaultDoc" -v "publish.htm" test.xml
This one will change none:
Expand|Select|Wrap|Line Numbers
  1. XML ed -N ns="urn:microsoft-catalog:XML_Metabase_V64_0" -u "//ns:IIsWebVirtualDir[@Location="/LM/W3SVC/1/ROOT/Reporter"]/@DefaultDoc" -v "publish.htm" test.xml
Can anyone tell me what I'm doing wrong in XMLstarlet?
Can anyone show me a different way to do this?

Thanks,
Mike
Nov 3 '06 #1
0 1693

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: yvan | last post by:
I was wondering if someone here could help me with modifying this PHP template so that it does something very specific for me. My knowledge of PHP is very limited (I'm more of a Cold Fusion...
5
by: Benne Smith | last post by:
Hi, I have three enviroments; a development, a testing and a production enviroment. I'm making a big application (.exe), which uses alot of different webservices. I don't use the webservices...
8
by: vadim | last post by:
Hi, Is there a .Net control available that allows to write into web.config file appsettings section? The idea is to create encrypted user name and password for database connection and then...
7
by: Enigma Curry | last post by:
I need to store a large number of files in an archive. From Python, I need to be able to create an archive, put files into it, modify files that are already in it, and delete files already in it. ...
2
by: rk | last post by:
I have the following library.xml file coming from a system, this can't be modified. ____________________________________________________________________________ <?xml version="1.0"...
6
by: tuxedo | last post by:
I have a fixed html structure, where only one form and a simple select menu will exist on an html page, as follows: <form action="order" method="POST"> <select name="dinner"> <option...
24
by: allpervasive | last post by:
hi all, this is reddy, a beginner to c lang,,here i have some problems in reading and modifying the contents of a file,, hope you can help to solve this problem. Here i attach the file to be...
1
by: Joe Cool | last post by:
I am attempting to add a function to an application I am working on to modify the JPEG Comment in a Jpeg image file. I can retrieve the JPEG Comment with no problem. The problem is modifying it....
0
by: bvanderzanden | last post by:
I'm having a problem dynamically setting the url for the web service used in a dll. When I reference a web service it sets it to dynamic and creates a setting for the url. I have modified the url...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.