[Home]  [List]  [News]  [Docs]  [FAQ]  [Downloads]  [Resources]  [About]
Search :
/Home /List

list4xt : Mailing list for the XT users community.

[list4xt] Re: JAXP1.1 transform pacakge implementation for XT

Subject: [list4xt] Re: JAXP1.1 transform pacakge implementation for XT
From: Ben Sifuentes (bsifuentes@cysive.com)
Date: 06/12/2000 - 15:47


I would be very interested in that code.

Currently, trying to utilize JAXP and XT to transform XML to WML but it
seems the DOMDemo code provide the distribution of XT is droping the DOCType
even though it is clearly defined.

Below is a description of the problem I am having:

Can someone explain to me why this doesn't work?

Currently, I'm using the JAXP release 2 and James Clark XT

I have the following coded:

XML

---

<name> <first>Ben</first> <last>Sifuentes</last> </name>

XSL ---

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="wml" indent="yes" media-type="text/vnd.wap.xml" omit-xml-declaration="no" doctype-public="-//WAPFORUM//DTD WML 1.1//EN" doctype-system="http://www.wapforum.com/DTD/wml_1.1.xml" /> <xsl:template match="/"> <wml> <card id="main1" title="main card"> <onevent type="ontimer"> <go href="http://localhost:8080/jsp/mainmenu.jsp"/> </onevent> <timer value="60"/> <do type="accept" label="next"> <go href="http://localhost:8080/jsp/mainmenu.jsp"/> </do> <do type="prev"> <noop/> </do> <p>Welcome <xsl:value-of select="/name/first"/> <xsl:text> </xsl:text> <xsl:value-of select="/name/last"/> to AirBank!</p> </card> </wml> </xsl:template> </xsl:stylesheet>

Now when I ran this manually using the James Clark XT it produces the correct code as follows:

command: java -Dcom.jclark.xsl.sax.parser=com.sun.xml.parser.Parser com.jclark.xsl.sax.Driver atest.xml atestWML.xsl welcome.wml

WML --- <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.com/DTD/wml_1.1.xml"> <wml> <card id="main1" title="main card"> <onevent type="ontimer"> <go href="http://localhost:8080/jsp/mainmenu.jsp"/> </onevent> <timer value="60"/> <do type="accept" label="next"> <go href="http://localhost:8080/jsp/mainmenu.jsp"/> </do> <do type="prev"> <noop/> </do> <p>Welcome Ben Sifuentes to AirBank!</p> </card> </wml>

Now on the other hand when I use the XT demo code "DOMDemo" that comes with the XT installation. It produces incorrect output!

WML --- <?xml version="1.0" encoding="UTF-8"?>

<wml> <card id="main1" title="main card"> <onevent type="ontimer"> <go href="http://localhost:8080/jsp/mainmenu.jsp" /> </onevent> <timer value="60" /> <do type="accept" label="next"> <go href="http://localhost:8080/jsp/mainmenu.jsp" /> </do> <do type="prev"> <noop /> </do> <p>Welcome Ben Sifuentes to AirBank!</p> </card> </wml>

As you can see from the above. The <!DOCTYPE ...> is missing from the file that was generated. It should have been on the second line. I've included the DOMDemo.java code.

DOMDemo.java ------------ import java.io.IOException; import java.io.OutputStream; import java.io.FileOutputStream; import org.xml.sax.SAXException; import com.sun.xml.tree.XmlDocument;

import com.jclark.xsl.dom.Transform; import com.jclark.xsl.dom.TransformEngine; import com.jclark.xsl.dom.TransformException; import com.jclark.xsl.dom.XSLTransformEngine;

/** * This is a demo of using the simple, pure DOM API to XT. * It uses Sun's DOM implementation (Project X TR2). */

class DOMDemo { public static void main(String[] args) throws IOException, SAXException, TransformException { if (args.length != 3) { System.err.println("usage: java DOMDemo sourceURL stylesheetURL resultFile"); System.exit(1); }

XmlDocument result = new XmlDocument(); new XSLTransformEngine() .createTransform(XmlDocument.createXmlDocument(args[1], false)) .transform(XmlDocument.createXmlDocument(args[0]), result); OutputStream out = new FileOutputStream(args[2]); result.write(out); out.close(); } }

Now I realize that when I ran it from the command line it was using SAX to parser the file and generate the ouput and that the java code is using DOM to produce it's output. But, from my understanding it should have produced the same output. Also can anyone guide me in modifying the above code to utilize SAX instead of the DOM.

Any help would be greatly appreciated. -Ben

-----Original Message----- From: list4xt-bounce@4xt.org [mailto:list4xt-bounce@4xt.org]On Behalf Of Sebastien Sahuc Sent: Wednesday, December 06, 2000 8:51 AM To: list4xt@4xt.org Subject: [list4xt] JAXP1.1 transform pacakge implementation for XT

Hi,

As I'm in the process of implementing the JAXP1.1 API on top of XT, I would like to know if other have thought about doing it yet.

Moreover, I thought it might interest other people. If it camo it be true, I'll be more than happy to share the piece of code, just let me know how I shoud deal with it.

Thanks,

Sebastien

-- Mailing list for the XT users community. (http://highriskexperts.com) (mailto:list4xt-request@4xt.org?Subject=unsubscribe to unsubscribe)

-- Mailing list for the XT users community. (http://zen-cart-power.com) (mailto:list4xt-request@4xt.org?Subject=unsubscribe to unsubscribe)



Archive générée par hypermail 2b28 le 25/04/2001 - 07:16 CEST

webmaster@4xt.org


A site designed by Dyomedea