Skip to content

Add iXML support - #239

Draft
marmoure wants to merge 18 commits into
develop-7.x.xfrom
7.x.x/feature/ixml-support
Draft

marmoure wants to merge 18 commits into
develop-7.x.xfrom
7.x.x/feature/ixml-support

Conversation

@marmoure

@marmoure marmoure commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

This PR adds the fn:invisible-xml() function according to the QT4 spec - https://qt4cg.org/specifications/xpath-functions-40/Overview.html#func-invisible-xml

@cla-bot cla-bot Bot added the cla-signed label Sep 9, 2026
@codacy-production

Copy link
Copy Markdown

Not up to standards ⛔

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@marmoure
marmoure force-pushed the 7.x.x/feature/ixml-support branch from f083ffd to fe29b7c Compare September 10, 2026 10:44
@marmoure marmoure changed the title 7.x.x/feature/ixml support Add Ixml support Sep 21, 2026
@adamretter adamretter changed the title Add Ixml support Add iXML support Sep 21, 2026

@adamretter adamretter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very good so far, thank you @marmoure just some small changes and a few more tests please

@Deprecated
public static final ErrorCode FOXT0006 = W3CErrorCode.FOXT0006.errorCode;

/**

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marmoure Please removed these deprecated ones. Adding deprecated code does not make much sense to me.


public class FnInvisibleXmlTest {

// xquery version "3.1";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove all these comments!

// return $parser-fail-on($alphabit-invalid-input)

@ClassRule
public static final ExistXmldbEmbeddedServer existEmbeddedServer = new ExistXmldbEmbeddedServer(false, true, true);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As existEmbeddedServer is a static variable it should be in upper-case, i.e.: EXIST_EMBEDDED_SERVER.


@Test
public void alphabitInvalidInputFailOnError() {
assertError("FOIX0002", parseQuery(ALPHABIT_GRAMMAR, FAIL_ON_ERROR_OPTIONS, ALPHABIT_INVALID_INPUT));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please link the error code from ErrorCodes.java rather than reproducing here as a string.

private static final String FAIL_ON_ERROR_OPTIONS = "map { \"fail-on-error\": true() }";

@Test
public void dateValidInput() throws XMLDBException {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we are missing tests for NO_GRAMMAR - combined with and without options.

Comment thread exist-core/pom.xml

<dependency>
<groupId>de.bottlecaps</groupId>
<artifactId>markup-blitz</artifactId>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which version of Java does this require? Will it be compatible with Elemental 6.x.x (JDK 8)?

Comment thread exist-core/pom.xml
@@ -584,6 +584,12 @@
<!-- scope>test</scope --> <!-- not just test scope, as needed for org.exist.test -->

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to update the license plugin file details in exist-core/pom.xml please

private static final StringValue FAIL_ON_ERROR_KEY = new StringValue("fail-on-error");

@Nullable
final Either<StringValue, Element> grammar;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment, grammar can not be null, only its left value could be null.

What we really have in the code at the moment is:

final Either<@Nullable StringValue, Element> grammar;

I think it might be better to change the code so that grammar can be null, and the left or right value is never null please.

final String input = inputArg.getStringValue();

final String ixmlGrammar;
if (grammar == null) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure that grammar can be null?

try (final StringBuilderWriter writer = new StringBuilderWriter()) {
final XQuerySerializer xqSerializer = new XQuerySerializer(
context.getBroker(), new Properties(), writer);
xqSerializer.serialize((Sequence) grammar.right().get());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would serialization be avoidable if we used CoffeePot instead of Blitz?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants