Re: [xml] Xml Question



Oh -- if smaller file here is some cheap code that works fine.  You will
have to create a new document for each smaller pieces and then copy the
pieces over like so:

for (cur=fromwrk->cur;cur;cur=cur->next) {   
     tmp = xmlCopyNode(cur,1);                
     xmlAddChild(towrk->cur,tmp);             
 }                                            

From being you original file and cur being your current little file.

E

-----Original Message-----
From: xml [mailto:xml-bounces gnome org] On Behalf Of Eric Eberhard
Sent: Friday, July 05, 2019 12:19 PM
To: 'Liam R E Quin' <liam holoweb net>; 'Ashjan Alsulaimani'
<alsulaia tcd ie>; xml gnome org
Subject: Re: [xml] Xml Question

Dear Ashjan,

If it was me I'd do it the cheap way and not use the parser.  Get the file
and then read through it with your favorite language and look for starting
tags you want moved, then scan until you hit the ending tag, write that out.
Rinse and repeat.  You can use the parser on each piece you write out.

It is surely possible to do it in both ways described and I know of other
that works on small files.  But this is a LOT easier.

Eric

-----Original Message-----
From: xml [mailto:xml-bounces gnome org] On Behalf Of Liam R E Quin
Sent: Thursday, July 04, 2019 6:28 AM
To: Ashjan Alsulaimani <alsulaia tcd ie>; xml gnome org
Subject: Re: [xml] Xml Question

On Thu, 2019-07-04 at 10:33 +0100, Ashjan Alsulaimani wrote:


What's the best way to approach such a task and the most efficient way 
as I'm dealing with Medline database!

If your input files are a few hundred megabytes or less, start with the XSLT
identity transform and add empty templates to match what you want to delete.

If your input is over a gigabyte (say) or you do lots of different subsets
of the same document, you may find XQuery update works better for you, with
a databaase (e.g. BaseX or eXistb).

Liam


--
Liam Quin, https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Upcoming courses: DocBook (sold out); CSS for XML People

_______________________________________________
xml mailing list, project page  http://xmlsoft.org/ xml gnome org
https://mail.gnome.org/mailman/listinfo/xml


_______________________________________________
xml mailing list, project page  http://xmlsoft.org/ xml gnome org
https://mail.gnome.org/mailman/listinfo/xml




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]