ID: 22903
User updated by: spoerri at duke dot edu
Reported By: spoerri at duke dot edu
-Status: Feedback
+Status: Open
Bug Type: XML related
Operating System: linux
PHP Version: 4.3.1
New Comment:
I'm sending you here only code snippets, in case you need
the rest of the code let me know. Note: the code is
embedded in the code for an object.
** here's the code used to setup the parser: ***
$this->xml_parser=xml_parser_create($this->encode_type);
xml_set_object($this->xml_parser,&$this);
xml_set_element_handler($this->xml_parser,"startElement","endElement");
xml_set_character_data_handler($this->xml_parser,"cdata");
$this->depth=0;
$this->parent=array();
$this->pobject=array();
$this->$IMSError=array();
xml_parse($this->xml_parser,$XMLText);
xml_parser_free($this->xml_parser);
** here's the code I use to parse the 'LAYERINFO' tag: **
case 'LAYERINFO':
//parent tag is always RESPONSE
$l = new arcLayer($attrs['ID'],
$attrs['TYPE'],
($attrs['NAME']?$attrs['NAME']:''),($attrs['MINSCALE']?$attrs['MINSCALE']:0),($attrs['MAXSCALE']?$attrs['MAXSCALE']:0),
(strtolower($attrs['VISIBLE'])=='true'?1:0), 1);
if ($this->returnLayer($l->Name,$index)) {
if ($this->Layers[$index]->Service) {
$this->Layers[$index]=$l;
$this->CurrentLayer=&$this->Layers[$index];
}
}else{
$this->Layers[]=$l;
$this->CurrentLayer=&$this->Layers[count($this->Layers)-1];
}
break;
Previous Comments:
------------------------------------------------------------------------
[2003-03-26 09:23:48] [EMAIL PROTECTED]
What is your XML parsing code?
------------------------------------------------------------------------
[2003-03-26 09:13:27] spoerri at duke dot edu
Hi,
while parsing an XML response (using expat) from a 3rd party
server. The parsing works fine, with the exception for one
tag for which the info for an attribute is droped (empty). The
thing is that the tag occur more than once and is parsed
correctly the other times.
I also tried to print the attributes for each of those tags, but
php seems crash (seg. fault error in apache log) after the
second occurance of the LAYINFO tag (this is also the tag
which loses the ID attribut value).
When I switched back to php 4.2.3, the parsing works fine
again.
Thanks for your help,
Christoph
**** sample XML file (partial file only) *****
<LAYERINFO type="image" name="ocean1prj2.tif"
visible="true" id="12">
<ENVELOPE minx="-178.183334350586"
miny="-72.0226440429688" maxx="180.016647338867"
maxy="71.9773483276367" />
</LAYERINFO>
<LAYERINFO type="featureclass" visible="true"
name="world_usa_canada" id="14">
<FCLASS type="polygon">
<ENVELOPE minx="-180" miny="-90" maxx="180"
maxy="83.6235961914062" />
</FCLASS>
<SIMPLERENDERER>
<SIMPLEPOLYGONSYMBOL fillcolor="99,172,99"
filltransparency="1" boundarycolor="51,102,51"
boundarytransparency="1" boundarycaptype="round" />
</SIMPLERENDERER>
</LAYERINFO>
<LAYERINFO type="featureclass" visible="true" name="latlong"
id="13">
<FCLASS type="line">
<ENVELOPE minx="-180" miny="-90" maxx="180" maxy="90"
/>
</FCLASS>
<SIMPLERENDERER>
<SIMPLELINESYMBOL color="192,192,192" width="1"
captype="round" />
</SIMPLERENDERER>
</LAYERINFO>
*********************
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=22903&edit=1