Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jun 2002
    Posts
    72
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question 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">
    <row><header>name</header><header>number</header></row>
    <row><data>Me</data><data>3</data>
    ...
    </table>
    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.
    ~evlich

  • #2
    Moderator
    Join Date
    May 2002
    Location
    Hayward, CA
    Posts
    1,453
    Thanks
    1
    Thanked 21 Times in 19 Posts
    Unless you're targeting Netscape 4.x, you may not need PHP.

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

    table[highlighter="1"]

    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; 07-04-2002 at 05: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, Verbosio prototype XML Editor
    author, JavaScript Developer's Dictionary
    https://alexvincent.us/blog

  • #3
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    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
    New Coder
    Join Date
    Jun 2002
    Posts
    72
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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.
    ~evlich


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •