XML Entity Functions

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Chung Leong

    XML Entity Functions

    How come there isn't a xmlspecialchars (), and for that matter,
    xml_entity_deco de()? I would think someone would have thought of that by
    now.


  • Eric Bohlman

    #2
    Re: XML Entity Functions

    "Chung Leong" <chernyshevsky@ hotmail.com> wrote in
    news:YtudncTw97 RIlJPdRVn-jw@comcast.com:
    [color=blue]
    > How come there isn't a xmlspecialchars (), and for that matter,
    > xml_entity_deco de()? I would think someone would have thought of that by
    > now.[/color]

    Probably because the only reserved characters (and the only ones with
    predefined entities) in XML are the ones handled by htmlspecialchar s().
    Remember that unless a DTD defines further entities, the only character
    entity names available in XML are &amp;, &lt;, &gt;, &quot;, and &apos;.

    Comment

    • John Dunlop

      #3
      Re: XML Entity Functions

      Eric Bohlman wrote:
      [color=blue]
      > "Chung Leong" <chernyshevsky@ hotmail.com> wrote in
      > news:YtudncTw97 RIlJPdRVn-jw@comcast.com:
      >[color=green]
      > > How come there isn't a xmlspecialchars (), and for that matter,
      > > xml_entity_deco de()?[/color]
      >
      > Probably because the only reserved characters (and the only ones with
      > predefined entities) in XML are the ones handled by htmlspecialchar s().[/color]

      OK. But in the case of html_entity_dec ode, it obviously won't work
      for &apos;, since no such entity reference exists in HTML. That
      entity reference will be left unchanged. No great problem though.

      --
      Jock

      Comment

      • Chung Leong

        #4
        Re: XML Entity Functions

        htmlspecialchar s() doesn't do &apros; though. It's easy enough to use
        strtr(), but if the string is of multi-byte encoding, then it might not work
        (the second byte of a 2-byte character would be <>&"', but shouldn't be
        replaced).

        Uzytkownik "Eric Bohlman" <ebohlman@earth link.net> napisal w wiadomosci
        news:Xns9477D2C 4745Bebohlmanom sdevcom@130.133 .1.4...[color=blue]
        > "Chung Leong" <chernyshevsky@ hotmail.com> wrote in
        > news:YtudncTw97 RIlJPdRVn-jw@comcast.com:
        >[color=green]
        > > How come there isn't a xmlspecialchars (), and for that matter,
        > > xml_entity_deco de()? I would think someone would have thought of that by
        > > now.[/color]
        >
        > Probably because the only reserved characters (and the only ones with
        > predefined entities) in XML are the ones handled by htmlspecialchar s().
        > Remember that unless a DTD defines further entities, the only character
        > entity names available in XML are &amp;, &lt;, &gt;, &quot;, and &apos;.[/color]


        Comment

        Working...