I forgot about that pesky PI.
So on DOS you can first pipe it through FIND.
Put your doctype text (this time including the initial <?xml?> pi)
in a file called, say, doctype.txt then make a batch file like this:
type doctype.txt > file.xml
sx ... | find /V /I "<?xml" >> file.txt
the find filter won't print lines containing <?xml
And something similar on UNIX. I tested this and it works.
For something less kludgy (or perhaps MORE kludgy), edit
the XmlOutputEventHandler.cxx source file for SX, then make
a minor edit in the XmlOutputEventHandler::XmlOutputEventHandler
function, changing:
{
os_->setEscaper(escape);
*os_ << "<?xml version=\"1.0\"";
if (encodingName.size())
*os_ << " encoding=\"" << encodingName << '"';
*os_ << "?>" << RE;
}
to something like:
{
os_->setEscaper(escape);
*os_ << "<?xml version=\"1.0\"";
if (encodingName.size())
*os_ << " encoding=\"" << encodingName << '"';
*os_ << "?>" << RE;
*os_ << "<!DOCTYPE EAD PUBLIC \"-// ... etc." << RE;
}
and recompile for an EAD custom solution. But be careful
for some of the -xml options, like notation which will mess
things up.
Alvin
At 01:46 PM 08/02/2000 -0500, Fox, Michael wrote:
>Won't this insert the DOCTYPE declaration before the XML declaration which
>SX does supply? If so, you would end up with the following result where the
>first two statements in the document are in reverse of the correct order.
>
><!DOCTYPE ead PUBLIC "-//Society of American Archivists//DTD ead.dtd
>(Encoded Archival Description (EAD) Version 1.0)//EN" "ead.dtd">
><?xml version="1.0"?>
><ead>......
>
>
>If so, wouldn't you'd still have to edit the file anyway although it would
>be a simple cut and paste action.
>
>Actually the following would be another option.
>
>> echo "<?xml version="1.0"?><!DOCTYPE ..." > file.xml
>> SX ... >> file.xml
>>
>I think that SP would then produce the following-
>
><?xml version="1.0"?>
><!DOCTYPE ead PUBLIC "-//Society of American Archivists//DTD ead.dtd
>(Encoded Archival Description (EAD) Version 1.0)//EN" "ead.dtd">
><?xml version="1.0"?>
><ead>......
>
>At least one parser I tried this with treats the second XML declaration as a
>simple XML processing instruction, i.e., it ignores it. Perhaps there
>might be some future unexpected side-effects from doing this but it seems a
>possible solution to Dale's problem. Thanks Alvin.
>
>Michael
>
>Michael J. Fox
>Acting Assistant Director for Library and Archives
>Minnesota Historical Society
>345 Kellogg Blvd West
>St. Paul, MN 55102-2409
>651-296-2150 (phone)
>651-296-9961 (fax)
>[log in to unmask]
>
>> ----------
>> From: Alvin Pollock[SMTP:[log in to unmask]]
>> Sent: Wednesday, August 02, 2000 12:58 PM
>> To: [log in to unmask]
>> Subject: Re: SP related question
>>
>> If you're using a batch file on Windows or a script on
>> UNIX to run SX, it might be easiest just to precede the
>> invocation of SX with some kind of echo command, e.g.,
>>
>> echo "<!DOCTYPE ..." > file.xml
>> SX ... >> file.xml
>>
>> Alvin
>>
>> At 12:28 PM 08/02/2000 -0500, Fox, Michael wrote:
>> >I have not been able to find a solution to this problem. Instructions in
>> >the EAD Cookbook for the use of SX (part of the SP package) suggest
>> manually
>> >adding the DOCTYPE declaration post conversion. SP clearly parses the
>> SGML
>> >source document but seems to output only well-formed XML. A curious
>> >approach.
>> >
>> >Michael
>> >
>> >Michael J. Fox
>> >Acting Assistant Director for Library and Archives
>> >Minnesota Historical Society
>> >345 Kellogg Blvd West
>> >St. Paul, MN 55102-2409
>> >651-296-2150 (phone)
>> >651-296-9961 (fax)
>> >[log in to unmask]
>> >
>> >> ----------
>> >> From: Dale Patterson[SMTP:[log in to unmask]]
>> >> Sent: Wednesday, August 02, 2000 11:33 AM
>> >> To: [log in to unmask]
>> >> Subject: SP related question
>> >>
>> >> I've been experimenting with SP to convert our sgml EAD instances to
>> xml.
>> >> I find that SP strips out the EAD DOCTYPE declaration at the beginning
>> of
>> >> the instance. I am running the 1.3.4 Windows version of SP. I can't
>> seem
>> >> to find a switch to keep this in. Am I missing something here? Thanks
>> for
>> >> any assistance.
>> >>
>> >> L. Dale Patterson [log in to unmask]
>> >> Archivist 973-408-3195
>> >> United Methodist Church Archives http://www.gcah.org
>> >> Madison, NJ 07940
>> >>
>> >
>> >
>>
>
>
|