|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: XML Problem
Ok well I am using SAX/expat for this particular document. Anyway, I am not sure if you know PHP or not but here is how I would process it: <?PHP function charcterPro($parser, $data) { global $TAG; switch ($currentTag) { case "TAG1": $TAG = $data; break; default: break; } } ?> That will get "SOME TEXT" into the variable tag, but as I stated before it will not work in cases such as example 1. -----Original Message----- From: Thomas B. Passin [mailto:tpassin@c...] Sent: Sunday, June 30, 2002 6:19 PM To: XML DEV Subject: Re: XML Problem [Sebastian A] > I am having some problems parsing XML with PHP. Here is an example of my > problem: > Example 1: > > <PAGE> > <TAG1> > SOME TEXT > </TAG1> > </PAGE> > You do not say how you are trying to process the xml file. Typically programs run into trouble like this because they think that the text will all be delivered in one node (for DOM) or one callback (for SAX). But that would be a poor assumption. The text may actually be delivered in several chunks. In this case, you might get [NEWLINE]SOME TEXT[NEWLINE]. Whether SAX, DOM or some other system, you must always make sure that you collect (or traverse) all pieces that could contain the character data of an element. Cheers, Tom P ----------------------------------------------------------------- The xml-dev list is sponsored by XML.org <http://www.xml.org>, an initiative of OASIS <http://www.oasis-open.org> The list archives are at http://lists.xml.org/archives/xml-dev/ To subscribe or unsubscribe from this list use the subscription manager: <http://lists.xml.org/ob/adm.pl>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Cast Your Vote
We need your help – Vote for DataDirect XML Products!
Winners and finalists announced at SOA World Conference in November. Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||







