Search in sources :

Example 6 with XSDuration

use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSDuration in project webtools.sourceediting by eclipse.

the class FnSecondsFromDuration method expected_args.

/**
 * Obtain a list of expected arguments.
 *
 * @return Result of operation.
 */
public static synchronized Collection expected_args() {
    if (_expected_args == null) {
        _expected_args = new ArrayList();
        _expected_args.add(new SeqType(new XSDuration(), SeqType.OCC_QMARK));
    }
    return _expected_args;
}
Also used : XSDuration(org.eclipse.wst.xml.xpath2.processor.internal.types.XSDuration) SeqType(org.eclipse.wst.xml.xpath2.processor.internal.SeqType) ArrayList(java.util.ArrayList)

Example 7 with XSDuration

use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSDuration in project webtools.sourceediting by eclipse.

the class FnYearsFromDuration method expected_args.

/**
 * Obtain a list of expected arguments.
 *
 * @return Result of operation.
 */
public static synchronized Collection expected_args() {
    if (_expected_args == null) {
        _expected_args = new ArrayList();
        _expected_args.add(new SeqType(new XSDuration(), SeqType.OCC_QMARK));
    }
    return _expected_args;
}
Also used : XSDuration(org.eclipse.wst.xml.xpath2.processor.internal.types.XSDuration) SeqType(org.eclipse.wst.xml.xpath2.processor.internal.SeqType) ArrayList(java.util.ArrayList)

Example 8 with XSDuration

use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSDuration in project webtools.sourceediting by eclipse.

the class TestBugs method testXSDayTimeDurationMultiply.

public void testXSDayTimeDurationMultiply() throws Exception {
    // Bug 279377
    bundle = Platform.getBundle("org.w3c.xqts.testsuite");
    URL fileURL = bundle.getEntry("/TestSources/emptydoc.xml");
    loadDOMDocument(fileURL);
    // Get XML Schema Information for the Document
    XSModel schema = getGrammar();
    setupDynamicContext(schema);
    String xpath = "xs:dayTimeDuration('PT2H10M') * 2.1";
    compileXPath(xpath);
    ResultSequence rs = evaluate(domDoc);
    XSDuration result = (XSDuration) rs.first();
    String actual = result.getStringValue();
    assertEquals("PT4H33M", actual);
}
Also used : XSDuration(org.eclipse.wst.xml.xpath2.processor.internal.types.XSDuration) ResultSequence(org.eclipse.wst.xml.xpath2.processor.ResultSequence) XSModel(org.apache.xerces.xs.XSModel) XSString(org.eclipse.wst.xml.xpath2.processor.internal.types.XSString) URL(java.net.URL)

Example 9 with XSDuration

use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSDuration in project webtools.sourceediting by eclipse.

the class TestBugs method testXSDayTimeDurationDivide.

public void testXSDayTimeDurationDivide() throws Exception {
    // Bug 279377
    bundle = Platform.getBundle("org.w3c.xqts.testsuite");
    URL fileURL = bundle.getEntry("/TestSources/emptydoc.xml");
    loadDOMDocument(fileURL);
    // Get XML Schema Information for the Document
    XSModel schema = getGrammar();
    setupDynamicContext(schema);
    String xpath = "xs:dayTimeDuration('P1DT2H30M10.5S') div 1.5";
    compileXPath(xpath);
    ResultSequence rs = evaluate(domDoc);
    XSDuration result = (XSDuration) rs.first();
    String actual = result.getStringValue();
    assertEquals("PT17H40M7S", actual);
}
Also used : XSDuration(org.eclipse.wst.xml.xpath2.processor.internal.types.XSDuration) ResultSequence(org.eclipse.wst.xml.xpath2.processor.ResultSequence) XSModel(org.apache.xerces.xs.XSModel) XSString(org.eclipse.wst.xml.xpath2.processor.internal.types.XSString) URL(java.net.URL)

Example 10 with XSDuration

use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSDuration in project webtools.sourceediting by eclipse.

the class TestBugs method testXSYearMonthDurationMultiply.

public void testXSYearMonthDurationMultiply() throws Exception {
    // Bug 279373
    bundle = Platform.getBundle("org.w3c.xqts.testsuite");
    URL fileURL = bundle.getEntry("/TestSources/emptydoc.xml");
    loadDOMDocument(fileURL);
    // Get XML Schema Information for the Document
    XSModel schema = getGrammar();
    setupDynamicContext(schema);
    String xpath = "xs:yearMonthDuration('P2Y11M') * 2.3";
    compileXPath(xpath);
    ResultSequence rs = evaluate(domDoc);
    XSDuration result = (XSDuration) rs.first();
    String actual = result.getStringValue();
    assertEquals("P6Y9M", actual);
}
Also used : XSDuration(org.eclipse.wst.xml.xpath2.processor.internal.types.XSDuration) ResultSequence(org.eclipse.wst.xml.xpath2.processor.ResultSequence) XSModel(org.apache.xerces.xs.XSModel) XSString(org.eclipse.wst.xml.xpath2.processor.internal.types.XSString) URL(java.net.URL)

Aggregations

XSDuration (org.eclipse.wst.xml.xpath2.processor.internal.types.XSDuration)18 ResultSequence (org.eclipse.wst.xml.xpath2.api.ResultSequence)8 Collection (java.util.Collection)7 ArrayList (java.util.ArrayList)6 SeqType (org.eclipse.wst.xml.xpath2.processor.internal.SeqType)6 XSInteger (org.eclipse.wst.xml.xpath2.processor.internal.types.XSInteger)6 XSString (org.eclipse.wst.xml.xpath2.processor.internal.types.XSString)5 URL (java.net.URL)4 XSModel (org.apache.xerces.xs.XSModel)4 Item (org.eclipse.wst.xml.xpath2.api.Item)4 ResultSequence (org.eclipse.wst.xml.xpath2.processor.ResultSequence)4 BigDecimal (java.math.BigDecimal)2 Iterator (java.util.Iterator)2 Calendar (java.util.Calendar)1 GregorianCalendar (java.util.GregorianCalendar)1 Duration (javax.xml.datatype.Duration)1 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)1 ResultBuffer (org.eclipse.wst.xml.xpath2.api.ResultBuffer)1 AnyAtomicType (org.eclipse.wst.xml.xpath2.processor.internal.types.AnyAtomicType)1 AnyType (org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType)1