|
Hello all,
I'm trying to take an XMLnode (found with .SelectSingleNode()) from one document and copy it into another document. I keep gettting an error message that they are not the correct type. Anyone have some examples of the .clone function in VB.net 2005??
Thanks, Jeff
|
|
|
|
|
jeffb_ wrote:
VB.net 2005
I don't know how in 2k5, let be alone in VB... In good ol' .NET1.1 XML elements art in "document context" so elements can be used only within XmlDocument which created them.
(Just checked, work same way in .NET 2.0)
Well XmlNode ( so XmlElement too ) implements ICloneable . Should not be a problem.
David
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
Hi
I am trying to generate a XSD schema from a xml file by using a stream writer.
I created a dataset and read XML into that dataset.
Now I am trying the ds.WriteXmlSchema();
Actually it works correctly...but my issue is I want to send the written schema into a textbox on button click.
How would I do that?
This is the code I wrote for writing the schema:
System.IO.StreamWriter swXML= new System.IO.StreamWriter();
ds.WriteXmlSchema(swXML);
textBox1.Text =swXML.ToString();
|
|
|
|
|
|
Hi
I am using msxmlcpp library that was written by Sven Weigand. With this library
I parse an xml file. When one of my methods ends I receive an Access violation message
box. With debugging I have seen that it happens as a result of CXMLDOMNode class's destructor.
As a result of the destructor an ATL's CComPtr->Release method is called and it causes this
problem. Does anybody know how to solve thid problem?
Best regards
|
|
|
|
|
|
Hi
my program updates only farm name I want to search through loop farm name and it should
update address,
user and password from the existing file name
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load("c:/farm-config.xml");
XmlNode farm=xmldoc.SelectSingleNode("/root/farm-config/farm/@name");
MessageBox.Show(farm.InnerText);
farm.InnerText="devxcv1";
MessageBox.Show(farm.InnerXml);
xmldoc.Save("c:/farm-config.xml");
My XMl strucutrue is as given below
<?xml version="1.0" encoding="UTF-8"?>
<root>
<farm-config>
<farm name="sanjay">
<connection address="127.0.0.1" user="dog" password="cat">
<lastjob>Copy-All</lastjob>
<lastconnection startdate="2005-05-10" starttime="12:43:23" enddate="2005-05-10" endtime="12:58:32" />
<state>1</state>
</connection>
</farm>
<farm name="ram">
<connection address="localhost" user="root" selectedConnection="1" password="daask">
<lastJob>Copy-All</lastJob>
<lastConnection startdate="2005-05-10" starttime="12:43:23" enddate="2005-05-10" endtime="12:58:32" />
<state>1</state>
</connection>
</farm>
</farm-config>
</root>
--- supoose i want to find thr loop ram and i want o change address,user and password attribues value thr loop
if i change it changes the upper ones farm name=sanjay 's address,user and password
regards
sanjeev
|
|
|
|
|
Could you re-formulate this? In sentences maybe? Sorry, but I have hard time to understand what you have and what you want...
Maybe example of expected result could help. (?)
David
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
Hi buddy,
I have already implemented. Actually it searches the particular node from xml file and update child's node atrribute
Thanks for your interest
regards
sanjeev
|
|
|
|
|
Hello all!
I'm using ASP.NET and XML and sql server database.
I get daily updates in xml format and import them into the MSSQL DB.
I do this via a function in ASP.net using XmlReader.
The problem is that i have to do it manually!
Each morning i goto the asp.net website and click "get xml updates".
Is there any way to automate this procedure?
thanks guys
|
|
|
|
|
You Can use windows service for this.You can shedule your specific task like sending xml file to server by using ur service .You can start with it.
regards
sagar
|
|
|
|
|
windows service? meaning "scheduled task"?
can you please explain?
or maybe refer me to a link/article?
thank you
|
|
|
|
|
Hey,
anyone knows if there are handy tools to create a XSD scheme based on a XML file?
It's because I'm not familiar with XSD scheme's and I have to use one in my project.
My scenario is the following:
in my XML file i have the following structure:
<transfer>
<customer id="mh55">
<document id="1">
<article id="computer">
<priceIncl>565</priceIncl>
<priceExcl>412</priceExcl>
<priceVAT>85</priceVAT>
</article>
<article id="screen">
... same as above ...
</article>
</document>
<document id="2">
... same as above ...
</document>
</customer>
<customer id="xdc88">
... same as above ...
</customer>
</transfer>
|
|
|
|
|
|
|
just add it to a project in visual studio, and then there's an option if you right click on it, to make a schema for it... free.
/\ |_ E X E GG
|
|
|
|
|
hi,
I have written code to insert node
but its inserting after root node i want that it should insert after farm-config
pls check my code
private void button6_Click_1(object sender, System.EventArgs e)
{
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load("c:/farm-config.xml");
XmlElement farmelement = xmldoc.CreateElement("farm");
xmldoc.DocumentElement.InsertBefore(farmelement,xmldoc.DocumentElement.LastChild);
FileStream fsxml = new FileStream("c:/farm-config.xml",FileMode.Truncate,FileAccess.Write,FileShare.ReadWrite);
// XML Document Saved
xmldoc.Save(fsxml);
}
Pls modify my existing code so that i could insert after farm-config node
Hi this is my original stururtue of XML file
<?xml version="1.0" encoding="UTF-8"?>
<root>
<farm-config>
<farm name="dev1">
<connection address="localhost" user="root" selectedConnection="1" password="ram">
<lastJob>Copy-All</lastJob>
<lastConnection startdate="2005-05-10" starttime="12:43:23" enddate="2005-05-10" endtime="12:58:32" />
<state>1</state>
</connection>
</farm>
</farm-config>
</root>
after inserting XML looks like in the given below structure
----- --------- ----------------
<?xml version="1.0" encoding="UTF-8"?>
<root>
<farm />
<farm-config>
<farm name="dev1">
<connection address="localhost" user="root" selectedConnection="1" password="ram">
<lastJob>Copy-All</lastJob>
<lastConnection startdate="2005-05-10" starttime="12:43:23" enddate="2005-05-10" endtime="12:58:32" />
<state>1</state>
</connection>
</farm>
</farm-config>
</root>
I want Xml to be inserted after farm-config
This should be inserted like that
I am giving you the structure of XML file
What fucntion should i write or modify my existing code
For the code see above
<?xml version="1.0" encoding="UTF-8"?>
<root>
<farm-config>
<farm />
<farm name="dev1">
<connection address="localhost" user="root" selectedConnection="1" password="ram">
<lastJob>Copy-All</lastJob>
<lastConnection startdate="2005-05-10" starttime="12:43:23" enddate="2005-05-10" endtime="12:58:32" />
<state>1</state>
</connection>
</farm>
</farm-config>
</root>
regards
sanjeev
|
|
|
|
|
What about:
private void button6_Click_1(object sender, System.EventArgs e)
{
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load("c:/farm-config.xml");
XmlElement farmelement = xmldoc.CreateElement("farm");
XmlElement farmConfig = xmldoc.SelectSingleNode("//farmConfig");
xmldoc.InsertAfter(farmelement,farmConfig);
FileStream fsxml = new FileStream("c:/farm-config.xml",FileMode.Truncate,FileAccess.Write,FileShare.ReadWrite);
xmldoc.Save(fsxml);
}
[not tested]
hope it helps,
David
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
Hi all,
I need to serialize and deserialize complex elements that have attributes, and get their values as well.
An example xml snippet:
<root version="1.0" rating="1">
<tempsettings>
<setting name="blah1" istemp="False">99
<setting name="blah2" istemp="True">100
<root> contains a <tempsettings> which has an ArrayList of
<setting> that is converted to a typed array when accessed via a property.
The problem I'm running into is along with access to <setting>'s
attributes I need the values contained in them as well. (eg. 99, 100).
I've been fuddling around for days and can't come up with how to do this.
I can't use the xsd generator to generate my c# class as my xml root
is stuck to being "root" and contains additional attributes.
Is there a way I can achieve what I need using .NET XML
serialization?
I sincerely appreciate any feedback.
|
|
|
|
|
|
argh! sorry for the last post forgot to escape my tags...
<root version="1.0" producer="1">
<exportSettings>
<setting name="folder1" isBatchdefs="False">99</setting>
<setting name="folder2" isBatchdefs="True">100</setting>
</exportSettings>
</root>
|
|
|
|
|
david,
thanks for catching my page errors.
due to formatting errors with previous posts please let me restate my problem:
<root version="1.0" producer="1">
<exportsettings>
<setting name="folder1" isbatchdefs="False">99
<setting name="folder2" isbatchdefs="True">100
The problem I'm running into is along with access to <setting>'s
attributes I need the values contained in them as well. (eg. 99, 100).
I can't use the xsd generator to generate my c# class as my xml root
is stuck to being "root" and contains additional attributes.
Thanks for your comments and feedback!
|
|
|
|
|
that wasn't very lucky... there are still missing things in the text... check "Do not treat <'s as HTML tags" and post it (original post) one more time... please
thanks,
David
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
<root version="1.0" producer="1">
<exportSettings>
<setting name="folder1" isBatchdefs="False">99</setting>
<setting name="folder2" isBatchdefs="True">100</setting>
</exportSettings>
</root>
<root> contains an <exportSettings> which has an ArrayList of
<setting> that is converted to a typed array in the property field.
The problem I'm running into is along with access to <setting>'s
attributes I need the values contained in them as well. (eg. 99, 100).
I can't use the xsd generator to generate my c# class as my xml root
is stuck to being "root" and contains additional attributes.
Sorry I've been up for the past 36 hours and my mind is a little saggy bloated feeling.
Thanks for your comments and feedback!
|
|
|
|
|
I am quite confused... it doesn't look like typical XmlSerializer stuff. Maybe I am missing something? (does it show I don't know much about serialization? )
Maybe take a look at XmlElementEventHandler Delegate[^]. What I think is that if it doesn't deserialize automaticaly you can handle <exportsettings> in event handler (see link)... you have access to readed Element ... and it's XmlElement.InnerText value, which is exactly what you need.
hope it helps
p.s you may consider to get the CP login - at least for ability to delete/modify your posts
David
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|