You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Elliotte Rusty Harold (Jira)" <xe...@xml.apache.org> on 2025/06/27 11:41:00 UTC
[jira] [Updated] (XERCESJ-150) Processing instruction cannot precede doctype
[ https://issues.apache.org/jira/browse/XERCESJ-150?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Elliotte Rusty Harold updated XERCESJ-150:
------------------------------------------
Description:
Given:
{noformat}
public static void main(String []args) throws SAXException{
XMLSerializer serializer = new XMLSerializer();
serializer.setOutputByteStream(System.out);
serializer.startDocument();
serializer.processingInstruction("foo", "bar");
serializer.startDTD("foo", "bar", "baz");
serializer.startElement("foo", "bar", "bar", null);
serializer.endElement("foo", "bar", "bar");
serializer.endDocument();
}
{noformat}
Xerces goes to a great deal of effort to make the processing instruction appear
AFTER the doctype (serializePreRoot etc.). But why is this so? It is perfectly
legal in XML for a processing instruction to proceed the doctype!
was:
Given:
public static void main(String []args) throws SAXException{
XMLSerializer serializer = new XMLSerializer();
serializer.setOutputByteStream(System.out);
serializer.startDocument();
serializer.processingInstruction("foo", "bar");
serializer.startDTD("foo", "bar", "baz");
serializer.startElement("foo", "bar", "bar", null);
serializer.endElement("foo", "bar", "bar");
serializer.endDocument();
}
Xerces goes to a great deal of effort to make the processing instruction appear
AFTER the doctype (serializePreRoot etc.). But why is this so? It is perfectly
legal in XML for a processing instruction to proceed the doctype!
> Processing instruction cannot precede doctype
> ---------------------------------------------
>
> Key: XERCESJ-150
> URL: https://issues.apache.org/jira/browse/XERCESJ-150
> Project: Xerces2-J
> Issue Type: Bug
> Components: Serialization
> Affects Versions: 2.0.0
> Environment: Operating System: Other
> Platform: Other
> Reporter: Paul Prescod
>
> Given:
> {noformat}
> public static void main(String []args) throws SAXException{
> XMLSerializer serializer = new XMLSerializer();
> serializer.setOutputByteStream(System.out);
> serializer.startDocument();
> serializer.processingInstruction("foo", "bar");
> serializer.startDTD("foo", "bar", "baz");
> serializer.startElement("foo", "bar", "bar", null);
> serializer.endElement("foo", "bar", "bar");
> serializer.endDocument();
> }
> {noformat}
> Xerces goes to a great deal of effort to make the processing instruction appear
> AFTER the doctype (serializePreRoot etc.). But why is this so? It is perfectly
> legal in XML for a processing instruction to proceed the doctype!
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org