Извлечь частичные данные из одного XML-файла в другой XML-файл

У меня есть 2 файла XML, хранящихся в моей системе. Я хочу, чтобы некоторые данные XML из одного файла во втором XML. Может кто-нибудь, пожалуйста, помогите на том же? Я взял некоторую помощь от w3schools и попытался использовать Xpointer, ниже приведены xmls.первый xml: имя xml-файла: refXml.xml

`<?xml version="1.0" encoding="UTF-8"?>`


     <dogbreeds>
        <dog breed="Rottweiler" id="Rottweiler">
        <history>
    The Rottweiler's ancestors were probably Roman drover dogs.....
    </history>
    <temperament>
    Confident, bold, alert and imposing, the Rottweiler is a popular choice for its ability to protect....
    </temperament>
    </dog>
    <dog breed="FCRetriever" id="FCRetriever">

    <history>
    One of the earliest uses of retrieving dogs was to help fishermen retrieve fish from the water....
    </history>
    <temperament>
    The flat-coated retriever is a sweet, exuberant, lively dog that loves to play and retrieve....
    </temperament>
    </dog>
    </dogbreeds>

Второй XML: имя XML-файла: targetXml.xml `

 <?xml version="1.0" encoding="ISO-8859-1"?>`


     <mydogs xmlns:xlink="http://www.w3.org/1999/xlink">
        <mydog xlink:type="simple"
          xlink:href="C:\refXml.xml#Rottweiler">
          <description>
          Anton is my favorite dog. He has won a lot of.....
          </description>
        </mydog>
        <mydog xlink:type="simple"
          xlink:href="C:\refXml.xml#FCRetriever">
          <description >
          Pluto is the sweetest dog on earth......
          </description>
        </mydog>
        </mydogs>

0 ответов

Другие вопросы по тегам