Page 1 of 1
skip same line with Saxon
Posted: Thu Jul 21, 2005 3:50 pm
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
Posted: Thu Jul 21, 2005 5:29 pm
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.
Posted: Fri Jul 22, 2005 4:21 pm
how can i remove that line before the trasformation? I can' do it manually, i need to do it with same command...
Posted: Fri Jul 22, 2005 4:43 pm
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.