|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
XML mergingI am looking for XML merging for the following scenarios. I want to load both the input files and show in the tree viewer and highlight the differences. Now its up to the user to select the correct node. Any non conflicting differences should be automatically merge onto the merge document. Any suggestion/caveats on how to do this in VB.Net? Regards Sanjib doc1.xml |doc2.xml ======== |======== <data> |<data> <product> | <product> <title>MS Access</title> | <title>MS Access Suite</title> <price>350.00</price> | <price>350.00</price> </product> | </product> <product> | <product> <title>MS Outlook</title> | <title>MS Outlook</title> <price>300.00</price> | <price>250.00</price> </product> | </product> <product> | <product> <title>MS Office</title> | <title>MS Office</title> <price>450.00</price> | <price>450.00</price> </product> | </product> </data> | <product> | <title>MS Visual ..Net</title> merge.xml| <price>310.00</price> | </product> |</data> ========= <data> <product> <title>select the title name based on the decision</title> <price>350.00</price> </product> <product> <title>MS Outlook</title> <price>select the price based on the decision</price> </product> <product> <title>MS Office</title> <price>450.00</price> </product> <product> <title>MS Visual .Net</title> <price>310.00</price> </product> </data> This may help:
as in, to find which items are duplicates: http://support.microsoft.com/default.aspx?scid=kb;en-us;326145 Here are my notes about my implmentation of the KB /* * See KB http://support.microsoft.com/default.aspx?scid=kb;en-us;326145 * There were 2 bugs in the code as retrieved from the KB * * private object Add ... and this line // return (Convert.ToDecimal(a) + Convert.ToDecimal(b)); * * * private bool ColumnCompare .. and this line // bool returnValue = (Convert.ToString(a) == Convert.ToString(b)); return returnValue; * * * and 1 enhancement in the InsertGroupByInto method * * case "last": if (GroupBy.Length > 0) { //they specified a non aggr column .. but since there was no GroupBy, it won't reflect accurate data, thus only set it when there is a valid GroupBY DestRow[Field.FieldAlias]=SourceRow[Field.FieldName]; } * * */ "Sanjib Biswas" <sanjib.bis***@ieee.org> wrote in message I am looking for XML merging for the following scenarios. I want to loadnews:Ok48TiTmGHA.3736@TK2MSFTNGP05.phx.gbl... Hi All, both the input files and show in the tree viewer and highlight the differences. Now its up to the user to select the correct node. Any non conflicting differences should be automatically merge onto the merge document. Any suggestion/caveats on how to do this in VB.Net? Regards Sanjib doc1.xml |doc2.xml ======== |======== <data> |<data> <product> | <product> <title>MS Access</title> | <title>MS Access Suite</title> <price>350.00</price> | <price>350.00</price> </product> | </product> <product> | <product> <title>MS Outlook</title> | <title>MS Outlook</title> <price>300.00</price> | <price>250.00</price> </product> | </product> <product> | <product> <title>MS Office</title> | <title>MS Office</title> <price>450.00</price> | <price>450.00</price> </product> | </product> </data> | <product> | <title>MS Visual .Net</title> merge.xml| <price>310.00</price> | </product> |</data> ========= <data> <product> <title>select the title name based on the decision</title> <price>350.00</price> </product> <product> <title>MS Outlook</title> <price>select the price based on the decision</price> </product> <product> <title>MS Office</title> <price>450.00</price> </product> <product> <title>MS Visual .Net</title> <price>310.00</price> </product> </data> I've built most of those structures for a database project of mine that
outputs into a color coded tree control (I used c#). There are one or two articles on MSDN about loading an XML file into a tree control using recursion. There's probably a couple of ways to do it: 1. Merge the XML and then load. 2. Load doc1, then load the elements of doc2.xml Either way, you would end up checking at the node level for a match to product. You can do some cool stuff with right clicks on tree nodes (another article). I use them for opening up data driven menus. You could do something like having the alterative price (where there are two) be selectable with a right click on a green colored node. Then the tree would refresh and the old price would be the alternative. Sanjib Biswas wrote: Show quote > Hi All, > > I am looking for XML merging for the following scenarios. I want to > load both the input files and show in the tree viewer and highlight the > differences. Now its up to the user to select the correct node. Any non > conflicting differences should be automatically merge onto the merge > document. Any suggestion/caveats on how to do this in VB.Net? > > Regards > Sanjib > > doc1.xml |doc2.xml > ======== |======== > <data> |<data> > <product> | <product> > <title>MS Access</title> | <title>MS Access Suite</title> > <price>350.00</price> | <price>350.00</price> > </product> | </product> > <product> | <product> > <title>MS Outlook</title> | <title>MS Outlook</title> > <price>300.00</price> | <price>250.00</price> > </product> | </product> > <product> | <product> > <title>MS Office</title> | <title>MS Office</title> > <price>450.00</price> | <price>450.00</price> > </product> | </product> > </data> | <product> > | <title>MS Visual .Net</title> > | <price>310.00</price> > | </product> > |</data> > > merge.xml > ========= > <data> > <product> > <title>select the title name based on the decision</title> > <price>350.00</price> > </product> > <product> > <title>MS Outlook</title> > <price>select the price based on the decision</price> > </product> > <product> > <title>MS Office</title> > <price>450.00</price> > </product> > <product> > <title>MS Visual .Net</title> > <price>310.00</price> > </product> > </data> Hi John,
Thanks for the suggestions. I was trying to load the XML file in the TreeView. But I am getting an exception "Object reference no set" when parsing a node (red font) in the below XML file. <?xml version="1.0" encoding="UTF-8"?> <Data> <xs:schema id="Data" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xs:element name="Data" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msdata:Prefix="mdb"> <xs:complexType> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element name="Employee"> <xs:complexType> <xs:sequence> <xs:element name="empName" minOccurs="0"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:maxLength value="50"/> </xs:restriction> </xs:simpleType> </xs:element> ....... ....... But with the same code, I am able to load the XML file into TreeView. Show quote "John Bailo" <jaba***@texeme.com> wrote in message news:J_6dnfK7U-hU1D3ZnZ2dnUVZ_oadnZ2d@speakeasy.net... > > I've built most of those structures for a database project of mine that > outputs into a color coded tree control (I used c#). > > There are one or two articles on MSDN about loading an XML file into a > tree control using recursion. > > There's probably a couple of ways to do it: > > 1. Merge the XML and then load. > 2. Load doc1, then load the elements of doc2.xml > > Either way, you would end up checking at the node level for a match to > product. > > You can do some cool stuff with right clicks on tree nodes (another > article). I use them for opening up data driven menus. > > You could do something like having the alterative price (where there are > two) be selectable with a right click on a green colored node. Then > the tree would refresh and the old price would be the alternative. > > Sanjib Biswas wrote: >> Hi All, >> >> I am looking for XML merging for the following scenarios. I want to >> load both the input files and show in the tree viewer and highlight the >> differences. Now its up to the user to select the correct node. Any non >> conflicting differences should be automatically merge onto the merge >> document. Any suggestion/caveats on how to do this in VB.Net? >> >> Regards >> Sanjib >> >> doc1.xml |doc2.xml >> ======== |======== >> <data> |<data> >> <product> | <product> >> <title>MS Access</title> | <title>MS Access Suite</title> >> <price>350.00</price> | <price>350.00</price> >> </product> | </product> >> <product> | <product> >> <title>MS Outlook</title> | <title>MS Outlook</title> >> <price>300.00</price> | <price>250.00</price> >> </product> | </product> >> <product> | <product> >> <title>MS Office</title> | <title>MS Office</title> >> <price>450.00</price> | <price>450.00</price> >> </product> | </product> >> </data> | <product> >> | <title>MS Visual ..Net</title> >> | <price>310.00</price> >> | </product> >> |</data> >> >> merge.xml >> ========= >> <data> >> <product> >> <title>select the title name based on the decision</title> >> <price>350.00</price> >> </product> >> <product> >> <title>MS Outlook</title> >> <price>select the price based on the decision</price> >> </product> >> <product> >> <title>MS Office</title> >> <price>450.00</price> >> </product> >> <product> >> <title>MS Visual .Net</title> >> <price>310.00</price> >> </product> >> </data> |
|||||||||||||||||||||||