Problem using xml_parser w/ PHP 4 - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Problem using xml_parser w/ PHP 4

tvientitvienti Posts: 230Member
Hey everybody,

I've been working on a custom extension to HTML that I can use in my web-development. I'm reading the files using the XML parser but I'm having some trouble. Basically, PHP 4's XML parsing functions don't handle XML if it's not properly formatted. Which in turn means my parser won't accept anything that's not perfect XHTML.

Since I was hoping to make this a relatively user-friendly language and corresponding parser that I could provide to other developers, I'd like it to be able to accomodate things like

[code]
image
[/code]

instead of the XML compliant

[code]
image
[/code]

Does anybody have any suggestions on how I could tackle this without writing all of my own low-level XML parsing functions? Is there a more flexible library available for PHP 4 that can gracefully parse through potentially invalid XML?

Thanks for the feedback,
T

Comments

  • DarQDarQ Posts: 1,625Member
    im glad that your parser complains. you should write proper xhtml, or no
    xhtml at all. standards are not there to be messed up.

    and btw: how much of a problem is it, rewriting it to proper xhtml? if you have little understanding of the rules, then you can either start and learn it at w3schools. or just use the w3c validator that can tell you what inconsitancies you have in your xhtml.

    : Hey everybody,
    :
    : I've been working on a custom extension to HTML that I can use in my web-development. I'm reading the files using the XML parser but I'm having some trouble. Basically, PHP 4's XML parsing functions don't handle XML if it's not properly formatted. Which in turn means my parser won't accept anything that's not perfect XHTML.
    :
    : Since I was hoping to make this a relatively user-friendly language and corresponding parser that I could provide to other developers, I'd like it to be able to accomodate things like
    :
    : [code]
    : image
    : [/code]
    :
    : instead of the XML compliant
    :
    : [code]
    : image
    : [/code]
    :
    : Does anybody have any suggestions on how I could tackle this without writing all of my own low-level XML parsing functions? Is there a more flexible library available for PHP 4 that can gracefully parse through potentially invalid XML?
    :
    : Thanks for the feedback,
    : T
    :

    [size=5][italic][blue]Dar[RED]Q[/RED][/blue][/italic][/size]
    Jou my no rap dy lekkere dikke tsjap

  • tvientitvienti Posts: 230Member
    Not the most helpful response. Obviously I can write my own XHTML compliant code. But let's say somebody wants to convert an existing site to using my extension that isn't XHTML compliant. Let's be honest, XHTML compliance is a nice to have among today's browsers, and I'd like it to not be a requirement for my extension.

    Thanks anyway,

    T

    : im glad that your parser complains. you should write proper xhtml, or no
    : xhtml at all. standards are not there to be messed up.
    :
    : and btw: how much of a problem is it, rewriting it to proper xhtml? if you have little understanding of the rules, then you can either start and learn it at w3schools. or just use the w3c validator that can tell you what inconsitancies you have in your xhtml.
    :
    : : Hey everybody,
    : :
    : : I've been working on a custom extension to HTML that I can use in my web-development. I'm reading the files using the XML parser but I'm having some trouble. Basically, PHP 4's XML parsing functions don't handle XML if it's not properly formatted. Which in turn means my parser won't accept anything that's not perfect XHTML.
    : :
    : : Since I was hoping to make this a relatively user-friendly language and corresponding parser that I could provide to other developers, I'd like it to be able to accomodate things like
    : :
    : : [code]
    : : image
    : : [/code]
    : :
    : : instead of the XML compliant
    : :
    : : [code]
    : : image
    : : [/code]
    : :
    : : Does anybody have any suggestions on how I could tackle this without writing all of my own low-level XML parsing functions? Is there a more flexible library available for PHP 4 that can gracefully parse through potentially invalid XML?
    : :
    : : Thanks for the feedback,
    : : T
    : :
    :
    : [size=5][italic][blue]Dar[RED]Q[/RED][/blue][/italic][/size]
    : Jou my no rap dy lekkere dikke tsjap
    :
    :

  • kamran_prokamran_pro Posts: 20Member
    DOM XML functions would help you.
    http://www.php.net/manual/en/ref.domxml.php (Reference Manual).
    -------------------------------------
    : Not the most helpful response. Obviously I can write my own XHTML compliant code. But let's say somebody wants to convert an existing site to using my extension that isn't XHTML compliant. Let's be honest, XHTML compliance is a nice to have among today's browsers, and I'd like it to not be a requirement for my extension.
    :
    : Thanks anyway,
    :
    : T
    :
    : : im glad that your parser complains. you should write proper xhtml, or no
    : : xhtml at all. standards are not there to be messed up.
    : :
    : : and btw: how much of a problem is it, rewriting it to proper xhtml? if you have little understanding of the rules, then you can either start and learn it at w3schools. or just use the w3c validator that can tell you what inconsitancies you have in your xhtml.
    : :
    : : : Hey everybody,
    : : :
    : : : I've been working on a custom extension to HTML that I can use in my web-development. I'm reading the files using the XML parser but I'm having some trouble. Basically, PHP 4's XML parsing functions don't handle XML if it's not properly formatted. Which in turn means my parser won't accept anything that's not perfect XHTML.
    : : :
    : : : Since I was hoping to make this a relatively user-friendly language and corresponding parser that I could provide to other developers, I'd like it to be able to accomodate things like
    : : :
    : : : [code]
    : : : image
    : : : [/code]
    : : :
    : : : instead of the XML compliant
    : : :
    : : : [code]
    : : : image
    : : : [/code]
    : : :
    : : : Does anybody have any suggestions on how I could tackle this without writing all of my own low-level XML parsing functions? Is there a more flexible library available for PHP 4 that can gracefully parse through potentially invalid XML?
    : : :
    : : : Thanks for the feedback,
    : : : T
    : : :
    : :
    : : [size=5][italic][blue]Dar[RED]Q[/RED][/blue][/italic][/size]
    : : Jou my no rap dy lekkere dikke tsjap
    : :
    : :
    :
    :

Sign In or Register to comment.