[JAXP-77] XSLT 2.0 / XPath 2.0 Created: 05/Jun/13  Updated: 05/Jun/13

Status: Open
Project: jaxp
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Critical
Reporter: mkarg Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Now that XSLT 2.0 and XPath 2.0 are public Standards for years, with SAXON HE having an open-source, industry-proof Java-based RI, and with XSLT 3.0 on the way, JAXP should really, really finally Mandate that the minimum XSLT Level an implementation provides is not 1.0 but 2.0! People really do wait for this for years. Please, please!






[JAXP-73] Problem unmarshalling duration-type fields containing whitespace Created: 15/Mar/11  Updated: 28/Jun/12

Status: Open
Project: jaxp
Component/s: None
Affects Version/s: current
Fix Version/s: None

Type: Bug Priority: Major
Reporter: gturner Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: Windows XP
Platform: All


Attachments: Zip Archive jaxb-817.zip    
Issuezilla Id: 590

 Description   

The following problem could be observed in Jaxb 2.1:

Having an XML schema that defines the following type:
<element name="PublishedStartTime" type="dateTime" minOccurs="0"/>

and an having an XML instance document with the following entry:
<tva:PublishedStartTime>
2008-11-01T00:00:00Z
</tva:PublishedStartTime>

... i.e. with trailing and leading whitespaces, will result in an an
unmarshalled PublishedStartTime of null instead of the expected date and time.

The problem does not occur, if the entry in the XML instance document looks as
follows:

<tva:PublishedStartTime>2008-11-01T00:00:00Z</tva:PublishedStartTime>

... i.e. there are no leading and trailing whitespaces.
The Jaxb-classes generated with XJC use XMLGregorianCalendar as the data type
holding dateTime types.

The problem seems to be that the XMLGregorianCalendar / DatatypeFactory does not
support input strings with leading and trailing whitespaces as documented in
http://java.sun.com/javase/6/docs/api/javax/xml/datatype/DatatypeFactory.html#newXMLGregorianCalendar(java.lang.String).
Additionally it seems that the Jaxb2.1 runtime does not remove leading and
trailing whitespaces from dateTime entries.

We believe this is a bug, since either XMLGregorianCalendar should support
leading and trailing whitespaces, or Jaxb2.1 RI should remove leading and
trailing whitepsaces for dateTime entries. Otherwise, another JavaType than
XMLGregorianCalendar should be used as default type for xsd:dateTime types.

Best regards,

Hao and Florian



 Comments   
Comment by gturner [ 15/Mar/11 ]

Ooops!

Sorry I used the JIRA "Clone" link from bug 590. I didn't realize it would copy the initial comment. Version number, environment, etc. are wrong too.

I am using 2.1.13 and am experiencing the same effect on duration types.

e.g.

<StartTime>
2006-12-05T09:36:48.596-08:00
</StartTime>
<ExpireTime>
PT1H
</ExpireTime>

System.out.println(object.getStartTime()); // => 2006-12-05T09:36:48.596-08:00; Good! Bug 590 fixed.
System.out.println(object.getExpireTime()); // => null; Bad! Similar to bug 590.

Comment by Martin Grebac [ 08/Apr/11 ]

Thanks for filing this - would you please also attach a simple testcase?

Comment by gturner [ 08/Apr/11 ]

Hi Martin, I was going to write a testcase with the jaxb source, but it appears that jaxb-unit is not open source - http://www.java.net/node/693249 - is this still true?

Comment by Martin Grebac [ 08/Apr/11 ]

Yes, still true. You don't need to follow any guidelines/layout/whatever - anything I can execute is fine - just so that it contains the xsd/xml and the code you use.

Comment by gturner [ 08/Apr/11 ]

Attached is a testcase, a self-contained project using Ant, not JUnit or anything, may have lots of trouble running with dll-hell that is Xerces and JAXB inclusion in JRE. Here are the relevant bits:

test.xsd:

<xs:element name="document">
<xs:complexType>
<xs:sequence>
<xs:element name="duration" type="xs:duration" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>

test.xml:

<document xmlns="urn:test">
<duration>PT1H</duration>
<duration> PT1H</duration>
<duration>PT1H </duration>
<duration> PT1H </duration>
<duration>
PT1H
</duration>
</document>

Test.java:

for (Duration duration : doc.getDuration())
if (duration != null)
System.out.println("Got duration " + duration);
else
System.err.println("Got NULL duration!");

Ant output:

[java] Got duration PT1H
[java] Got NULL duration!
[java] Got NULL duration!
[java] Got NULL duration!
[java] Got NULL duration!

Comment by Iaroslav Savytskyi [ 28/Jun/12 ]

Hi, Joe,

I think this is JAXP bug. As I see from the spec for the duration type it should do "whiteSpace = collapse (fixed)".





[JAXP-75] XMLStreamWriterImpl does not close last empty tag in fragment Created: 24/Dec/12  Updated: 24/Dec/12

Status: Open
Project: jaxp
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: kevinoid Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

When writing an XML fragment (rather than an entire document, which would have a non-empty root element), if the last call is to writeEmptyElement, the empty element is not closed. As an example, consider the following program:

import java.io.IOException;
import java.io.OutputStreamWriter;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;

class XMLStreamWriterFragBugDemo {
    public static void main(String[] args) throws IOException, XMLStreamException {
	OutputStreamWriter outWriter = new OutputStreamWriter(System.out);
	XMLStreamWriter xmlWriter =
	    XMLOutputFactory.newInstance().createXMLStreamWriter(outWriter);

	xmlWriter.writeEmptyElement("empty");
	xmlWriter.writeEmptyElement("empty");

	xmlWriter.flush();
	xmlWriter.close();

	outWriter.flush();

	System.out.println("");
    }
}

This should output <empty/><empty/>, but instead it outputs <empty/><empty.

The fix that I would suggest is to call closeStartTag() before fWriter.flush() in close() if fStartTagOpened is true, but that is up to you, of course.






Generated at Wed Jan 18 00:31:20 UTC 2017 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.