|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
remove xml file root tagthe xml file is like this: <Root> <AutoData> <Table1> <Data1> 10 </Data1> <Data2> 20 </Data2> <Data3> 40 </Data3> <Table1> <Table2> <Data1> 10 </Data1> <Data2> 20 </Data2> <Data3> 40 </Data3> <Table2> </AutoData> </Root> I want to remove Root open and close tag (<Root> and </Root>), can anyone tell how? Thanks for your time. Martin martin1 wrote:
Show quoteHide quote > <Root> With the above structure it is easy, simply replace the DocumentElement > <AutoData> > <Table1> > <Data1> 10 </Data1> > <Data2> 20 </Data2> > <Data3> 40 </Data3> > <Table1> > <Table2> > <Data1> 10 </Data1> > <Data2> 20 </Data2> > <Data3> 40 </Data3> > <Table2> > </AutoData> > </Root> > > I want to remove Root open and close tag (<Root> and </Root>), can anyone > tell how? with the AutoData element: Dim Xml_Document as System.Xml.XmlDocument = New System.Xml.XmlDocument() Xml_Document.Load("file.xml") Xml_Document.ReplaceChild(Xml_Document.SelectSingleNode("Root/AutoData"), Xml_Document.DocumentElement) Xml_Document.Save("file2.xml") Thank you for yuor quick response! Martin
I will post 3 more xml questions in couple of minutes later, can you take a look at it? Thanks for your time. Show quoteHide quote "Martin Honnen" wrote: > martin1 wrote: > > > <Root> > > <AutoData> > > <Table1> > > <Data1> 10 </Data1> > > <Data2> 20 </Data2> > > <Data3> 40 </Data3> > > <Table1> > > <Table2> > > <Data1> 10 </Data1> > > <Data2> 20 </Data2> > > <Data3> 40 </Data3> > > <Table2> > > </AutoData> > > </Root> > > > > I want to remove Root open and close tag (<Root> and </Root>), can anyone > > tell how? > > > With the above structure it is easy, simply replace the DocumentElement > with the AutoData element: > > Dim Xml_Document as System.Xml.XmlDocument = New System.Xml.XmlDocument() > > Xml_Document.Load("file.xml") > > Xml_Document.ReplaceChild(Xml_Document.SelectSingleNode("Root/AutoData"), > Xml_Document.DocumentElement) > > Xml_Document.Save("file2.xml") > > > -- > > Martin Honnen --- MVP XML > http://JavaScript.FAQTs.com/ > Perhaps you should find an online tuturial, search these newsgroups, or
even visit a library or bookstore and do a little research yourself? I not trying to be mean here, but when people see you posting 5 questions within two hours, they are very likely to ignore your posts completely. All I'm asking is for you to please make an effort to find the answers before you post to a newsgroup. You will learn much more this way! Thanks, Seth Rowe martin1 wrote: Show quoteHide quote > Thank you for yuor quick response! Martin > > I will post 3 more xml questions in couple of minutes later, can you take a > look at it? > > Thanks for your time. > > "Martin Honnen" wrote: > > > martin1 wrote: > > > > > <Root> > > > <AutoData> > > > <Table1> > > > <Data1> 10 </Data1> > > > <Data2> 20 </Data2> > > > <Data3> 40 </Data3> > > > <Table1> > > > <Table2> > > > <Data1> 10 </Data1> > > > <Data2> 20 </Data2> > > > <Data3> 40 </Data3> > > > <Table2> > > > </AutoData> > > > </Root> > > > > > > I want to remove Root open and close tag (<Root> and </Root>), can anyone > > > tell how? > > > > > > With the above structure it is easy, simply replace the DocumentElement > > with the AutoData element: > > > > Dim Xml_Document as System.Xml.XmlDocument = New System.Xml.XmlDocument() > > > > Xml_Document.Load("file.xml") > > > > Xml_Document.ReplaceChild(Xml_Document.SelectSingleNode("Root/AutoData"), > > Xml_Document.DocumentElement) > > > > Xml_Document.Save("file2.xml") > > > > > > -- > > > > Martin Honnen --- MVP XML > > http://JavaScript.FAQTs.com/ > >
Learning OOP conceptual question
File Aging Program Iterating through a Hastable of objects Problem Adding and Using Resource Files update database through SQL script Passing values to another web page Find a control on a form of a specific name Re-size label text Debugging UserControl how to capture enter key without affrecting copy paste kcust keys |
|||||||||||||||||||||||