An XML element can be what's called "mixed content". Traditionally we think
of XML element being one of two things:
1) Exists to hold data <xmltag>mydata</xmltag>
2) Exists to be a parent to other elements <xmltag><child></child></xmltag>
The third way to think of them is by way of what's called "mixed content"
meaning that a tag acts as both #1 and #2 above:
<xmltag>mydata<child></child></xmltag>
In my work with XML I don't think I EVER see mixed content used except for
cheesy examples showing how you *might* use it. In the end I think mixed
content causes more heartache/problems than anything because a lot of XML
isn't formatted in a flat stream as I showed above, but is instead formatted
as such:
<xmltag>
<child></child>
<xmltag>
When all the XML is in a flat line (i.e. no carriage return line feeds) then
you can expect to have a single 'element content' event. When XML is
formatted on multiple lines (i.e. one element per line with a carriage
return line feed after each) then you will get many more 'element content'
events when parsing for all parent tags. The above for instance will
generate a 'element content' event for <xmltag> in regards to the carriage
return line feed plus preceding spaces to <child> element. Then another
<xmltag> 'element content' event will be triggered for the carriage return
line feed after the </child> element closure.
HTH,
Aaron Bartell
http://mowyourlawn.com
-----Original Message-----
From: rpg400-l-bounces+albartell=gmail.com@xxxxxxxxxxxx
[
mailto:rpg400-l-bounces+albartell=gmail.com@xxxxxxxxxxxx] On Behalf Of
Knezevic, Mihael
Sent: Wednesday, April 11, 2007 6:30 AM
To: RPG programming on the AS400 / iSeries
Subject: XML-SAX and ignore whitespace
hi,
i'm currently playing around with xml-sax. i got a xml file and it is read
with xml-sax with no errors. but for the whitespaces like newlines and tabs
are included the handler procedure is called. with xml-into i can say
"trim=all" but xml-sax won't accept that. is there some other keyword or
workaround? i just don't want to process every newline or tab.
thanx in advance
mihael knezevic
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or
change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.