From 82a88836b7ba1835d63e739e792e9e39867f9fe5 Mon Sep 17 00:00:00 2001 From: Adam Retter Date: Mon, 17 Jun 2024 21:59:29 +0200 Subject: [PATCH] Use the latest expath-parent dependency --- pom.xml | 2 +- .../java/org/expath/tools/saxon/fun/Return.java | 2 +- src/main/java/org/expath/tools/saxon/fun/Types.java | 3 ++- .../expath/tools/saxon/model/SaxonAttribute.java | 3 ++- .../org/expath/tools/saxon/model/SaxonElement.java | 13 ++++--------- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index 606d5f5..167ab2d 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.expath expath-parent - 1.6.2 + 1.7.0 diff --git a/src/main/java/org/expath/tools/saxon/fun/Return.java b/src/main/java/org/expath/tools/saxon/fun/Return.java index bf9e5c2..0d4c7c9 100644 --- a/src/main/java/org/expath/tools/saxon/fun/Return.java +++ b/src/main/java/org/expath/tools/saxon/fun/Return.java @@ -164,7 +164,7 @@ public static Sequence dateTime(Calendar dt, boolean tz) if ( dt == null ) { return empty(); } - return new DateTimeValue(dt, tz); + return DateTimeValue.fromCalendar(dt, tz); } public static Sequence date(Date date) diff --git a/src/main/java/org/expath/tools/saxon/fun/Types.java b/src/main/java/org/expath/tools/saxon/fun/Types.java index b280fc5..8c4efee 100644 --- a/src/main/java/org/expath/tools/saxon/fun/Types.java +++ b/src/main/java/org/expath/tools/saxon/fun/Types.java @@ -11,6 +11,7 @@ import net.sf.saxon.expr.StaticProperty; import net.sf.saxon.om.NamePool; +import net.sf.saxon.om.NamespaceUri; import net.sf.saxon.om.StructuredQName; import net.sf.saxon.pattern.AnyNodeTest; import net.sf.saxon.pattern.NameTest; @@ -262,7 +263,7 @@ public SequenceType severalElement(String local, Processor saxon) private SequenceType element(int occurrence, String local, Processor saxon) { final int kind = Type.ELEMENT; - final String uri = myLib.getNamespace(); + final NamespaceUri uri = NamespaceUri.of(myLib.getNamespace()); final NamePool pool = saxon.getUnderlyingConfiguration().getNamePool(); final ItemType itype = new NameTest(kind, uri, local, pool); return SequenceType.makeSequenceType(itype, occurrence); diff --git a/src/main/java/org/expath/tools/saxon/model/SaxonAttribute.java b/src/main/java/org/expath/tools/saxon/model/SaxonAttribute.java index 2074ebc..7cf9314 100644 --- a/src/main/java/org/expath/tools/saxon/model/SaxonAttribute.java +++ b/src/main/java/org/expath/tools/saxon/model/SaxonAttribute.java @@ -10,6 +10,7 @@ package org.expath.tools.saxon.model; import net.sf.saxon.om.NodeInfo; +import net.sf.saxon.str.StringView; import net.sf.saxon.trans.XPathException; import net.sf.saxon.value.AtomicValue; import net.sf.saxon.value.BooleanValue; @@ -56,7 +57,7 @@ public boolean getBoolean() String str = myNode.getStringValue(); AtomicValue val; try { - val = BooleanValue.fromString(str).asAtomic(); + val = BooleanValue.fromString(StringView.of(str)).asAtomic(); } catch ( XPathException ex ) { throw new ToolsException("Error parse the attribute value as boolean", ex); diff --git a/src/main/java/org/expath/tools/saxon/model/SaxonElement.java b/src/main/java/org/expath/tools/saxon/model/SaxonElement.java index 4c2fad8..5ee0dc5 100644 --- a/src/main/java/org/expath/tools/saxon/model/SaxonElement.java +++ b/src/main/java/org/expath/tools/saxon/model/SaxonElement.java @@ -13,12 +13,7 @@ import java.util.Iterator; import javax.xml.namespace.QName; import net.sf.saxon.expr.XPathContext; -import net.sf.saxon.om.AxisInfo; -import net.sf.saxon.om.NamePool; -import net.sf.saxon.om.NamespaceResolver; -import net.sf.saxon.om.NodeInfo; -import net.sf.saxon.om.SequenceIterator; -import net.sf.saxon.om.StructuredQName; +import net.sf.saxon.om.*; import net.sf.saxon.pattern.NameTest; import net.sf.saxon.pattern.NamespaceTest; import net.sf.saxon.pattern.NodeKindTest; @@ -76,7 +71,7 @@ public String getAttribute(String local_name) { // get the attribute NamePool pool = myNode.getConfiguration().getNamePool(); - NodeTest pred = new NameTest(Type.ATTRIBUTE, "", local_name, pool); + NodeTest pred = new NameTest(Type.ATTRIBUTE, NamespaceUri.NULL, local_name, pool); AxisIterator attrs = myNode.iterateAxis(AxisInfo.ATTRIBUTE, pred); NodeInfo a = (NodeInfo) attrs.next(); // return its string value, or null if there is no such attribute @@ -99,7 +94,7 @@ public Iterable attributes() public boolean hasNoNsChild() { NamePool pool = myNode.getConfiguration().getNamePool(); - NodeTest no_ns_pred = new NamespaceTest(pool, Type.ELEMENT, ""); + NodeTest no_ns_pred = new NamespaceTest(pool, Type.ELEMENT, NamespaceUri.NULL); NodeInfo next = myNode.iterateAxis(AxisInfo.CHILD, no_ns_pred).next(); return next != null; } @@ -170,7 +165,7 @@ public Iterable children() public Iterable children(String ns) { NamePool pool = myNode.getConfiguration().getNamePool(); - NodeTest pred = new NamespaceTest(pool, Type.ELEMENT, ns); + NodeTest pred = new NamespaceTest(pool, Type.ELEMENT, NamespaceUri.of(ns)); AxisIterator it = myNode.iterateAxis(AxisInfo.CHILD, pred); return new ElemIterable(it); }