moleary has asked for the wisdom of the Perl Monks concerning the following question:
I wrote this code example from memory, so I hope I didn't add any syntax errors. I would like to use an XML parser that parses each of the nested XML files when it encounters the entity references for them. So far, I have been using XML::Parser, and it does call the ExternEnt handler function when it gets to an entity like &file1;, but it doesn't open the file, and I don't know what to do to get it to parse those nested files within the scope of the dtd file, so that entity references, etc., within those nested files are interpreted correctly. I assume I can't invoke the parser recursively from within the ExternEnt handler function, and the parser settings that I played around with to try to get different behavior (NoExpand, ParseParamEnt) did not seem to make a difference in how these entity references were dealt with. Does anyone have any suggestions?<!DOCTYPE allfiles SYSTEM "allfiles.dtd" [<!ELEMENT file1 SYSTEM "file1.xml"> <!ELEMENT file2 SYSTEM "file2.xml"> ....]> <alldata> &file1; &file2; .... </alldata>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Parsing nested XML files
by iburrell (Chaplain) on Jun 23, 2004 at 16:11 UTC |