Web Analytics Made Easy -
StatCounter Parsing XML with PHP - CodingForum


No announcement yet.

Parsing XML with PHP

  • Filter
  • Time
  • Show
Clear All
new posts

  • Parsing XML with PHP

    Ok, I have an interesting page that shouldnt be all that hard to parse, but I don't really understand how this works. I have an xml page that contains an article about something. the root object is called <article> and then it has <page>'s and <sections>.
    Those shouldn't be the hard ones, the hard one seems like it will be this...
    I have a <table> element that works almost exactly like the <table> in html, but mine has to be able to do some certain things. One of them is that it has a highlight attribute that if it is set to 1 then cells will be highlighted when you mouseover them. My problem is that with an event based parser, how will you know if the <table> had hightlight set to 1?
    Here is an example:
    <table hightlight="1" title="Data values">
    Also, my sections and stuff have numbers in them, so this table might be 0.0.0 if it was the first table in the first section on the first page, or 0.1.0 if it was the first table in the second section of the first page. How could I get it to remember what numbers I am on? especialy if tables are nested?

    Thanks a lot.

  • #2
    Unless you're targeting Netscape 4.x, you may not need PHP.

    For the highlighting, CSS should work fine. The selector is, I think,


    For the numbering you probably need a little XSLT. I'm tinkering with that myself, but not solidly enough to help you
    Last edited by Alex Vincent; Jul 4, 2002, 12:37 AM.
    "The first step to confirming there is a bug in someone else's work is confirming there are no bugs in your own."
    June 30, 2001
    author, ES-Membrane project (Github Pages site)
    author, Verbosio prototype XML Editor
    author, JavaScript Developer's Dictionary


    • #3
      The numbering issue is not my idea of fun. You could experiment with some:

      table:before {
      content: counter()
      stuff... but I don't think that is advanced enough to handle your particular numbering layout.

      As for highlight="1" and hovering:

      table[highlight = "1"]:hover {
      background: blue;
      color: white;

      If you were to post your XML doc, some of us may be willing to help with an appropriate XSLT document. But it seems you want to parse it (and display it) through other means?


      • #4
        Without PHP???

        A lot of people now have told me that I don't nessicarily have to do it with PHP. I should probably look into that because I don't really need to support older browsers. Thanks a lot for the suggestions. I appreciate it.