Re: JDom and Java5

Mattias Jiderhamn <[email protected]>
Newsgroups gmane.comp.java.jdom.general
Message-ID <[email protected]>
Is the JAR at http://git.tuis.net/jdom/jdom.jar really updated...? I get 
the same result for both cases.

Regarding List<?> I believe that List = List<?> = List<? extends 
java.lang.Object>.

Hopefully you should be able to use this code as the basis for a test case:

      TransformerFactory transformerFactory = 
TransformerFactory.newInstance();
      StreamSource streamSource = new StreamSource(new StringReader(
          "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" +
          "<xsl:stylesheet version=\"1.0\" 
xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">\n" +
          "  <xsl:template match=\"/\">\n" +
          "    <foo>" +
          "<bar myAttribute=\"myValue\" />" +
          "<ns:bar xmlns:ns=\"http://foo/bar\" myAttribute=\"myValue\" 
ns:attribute2=\"prefixed\" />" +
          "</foo>\n" +
          "  </xsl:template>\n" +
          "</xsl:stylesheet>"));
      Transformer transformer = 
transformerFactory.newTransformer(streamSource);

      JDOMSource source = new JDOMSource(new org.jdom.Document(new 
Element("foo")));
      JDOMResult result = new JDOMResult();
      transformer.transform(source, result);


 /Mattias


Rolf Lear wrote (2008-02-22 15:28):
> Hi Mattias
>
> Thanks for the feedback.
>
> The XSLT issue is a bug I introduced with the port. Previously there 
> was a single inner class of JDOMSource that could deal with either 
> Document or Content Lists. With the port I created two inner classes, 
> one for Documents only, and the second for List<Content> only. I 
> introduced a bug in the process. Easy fix (just poor testing - I 
> should introduce a test in jdom-test for the XSLT stuff - can you put 
> together a simple test case of the bug?).
>
> The second issue is also cool. The XPath code is implemented by the 
> jaxen library which is not (yet) generified. As a consequence, I 
> hacked the calles to Jaxen to get List<Object>. By removing the hacks 
> and providing List<?> as output it is actually simpler. I am not sure 
> if you were anticipating just plain List as output instead of List<?>, 
> is there a difference?
>
> I have updated the code repo, jar, apidocs, and website, etc.
>
> Thanks
>
> Rolf
>
> Mattias Jiderhamn wrote:
>> This is good news!
>> At least a first step towards an official Java5 JDOM version.
>>
>> I downloaded your JAR and put it in my dev environment. Here are a 
>> few problems I ran into (which I haven't had time to analyze myself):
>>
>> When trying to do XSLT from a JDOMSource to a JDOMResult I got this
>> org.xml.sax.SAXNotSupportedException: Only JDOM Documents are 
>> supported as input
>>    at 
>> org.jdom.transform.JDOMSource$DocumentReader.parse(JDOMSource.java:580)
>>    at 
>> com.caucho.xsl.TransformerImpl.parseDocument(TransformerImpl.java:536)
>>    at com.caucho.xsl.TransformerImpl.transform(TransformerImpl.java:270)
>>    at 
>> se.exder.servlet.XslTransformer.transformToDocument(XslTransformer.java:159) 
>>
>>   ...
>>
>> XPath.selectNodes() now returns a List<Object> rather than an 
>> "untyped" List. I would be preferrable if it would still return a 
>> plain List which could be cast to a List<Element> if you know only 
>> Elements will be returned.
>>
>> /Mattias Jiderhamn
>>
>>
>> Rolf Lear wrote (2008-02-21 16:28):
>>> Hi All.
>>>
>
>

_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.