XML parser problem

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
rsmarsha
Forum Contributor
Posts: 242
Joined: Tue Feb 08, 2005 4:06 am
Location: Leeds, England

XML parser problem

Post by rsmarsha »

I'm using XMLParser from http://www.criticaldevelopment.net/xml/doc.php as we have yet to move to php5 at work. We will be doing before long and the parser i'm using will still work by including the php 5 class instead.

The php 4version of the parser is working fine for most files. I am however having problems with one specific XML file, an example is below.

Code: Select all

 
<?xml version="1.0"?>
<!DOCTYPE files.index SYSTEM "http://data.icecat.biz/dtd/files.index.dtd">
<ICECAT-interface>
    <files.index Generated="20080122053724">
        <file path="/www/export/freexml.int/EN/10.xml" Product_ID="10" Updated="20071213191927" Quality="ICECAT" Supplier_id="1" Prod_ID="C8934A#A2L" Catid="234"/>
        <file path="/www/export/freexml.int/EN/1286.xml" Product_ID="1286" Updated="20071226131926" Quality="SUPPLIER" Supplier_id="1" Prod_ID="D9190B" Catid="156"/>
        <file path="/www/export/freexml.int/EN/1287.xml" Product_ID="1287" Updated="20071226131926" Quality="SUPPLIER" Supplier_id="1" Prod_ID="D9192B" Catid="156"/>
        <file path="/www/export/freexml.int/EN/1318.xml" Product_ID="1318" Updated="20071213191927" Quality="SUPPLIER" Supplier_id="1" Prod_ID="C6455C" Catid="234"/>
        <file path="/www/export/freexml.int/EN/1319.xml" Product_ID="1319" Updated="20071213191927" Quality="SUPPLIER" Supplier_id="1" Prod_ID="C2693A" Catid="234">
            <M_Prod_ID>C2693A</M_Prod_ID>
        </file>
    </files.index>
</ICECAT-interface>
 
The above code is an example section of the full file. The problem is the tag:

Code: Select all

<files.index Generated="20080122053724">
The "." in the tag name is breaking the parser, which uses an object method of accessing the tags.

I was wondering, as the parser mimics simpleXML's object format, if anyone else has had similar problems with tags like the one above?
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: XML parser problem

Post by Christopher »

How is it "breaking"? It probably has a character set check that does not allow '.' in tag names. Check the code and modify it to all '.'.
(#10850)
Post Reply