I'm trying to generate HTML using a SAX TransformHandle r. The problem
I'm having is related to the xalan transformer using the shorthand
notation when it writes out an empty textarea tag. My code works fine
when xalan.jar is not in my classpath. But when xalan.jar is in the
classpath, the generated html incorrectly uses the shorthand notation
for writing out an empty textarea tag.
Correct output:
C:\test>java Test
com.sun.org.apa che.xalan.inter nal.xsltc.trax. TransformerImpl
<html>
<body>
<textarea></textarea>GoodBy e</body>
</html>
Incorrect output:
C:\test>java -classpath .;/tomcat5/common/lib/xalan.jar Test
org.apache.xala n.transformer.T ransformerIdent ityImpl
<?xml version="1.0" encoding="UTF-8"?>
<html>
<body>
<textarea/>GoodBye</body>
</html>
As you can see from the above example, when xalan is involved, the
generated output results in HTML that confuses IE. Is there a way to
force xalan into NOT using the short hand notation for the textarea
tag?
Here's the source code of my program:
public static void main( String [] args )
{
try {
// prepare the output transform handler
SAXTransformerF actory tf =
(SAXTransformer Factory) TransformerFact ory.newInstance ();
TransformerHand ler transformerHand ler =
tf.newTransform erHandler();
Transformer serializer = transformerHand ler.getTransfor mer();
System.out.prin tln( serializer.getC lass().getName( ) );
serializer.setO utputProperty(O utputKeys.ENCOD ING, "UTF-8");
serializer.setO utputProperty(O utputKeys.INDEN T, "yes");
transformerHand ler.setResult( new StreamResult( System.out ) );
transformerHand ler.startDocume nt();
Attributes noAtts = new AttributesImpl( );
transformerHand ler.startElemen t("", "", "html", noAtts );
transformerHand ler.startElemen t("", "", "body", noAtts );
transformerHand ler.startElemen t(
"", "", "textarea", noAtts );
transformerHand ler.endElement( "", "", "textarea" );
String msg = "GoodBye" ;
transformerHand ler.characters( msg.toCharArray (),
0, msg.length() );
transformerHand ler.endElement( "", "", "body" );
transformerHand ler.endElement( "", "", "html" );
transformerHand ler.endDocument ();
}
catch ( Exception e ) {
e.printStackTra ce();
}
} 5 1774
I'm still looking for an answer to this one. My opinion on the matter
is that <textarea/> should be considered perfectly legal xhtml.
However, IE 6.0, isn't smart enough to handle it. That's why I was
looking for a possible work around that doesn't involve forcing a space
between the start and end of the element.
John wrote: I'm still looking for an answer to this one. My opinion on the matter is that <textarea/> should be considered perfectly legal xhtml. However, IE 6.0, isn't smart enough to handle it. That's why I was looking for a possible work around that doesn't involve forcing a space between the start and end of the element.
Exactly, both <textarea></textarea> and <textarea/> are equivalent
and valid xhtml.
Couldn't you just leave out the textarea at all?
Gerald
John wrote: I'm still looking for an answer to this one. My opinion on the matter is that <textarea/> should be considered perfectly legal xhtml. However, IE 6.0, isn't smart enough to handle it. That's why I was looking for a possible work around that doesn't involve forcing a space between the start and end of the element.
another idea: let your xhtml validate by the w3c validator.
if it is not valid xhtml then the browser will switch to
quirks-mode (see FAQ at http://www.quirksmode.org/)
HTH
Gerald
John wrote: I'm still looking for an answer to this one. My opinion on the matter is that <textarea/> should be considered perfectly legal xhtml.
1. The subject contains HTMLSerializer. The serializer for _HTML_ should
not create <textarea/>.
2. According to the XML spec you should only use the empty element
notation for elements that are empty by definition, which textarea is not.
However, IE 6.0, isn't smart enough to handle it.
IE 6.0 does not know XHTML.
--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
John wrote: I'm still looking for an answer to this one. My opinion on the matter is that <textarea/> should be considered perfectly legal xhtml.
It's legal as XML, but violates the notorious Appendix C of XHTML.
So it's not legal to serve on the Web as "text/html".
However, IE 6.0, isn't smart enough to handle it.
Indeed. But if you serve it as text/html then XML rules don't apply,
so IE is within its rights not treating <foo/> as <foo></foo>.
That's why I was looking for a possible work around that doesn't involve forcing a space between the start and end of the element. http://apache.webthing.com/mod_xhtml/
--
Nick Kew This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: al dav |
last post by:
Hi all
ok i am not a java programmer I am a sys-admin, my users want xalan and have
already got j2sdk_1.4.2
so i have downloaded it and set the CLASS_PATH
export
CLASS_PATH=/usr/local/java/xalan-j_2_5_2/bin/xalan.jar:/usr/local/java/xalan
-j_2_5_2/bin/xml-apis.jar:/usr/local/java/xalan-j_2_5_2/bin/xercesImpl.jar:/
|
by: Guillaume Jeudy |
last post by:
Hi,
I'm trying to serialize a DOM constructed from the following URL which
is subject to change very frequently:
http://www.bbc.co.uk/syndication/feeds/news/ukfs_news/world/asia-pacific/rss091.xml
I sometimes receive this error:
java.lang.NullPointerException:
|
by: Fisch von Gestern |
last post by:
I have tried to run the extension function/element examples provided
with the Xalan-J download. I believe that my classpath is correct,
and that my versions are up-to-date. However, I can't get past the
following error. Any help, please?
===========================================================================
C:\xalan>test
C:\xalan>REM @echo off
|
by: Ganesh Gella |
last post by:
Hi All,
I am planning to use Xalan to transform XML data by applying xls
stylesheets.
Here tricky part is, Xalan provides several C++ APIs, which are very
much useful if our requirement is just inputting a file and getting a
file. Or giving a xerces dom and get a new xerces dom.
I would like to know whether any of you tried with their own custom
|
by: Dr. Roger Wießner |
last post by:
Hello!
I am a newbie to XSLT and need a freeware/GNU Tool
to get experience with this new topic.
Which one is a good XSLT? Xalan or Saxon, or which
one else?
Thank you a lot!
| |
by: RC |
last post by:
First, let me say I couldn't find a group discuss
XML/XSLT. So I only choose the closest groups to
post this message.
Here is part of my *.xsl file
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:my-javascript-ext="my-ext1"
extension-element-prefixes="my-javascript-ext"
|
by: terry.jeske |
last post by:
Hello,
I am trying to upgrade an application that was previously running on
Xalan 1.4.2, to 2.7.0.
I have worked out the build issues and now the application compiles
with the new xalan and xerces. However, at runtime I get the following
error when I try to do a transform:
(Location of error unknown)org.xml.sax.SAXException: Can not resolve
|
by: Avalon1178 |
last post by:
Hi,
I recently downloaded the xalan-c source code in
http://mirrors.ccs.neu.edu/Apache/dist/xml/xalan-c
I followed the instructions from the apache site on how to build it (I
already have xerces downloaded and compiled), however, I'm getting
quite a few compile errors. I downloaded and compiled xerces 2.6.0 and
I downloaded xalan 1.9.0.
|
by: henribastien |
last post by:
I'm trying to return an array from a xalan extension but so far I have
made no progress. What I would like to return is something like that
<entry id="red">201</entry>
<entry id="green>55</entry>
<entry id="blue">123</entry>
so I could acces them with something like $returned.
Problem is, I haven't figured out how to do that. I haven't found any
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |