A HTML document into a XHTML document(wap2.0 mobile profile)

Discussion in 'XML' started by mike, Oct 13, 2004.

  1. mike

    mike Guest

    regards:

    Is it possible to use java XML api to translate
    a HTML document into a XHTML document(mobile profile)


    thank you
    best wishes
    mike, Oct 13, 2004
    #1
    1. Advertising

  2. In <>, on 10/13/2004
    at 02:43 AM, (mike) said:

    >Is it possible to use java XML api to translate
    >a HTML document into a XHTML document(mobile profile)


    Yes, but the easiest way to do it is probably via XSLT.

    --
    Shmuel (Seymour J.) Metz, SysProg and JOAT <http://patriot.net/~shmuel>

    Unsolicited bulk E-mail subject to legal action. I reserve the
    right to publicly post or ridicule any abusive E-mail. Reply to
    domain Patriot dot net user shmuel+news to contact me. Do not
    reply to
    Shmuel (Seymour J.) Metz, Oct 13, 2004
    #2
    1. Advertising

  3. mike wrote:

    > Is it possible to use java XML api to translate
    > a HTML document into a XHTML document(mobile profile)


    I have recently read an announcement for
    http://mercury.ccil.org/~cowan/XML/tagsoup/
    I don't have any experience with that software myself but if it works as
    announced then you can use a SAX API to parse HTML tagsoup and then use
    SAX events to produce the desired output.
    There is also TSaxon named on that page as part of the package that
    allows you to transform HTML to XML so all you would need is to write an
    XSLT 1.0 stylesheet transforming the HTML as needed to XHTML.


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, Oct 13, 2004
    #3
  4. mike

    Joris Gillis Guest

    >
    >> Is it possible to use java XML api to translate
    >> a HTML document into a XHTML document(mobile profile)

    >
    > Yes, but the easiest way to do it is probably via XSLT.
    >


    I would rather say it is impossible with XSLT.
    Html is, per definition not an XML language, and thus cannot possibly be
    transformed with xslt, which requires valid XML input. If the html would
    be valid XML, you would call it XHTML, not html.

    Transformation of XHTML to html is off course possible (but not desirable
    :)


    --
    Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041)
    Ceterum censeo XML omnibus esse utendum
    Joris Gillis, Oct 14, 2004
    #4
  5. mike

    Nick Kew Guest

    In article <>,
    "Joris Gillis" <> writes:
    >>
    >>> Is it possible to use java XML api to translate
    >>> a HTML document into a XHTML document(mobile profile)

    >>
    >> Yes, but the easiest way to do it is probably via XSLT.


    XSLT is a complex, slow solution. I'd be surprised if it's the
    easiest way. I'm not up-to-date on JAVA APIs, but with C or C++
    it's much easier than that, and I'd expect NekoHTML to offer a
    good solution in Java.

    > I would rather say it is impossible with XSLT.
    > Html is, per definition not an XML language, and thus cannot possibly be
    > transformed with xslt, which requires valid XML input. If the html would


    Nonsense. XSLT starts with a DOM tree, which can equally well represent
    an HTML or an XHTML document. As soon as you've parsed the HTML to DOM,
    your XSLT parser can pretend it was XML all along (and if you apply the
    identity transform, you've just converted to XHTML).

    But by the time you've generated the DOM, you've already done more
    work than you needed to. SAX is just as easy.

    --
    Nick Kew

    Nick's manifesto: http://www.htmlhelp.com/~nick/
    Nick Kew, Oct 14, 2004
    #5
  6. mike

    Joris Gillis Guest

    On Thu, 14 Oct 2004 17:54:35 +0100, Nick Kew <>
    wrote:

    >> I would rather say it is impossible with XSLT.
    >> Html is, per definition not an XML language, and thus cannot possibly be
    >> transformed with xslt, which requires valid XML input. If the html would

    >
    > Nonsense. XSLT starts with a DOM tree, which can equally well represent
    > an HTML or an XHTML document. As soon as you've parsed the HTML to DOM,
    > your XSLT parser can pretend it was XML all along (and if you apply the
    > identity transform, you've just converted to XHTML).


    It seems I've always been terribly mistaking.
    The word 'DOM' doesn't even occur in the XSLT 1.0 nor the XSL1.0
    specification.
    But now I found what you're saying is indeed stated (in the XSLT2.0
    working draft).

    Thanks for the correction

    --
    Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041)
    Ceterum censeo XML omnibus esse utendum
    Joris Gillis, Oct 14, 2004
    #6
  7. mike

    Andy Dingley Guest

    On 13 Oct 2004 02:43:32 -0700, (mike) wrote:

    >Is it possible to use java XML api to translate
    >a HTML document into a XHTML document(mobile profile)


    No.

    You have two problems; translating HTML (not always well-formed XML)
    into something manageable, then translating this intermediate format
    to XHTML-MP.

    I suggest you download a copy of Tidy (from HTML-Kit), then read the
    source code and the comments. Converting HTML to XHTML reliably is a
    hard problem, in the awkward cases.

    --
    Smert' spamionam
    Andy Dingley, Oct 14, 2004
    #7
    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. mike
    Replies:
    3
    Views:
    476
    Thomas Weidenfeller
    Jan 24, 2005
  2. mike
    Replies:
    0
    Views:
    373
  3. chronos3d
    Replies:
    9
    Views:
    755
    Andy Dingley
    Dec 5, 2006
  4. chen selina
    Replies:
    0
    Views:
    1,243
    chen selina
    Jul 13, 2010
  5. ringerxyz

    does vs2005 support wap2.0(xhtml)

    ringerxyz, Dec 5, 2005, in forum: ASP .Net Mobile
    Replies:
    0
    Views:
    153
    ringerxyz
    Dec 5, 2005
Loading...

Share This Page