Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   XML (http://www.velocityreviews.com/forums/f32-xml.html)
-   -   A HTML document into a XHTML document(wap2.0 mobile profile) (http://www.velocityreviews.com/forums/t167999-a-html-document-into-a-xhtml-document-wap2-0-mobile-profile.html)

mike 10-13-2004 09:43 AM

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

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


thank you
best wishes

Shmuel (Seymour J.) Metz 10-13-2004 12:57 PM

Re: A HTML document into a XHTML document(wap2.0 mobile profile)
 
In <761727b3.0410130143.45951e57@posting.google.com >, on 10/13/2004
at 02:43 AM, s917124@mail.yzu.edu.tw (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 spamtrap@library.lspace.org


Martin Honnen 10-13-2004 03:05 PM

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


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/

Joris Gillis 10-14-2004 01:57 PM

Re: A HTML document into a XHTML document(wap2.0 mobile profile)
 
>
>> 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-v...i?userid=38041)
Ceterum censeo XML omnibus esse utendum

Nick Kew 10-14-2004 04:54 PM

Re: A HTML document into a XHTML document(wap2.0 mobile profile)
 
In article <opsfu48pj5yf9v9r@news.pandora.be>,
"Joris Gillis" <roac@pandora.be> 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/

Joris Gillis 10-14-2004 05:49 PM

Re: A HTML document into a XHTML document(wap2.0 mobile profile)
 
On Thu, 14 Oct 2004 17:54:35 +0100, Nick Kew <nick@hugin.webthing.com>
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-v...i?userid=38041)
Ceterum censeo XML omnibus esse utendum

Andy Dingley 10-14-2004 09:02 PM

Re: A HTML document into a XHTML document(wap2.0 mobile profile)
 
On 13 Oct 2004 02:43:32 -0700, s917124@mail.yzu.edu.tw (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


All times are GMT. The time now is 12:30 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.