You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by ha...@informatiefabriek.nl on 2002/04/16 09:43:04 UTC
How to skip elements
Hi all,
I would like to parse a message, but leave some elements untouched:
This is my XML:
<?xml version="1.0" encoding="UTF-8"?>
<MESSAGE TYPE="start" VERSION="0.1">
<HEADER>
<SENDER>jobcontroller</SENDER>
<RECEIVER>[1006513692672]</RECEIVER>
</HEADER>
<BODY>
<FROM>harm@informatiefabriek.nl</FROM>
<TO>harm@informatiefabriek.nl</TO>
<SUBJECT>Simple mail example</SUBJECT>
<MESSAGE-BODY>
This is a simple e-mail message,
Greetings, from Holland!
</MESSAGE-BODY>
</BODY>
</MESSAGE>
I'm parsing this using the SAX parser. I would like to end up with a
dataobject like this:
myDataObject.sender = "jobcontroller"
myDataObject.receiver = "[1006513692672]"
myDataObject.body =
"<FROM>harm@informatiefabriek.nl</FROM><TO>harm@informatiefabriek.nl</TO><SUBJECT>Simple
mail example</SUBJECT><MESSAGE-BODY>This is a simple e-mail
message,Greetings, from Holland!</MESSAGE-BODY>"
So I don't want to parse the elements inside the <body> tag. I just want
to take the literal string inside <body> tags, including the xml-tag that
occur inside the <body> tag.
Is there some way to accomplish this?
Many Thanks,
Harm de Laat
Informatiefabriek
The Netherlands