Hi all,
I've got xml files that each have 500 entries marked as <article> ....
</article> .in each entry there are fields <author></author>. Some articles
have non author fields and some have more than one. What I want to do is every
article to have only one such field, e.g. if an article has 3 <author>..
</author> fields the two last must be dropped, if an article has none an empty
one <author> </author> must be added. How can i do this but in every 500
articles that are included in the same xml file? (I use VI, not gvim)
Here follows some sample entries:
<article>
<AuthorList CompleteYN="Y">
<Author ValidYN="Y">
<LastName>Heinisch</LastName>
<ForeName>Roberto H</ForeName>
<Initials>RH</Initials>
</Author>
<Author ValidYN="Y">
<LastName>Zanetti</LastName>
<ForeName>Carlos R</ForeName>
<Initials>CR</Initials>
</Author>
<Author ValidYN="Y">
<LastName>Comin</LastName>
<ForeName>Fabiano</ForeName>
<Initials>F</Initials>
</Author>
<Author ValidYN="Y">
<LastName>Fernandes</LastName>
<ForeName>Juliano L</ForeName>
<Initials>JL</Initials>
</Author>
<Author ValidYN="Y">
<LastName>Ramires</LastName>
<ForeName>José A</ForeName>
<Initials>JA</Initials>
</Author>
<Author ValidYN="Y">
<LastName>Serrano</LastName>
<ForeName>Carlos V</ForeName>
<Initials>CV</Initials>
<Suffix>Jr</Suffix>
</Author>
</AuthorList>
</article>
<article>
</article>
<article>
<AuthorList CompleteYN="Y">
<Author ValidYN="Y">
<LastName>Saint-Remy</LastName>
<ForeName>Annie</ForeName>
<Initials>A</Initials>
</Author>
</AuthorList>
</article>
The above sample should be turned into this:
<article>
<AuthorList CompleteYN="Y">
<Author ValidYN="Y">
<LastName>Heinisch</LastName>
<ForeName>Roberto H</ForeName>
<Initials>RH</Initials>
</Author>
</AuthorList>
</article>
<article>
<AuthorList CompleteYN="Y">
<Author ValidYN="Y">
</Author>
</AuthorList>
</article>
<article>
<AuthorList CompleteYN="Y">
<Author ValidYN="Y">
<LastName>Saint-Remy</LastName>
<ForeName>Annie</ForeName>
<Initials>A</Initials>
</Author>
</AuthorList>
</article>
Thanks in advance,
Nikos