How to tell where in an xml object i am

Asselpexags

New Member
I'm working with sax in PHP because the xml file that I am parsing to update a database with is around 150MB.I'm having trouble understanding how to tell where in an xml object I am using sax. for instance the xml looks something like this:\[code\]<listing> <home> <address>123 main st.</address> </home> <brokerage> <address>555 N. high st.</address> </brokerage></listing>\[/code\]Using sax, I know when the listing tag starts, and the home tag, and then the address tag and such, but then control is passed to the function i set with xml_set_character_data_handler and i can get the address.My problem is in knowing whether I'm reading home -> address or brokerage -> address.There are multiple fields in this xml file that share the same tag name, and are used multiple times under different parent tags (firstName, lastName, phone, email, etc. as children under listingAgent, propertyContact, etc.).I've been googling around, but the only sax examples I'm finding show how to echo the data, and not how to make decisions based on the data in the xml file. Is there a function that I'm not aware of, or do I have to write my own function to determine which parent elements a child belongs to?
 
Back
Top