How To do a Simple Convert of A single-tag HTML To XML?

Discussion in 'Perl Misc' started by valued customer, Jul 4, 2004.

  1. I have the following HTML code:

    <code><b>Être en colère</b></code>

    How do I convert that to well-formed XML?

    I tried using HTML::Entities, but this does not produce well-formed
    XML because it creates undefined entity references.

    So how can it be done?
     
    valued customer, Jul 4, 2004
    #1
    1. Advertising

  2. valued customer

    John Bokma Guest

    valued customer wrote:

    > I have the following HTML code:
    >
    > <code><b>Être en colère</b></code>
    >
    > How do I convert that to well-formed XML?


    use an ISO encoding in your XML, e.g:

    <?xml version="1.0" encoding="ISO-8859-1"?>

    > I tried using HTML::Entities, but this does not produce well-formed
    > XML because it creates undefined entity references.


    or put those in the DTD.

    > So how can it be done?


    see above. I use the encoding one. If you use XML::Twig, see:
    <http://johnbokma.com/mexit/2004/04/22/xmltwiginputfilter.html>

    --
    John MexIT: http://johnbokma.com/mexit/
    personal page: http://johnbokma.com/
    Experienced Perl programmer available: http://castleamber.com/
    Happy Customers: http://castleamber.com/testimonials.html
     
    John Bokma, Jul 5, 2004
    #2
    1. Advertising

  3. valued customer wrote:
    > I have the following HTML code:
    >
    > <code><b>Être en colère</b></code>
    >
    > How do I convert that to well-formed XML?


    This example is well-formed XML
    - every opening tag has a corresponding closing tag
    - the tags are properly nested
    - there is only one root tag

    > I tried using HTML::Entities, but this does not produce well-formed
    > XML because it creates undefined entity references.
    >
    > So how can it be done?


    Maybe you have an encoding problem rather then an XML problem?

    jue
     
    Jürgen Exner, Jul 5, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. RC
    Replies:
    2
    Views:
    438
    Malte
    May 10, 2005
  2. shruds
    Replies:
    1
    Views:
    835
    John C. Bollinger
    Jan 27, 2006
  3. Replies:
    4
    Views:
    443
  4. Replies:
    1
    Views:
    388
    Andrew Thompson
    Nov 29, 2006
  5. Erik Wasser
    Replies:
    5
    Views:
    465
    Peter J. Holzer
    Mar 5, 2006
Loading...

Share This Page