skip same line with Saxon

Here should go questions about transforming XML with XSLT and FOP.
m4tr1x
Posts: 2
Joined: Thu Jul 21, 2005 3:41 pm

skip same line with Saxon

Post by m4tr1x »

I need to skip the first line of my XML because when saxon reed that line don't work well. the line that i need to skip is:

<!DOCTYPE WebML SYSTEM "MyDtd.dtd">

I'd like to know if there is same command that i can use from the command line to say saxon that when there is that line, will be jumped to the next one

Thanks

Marco
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi,

There is no such command, any conformat XML processor that will read the XML file will try to look into that DTD. Possible solutions depend on what your problem is exactly. If you have the DTD but it is a different location then the solution is to set an entity resolver. If you really want that removed then you have to preprocess the file and remove that before feading it into the transformation.

Best Regards,
George
m4tr1x
Posts: 2
Joined: Thu Jul 21, 2005 3:41 pm

Post by m4tr1x »

Hi,
how can i remove that line before the trasformation? I can' do it manually, i need to do it with same command...

thanks

Marco
Radu
Posts: 9018
Joined: Fri Jul 09, 2004 5:18 pm

Post by Radu »

Hi,

You could make an empty file called "MyDtd.dtd" and place it in the same directory with your xml file. The processor only checks if the dtd file is valid and does not try to validate the xml file in accordance to the dtd file so the transformation will succeed.

If this is not acceptable you can apply a regular expression search on the XML document with the expression "<!DOCTYPE(.*?)SYSTEM\s"(.*?)">" and replace it with the empty string or just make an application that deletes the first line from a file if you are sure the doctype will always be on the first line.

Hope this helps.
Regards, Radu.
Post Reply