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 Mikael St�ldal <d9...@d.kth.se> on 2000/08/24 23:08:28 UTC
Problem with SAX serialization: processing instruction
The XML serializer in Xerces doesn't serialize processing instructions
properly. The following program demonstrate the problem:
import java.io.*;
import org.apache.xml.serialize.*;
import org.xml.sax.*;
import org.xml.sax.helpers.*;
public class PIerror
{
public static void main(String[] args) throws Exception
{
OutputFormat of = new OutputFormat();
XMLSerializer serial =
new XMLSerializer(System.out, of);
DocumentHandler dh = serial.asDocumentHandler();
dh.startDocument();
dh.processingInstruction("acme", "foo=\"bar\""); // OK
AttributeListImpl attrs = new AttributeListImpl();
dh.startElement("foo", attrs);
dh.processingInstruction("acme", "foo=\"bar\""); // not OK
dh.characters("foo bar".toCharArray(),0,7);
dh.endElement("foo");
dh.endDocument();
}
}
--
/****************************************************************\
* You have just read a message from Mikael Ståldal. *
* *
* Remove "-ingen-reklam" from the address before mail replying. *
\****************************************************************/
Re: Problem with SAX serialization: processing instruction
Posted by Assaf Arkin <ar...@intalio.com>.
I assume the second one prints <?acme foo="bar">. Is that
right?
arkin
"Mikael Ståldal" wrote:
>
> The XML serializer in Xerces doesn't serialize processing instructions
> properly. The following program demonstrate the problem:
>
> import java.io.*;
>
> import org.apache.xml.serialize.*;
> import org.xml.sax.*;
> import org.xml.sax.helpers.*;
>
> public class PIerror
> {
> public static void main(String[] args) throws Exception
> {
> OutputFormat of = new OutputFormat();
> XMLSerializer serial =
> new XMLSerializer(System.out, of);
>
> DocumentHandler dh = serial.asDocumentHandler();
>
> dh.startDocument();
>
> dh.processingInstruction("acme", "foo=\"bar\""); // OK
>
> AttributeListImpl attrs = new AttributeListImpl();
> dh.startElement("foo", attrs);
> dh.processingInstruction("acme", "foo=\"bar\""); // not OK
> dh.characters("foo bar".toCharArray(),0,7);
> dh.endElement("foo");
>
> dh.endDocument();
> }
> }
>
> --
> /****************************************************************\
> * You have just read a message from Mikael Ståldal. *
> * *
> * Remove "-ingen-reklam" from the address before mail replying. *
> \****************************************************************/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
--
----------------------------------------------------------------------
Assaf Arkin www.intalio.com
CTO, Intalio Inc. www.exolab.org
Re: Problem with SAX serialization: processing instruction
Posted by Assaf Arkin <ar...@intalio.com>.
I assume the second one prints <?acme foo="bar">. Is that
right?
arkin
"Mikael Ståldal" wrote:
>
> The XML serializer in Xerces doesn't serialize processing instructions
> properly. The following program demonstrate the problem:
>
> import java.io.*;
>
> import org.apache.xml.serialize.*;
> import org.xml.sax.*;
> import org.xml.sax.helpers.*;
>
> public class PIerror
> {
> public static void main(String[] args) throws Exception
> {
> OutputFormat of = new OutputFormat();
> XMLSerializer serial =
> new XMLSerializer(System.out, of);
>
> DocumentHandler dh = serial.asDocumentHandler();
>
> dh.startDocument();
>
> dh.processingInstruction("acme", "foo=\"bar\""); // OK
>
> AttributeListImpl attrs = new AttributeListImpl();
> dh.startElement("foo", attrs);
> dh.processingInstruction("acme", "foo=\"bar\""); // not OK
> dh.characters("foo bar".toCharArray(),0,7);
> dh.endElement("foo");
>
> dh.endDocument();
> }
> }
>
> --
> /****************************************************************\
> * You have just read a message from Mikael Ståldal. *
> * *
> * Remove "-ingen-reklam" from the address before mail replying. *
> \****************************************************************/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
--
----------------------------------------------------------------------
Assaf Arkin www.intalio.com
CTO, Intalio Inc. www.exolab.org