Help with importing data from LinkFileA to LinkFileB

vcharles
vcharles used Ask the Experts™
on
Hi,

If My LinkFileA.xml contains multiple tables and data elements and LinkFileB.xml  contains the same tables with additional data elements but no data. How do I import data from LinkFileA to LinkFileB where the data elements in LinkFileA matches the data elements in LinkFileB?

Thanks,

Victor
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
HI Please refer the MSDN article for Merging the xml Files

http://msdn.microsoft.com/en-us/magazine/cc164169.aspx
Fernando SotoRetired
Distinguished Expert 2017

Commented:
Hi Victor;

Can you give an example of what your input would be and the needed output.

Author

Commented:
Hi Fernando,

I meant for example if LinkFileOld.xml contains

<Root>
  <Row>
    <Link_ID>1</Link_ID>
    <Column1>2</Column1>
    <Column2>3</Column2>
    <Column3>4</Column3>
    <Column4>6</Column4>
  </Row>
  <Row1>
    <Link_ID>1</Link_ID>
    <Column1>33</Column1>
  </Row1>
<Row2>
    <Link_ID>1</Link_ID>
    <Column1>33RR</Column1>
  </Row2>
</Root>

and LinkFileNew.ml contains



<Root>
  <Row>
    <Link_ID></Link_ID>
    <Column1></Column1>
    <Column2></Column2>
  </Row>
  <Row1>
    <Link_ID></Link_ID>
    <Column1></Column1>
     <Column2></Column2>
  </Row1>
<Row3>
    <Link_ID></Link_ID>
    <Column1></Column1>
  </Row3>
</Root>

How do I enter the contents from to old file to the new file for the same table (Row, Row1)and data elements?

New LinkFileNew:

<Root>
  <Row>
    <Link_ID>1</Link_ID>
    <Column1>2</Column1>
    <Column2>3</Column2>
  </Row>
  <Row1>
    <Link_ID>1</Link_ID>
    <Column1>33</Column1>
   <Column2></Column2>
  </Row1>
<Row3>
    <Link_ID></Link_ID>
    <Column1></Column1>
  </Row3>
</Root>

Thanks,

Victor
Become a Certified Penetration Testing Engineer

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Fernando SotoRetired
Distinguished Expert 2017

Commented:
Hi Victor;

In previous post you identified a unique table by the XML node <rowX> where x is some number and the <Link_ID>.  But in this case you state you have in LinkFileB you may be missing the value for Link_ID so there would not be a way to match them to nodes in LinkFileA and combined the two.

Author

Commented:
Hi,

I'm trying to import the file in LinkFileNew but for each record I add from LinkFileOLd I also need to keep the data elements in LinkFileNew that are not in LinkFileOld, Link_ID will also be included in LinkFileNew.

As show below, I included the data from LinkFileOld and kept the data elements in LibkFileNew.

<Root>
  <Row>
    <Link_ID>1</Link_ID>
    <Column1>2</Column1>
    <Column2>3</Column2>
  </Row>
  <Row1>
    <Link_ID>1</Link_ID>
    <Column1>33</Column1>
   <Column2></Column2>
  </Row1>
<Row3>
    <Link_ID></Link_ID>
    <Column1></Column1>
  </Row3>
</Root>

Thanks,

V.

Author

Commented:
Hi,

I'm trying to import existing data from an old xml file to a new xml file which contains additional data elements or data elements that don't exist in the old xml file.

Victor
Fernando SotoRetired
Distinguished Expert 2017

Commented:
Hi Victor;

This is not making much sense to me. Please make a post that shows the two files which you are trying to combine. Then show a XML that shows what the combined XML file looks like.

Author

Commented:
OK, will do.

Thanks.

V.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial