473,385 Members | 1,461 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.

XML Edit/Save

Hey All,

I need to edit an existing XML file and save it. It seem pretty easy
and straight forward but it fails because (I assume) the xml document
lists a schema location that I do not have access to.

My code: (testing purposes)

xmlDocument doc = new XmlDocument();

doc.Load(@"C:\Documents and Settings\Gina\Desktop\test1.xml");
XmlNodeList nodeList = doc.SelectNodes("//Order");

foreach (XmlNode node in nodeList)
richTextBox1.AppendText(node.Name+'\n');

But apparently since it can't find the schema I get zero nodes. (If I
remove the schemalocation line from the XML file that all is happy)

snipit from xml file:

<Order xmlns="http://www.abc.com/xml/Order"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.abc.com/xml/Order.xsd Order.xsd"
CustomerID="MyCust" orderDate="2006-11-13" OrderID="8704356">

For example I would like to change the OrderID.

Can I move forward without the validation?

If I can get a copy of the xsd can I put it locally on my machine and
have it use that instead?

~Gina~

Dec 13 '06 #1
2 3558
Check this out:
http://ww.w3schools.com/dom/dom_examples.asp

chanmm

"Gina_Marano" <gi*******@gmail.comwrote in message
news:11**********************@j72g2000cwa.googlegr oups.com...
Hey All,

I need to edit an existing XML file and save it. It seem pretty easy
and straight forward but it fails because (I assume) the xml document
lists a schema location that I do not have access to.

My code: (testing purposes)

xmlDocument doc = new XmlDocument();

doc.Load(@"C:\Documents and Settings\Gina\Desktop\test1.xml");
XmlNodeList nodeList = doc.SelectNodes("//Order");

foreach (XmlNode node in nodeList)
richTextBox1.AppendText(node.Name+'\n');

But apparently since it can't find the schema I get zero nodes. (If I
remove the schemalocation line from the XML file that all is happy)

snipit from xml file:

<Order xmlns="http://www.abc.com/xml/Order"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.abc.com/xml/Order.xsd Order.xsd"
CustomerID="MyCust" orderDate="2006-11-13" OrderID="8704356">

For example I would like to change the OrderID.

Can I move forward without the validation?

If I can get a copy of the xsd can I put it locally on my machine and
have it use that instead?

~Gina~
Dec 14 '06 #2
Changmm,

Thanks much for your response to my question!

~Gina~

Chan Ming Man wrote:
Check this out:
http://ww.w3schools.com/dom/dom_examples.asp

chanmm

"Gina_Marano" <gi*******@gmail.comwrote in message
news:11**********************@j72g2000cwa.googlegr oups.com...
Hey All,

I need to edit an existing XML file and save it. It seem pretty easy
and straight forward but it fails because (I assume) the xml document
lists a schema location that I do not have access to.

My code: (testing purposes)

xmlDocument doc = new XmlDocument();

doc.Load(@"C:\Documents and Settings\Gina\Desktop\test1.xml");
XmlNodeList nodeList = doc.SelectNodes("//Order");

foreach (XmlNode node in nodeList)
richTextBox1.AppendText(node.Name+'\n');

But apparently since it can't find the schema I get zero nodes. (If I
remove the schemalocation line from the XML file that all is happy)

snipit from xml file:

<Order xmlns="http://www.abc.com/xml/Order"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.abc.com/xml/Order.xsd Order.xsd"
CustomerID="MyCust" orderDate="2006-11-13" OrderID="8704356">

For example I would like to change the OrderID.

Can I move forward without the validation?

If I can get a copy of the xsd can I put it locally on my machine and
have it use that instead?

~Gina~
Dec 29 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Glenn M | last post by:
I have a shared XML file on a server . i also have one xslt file that performs a simple transform on in to view the data. now i want to have another page that lets users modify the shared xml...
1
by: David Sagenaut | last post by:
Can I set a whole datagrid in edit mode, like a table? I can edit the data in the datagrid. After done, I can click the save button to save the data into a datasousce. I don't want to used the...
2
by: Luqman | last post by:
How can I put GridView and DetailView control to Edit Mode with one click of button ? I don't want to show built-in Edit Buttons of above controls. Best Regards, Luqman
0
by: jaquesmayol | last post by:
Hi : I got a form with a datagrid and a toolbox with a disk icon to save de changes to a dataset from the grid. When i start editing a row and click on the save icon the changes are not saved...
1
by: fariba123 | last post by:
hi i am working with php. i am designing a site which will store employee information along with his/her photo and also edit information. i have completed the information save and edit part. now i...
3
by: Mark | last post by:
Hello, What I need to know is if there is a better method to run/edit modules on my pc. I'm currently running the IDLE shell under Python 2.5, on Windows XP. Every time I edit my .txt or .py...
2
by: torbjorn.maro | last post by:
I'm the developer of an enterprise level web application that among other things handles documents. The documents are stored in a database. There is now simple functionality to check out and...
2
by: sowmram | last post by:
Hi, I'm trying to create a site very similar to wiki, where you can edit, save.. Generally update data for the future use... This particular program I wanna do it using javascripts... Please...
1
by: gurmet | last post by:
Hi All I have been looking around for help, and finally post this problem. I created a form to edit a record. Before i can click save button on the edit form i need to check if the data that...
1
by: beyrself | last post by:
Hi,all What i am trying to do now is to show the content of the dnsredir.ini file on the forms and able to edit it. The dnsredir.ini file file looks like this ;Configuration INI file...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...

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.