Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7163559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:55:23+00:00 2026-05-28T13:55:23+00:00

I ran into an error that states XPath failed due to: A sequence of

  • 0

I ran into an error that states “XPath failed due to: A sequence of more than one item is not allowed as the first argument of contains()(‘string1’, ‘string2’)” when I’m trying to use contain to find one string inside a sequence.

My code is related to resolving my other question
https://stackoverflow.com/questions/9006479/with-pmd-and-xpath-can-i-determine-if-two-node-sets-have-any-node-in-common

Expression/PrimaryExpression/PrimaryPrefix
[
contains(ancestor::ClassOrInterfaceBody/ClassOrInterfaceBodyDeclaration/FieldDeclaration/VariableDeclarator/VariableDeclaratorId/@Image,./Name/@Image)
]

I ran into this issue because VariableDeclaratorId/@Image returns two string when there are multiple fields to parse. I haven’t found solution to resolve this. I thought about using predicates, but this contains is inside of a predicate already, doing VariableDeclaratorId/@Image[./Name/@Image] wouldn’t work because this [./Name/@Image] is different from PrimaryPrefix/Name/@Image.

Expected Output:

    <Expression BeginColumn="26" BeginLine="6" EndColumn="30" EndLine="6" Image="" Label="">
        <PrimaryExpression BeginColumn="26" BeginLine="6" EndColumn="30" EndLine="6" Image="" Label="">
            <PrimaryPrefix BeginColumn="26" BeginLine="6" EndColumn="30" EndLine="6" Image="" Label="" SuperModifier="false" ThisModifier="false">
                <Name BeginColumn="26" BeginLine="6" EndColumn="30" EndLine="6" Image="m_foo" Label=""/>
            </PrimaryPrefix>
        </PrimaryExpression>
    </Expression>


    <Expression BeginColumn="26" BeginLine="7" EndColumn="30" EndLine="7" Image="" Label="">
        <PrimaryExpression BeginColumn="26" BeginLine="7" EndColumn="30" EndLine="7" Image="" Label="">
            <PrimaryPrefix BeginColumn="26" BeginLine="7" EndColumn="30" EndLine="7" Image="" Label="" SuperModifier="false" ThisModifier="false">
                <Name BeginColumn="26" BeginLine="7" EndColumn="30" EndLine="7" Image="m_two" Label=""/>
            </PrimaryPrefix>
        </PrimaryExpression>
    </Expression>

Jave Source:

public class domainFunction {
    private int m_foo; // OK

    public void bar() {  
      calculate (random);
      System.out.println(m_foo);
      System.out.println(m_two);
    }
  }

RAW XML:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <CompilationUnit BeginColumn="1" BeginLine="1" EndColumn="3" EndLine="13" Image="" Label="" declarationsAreInDefaultPackage="true">
        <TypeDeclaration BeginColumn="1" BeginLine="1" EndColumn="3" EndLine="13" Image="" Label="">
            <ClassOrInterfaceDeclaration Abstract="false" BeginColumn="8" BeginLine="1" EndColumn="3" EndLine="13" Final="false" Image="domainFunction" Interface="false" Label="" Modifiers="1" Native="false" Nested="false" PackagePrivate="false" Private="false" Protected="false" Public="true" Static="false" Strictfp="false" Synchronized="false" Transient="false" Volatile="false">
                <ClassOrInterfaceBody BeginColumn="29" BeginLine="1" EndColumn="3" EndLine="13" Image="" Label="">
                    <ClassOrInterfaceBodyDeclaration AnonymousInnerClass="false" BeginColumn="5" BeginLine="2" EndColumn="22" EndLine="2" EnumChild="false" Image="" Label="">
                        <FieldDeclaration Abstract="false" Array="false" ArrayDepth="0" BeginColumn="13" BeginLine="2" EndColumn="22" EndLine="2" Final="false" Image="" InterfaceMember="false" Label="" Modifiers="4" Native="false" PackagePrivate="false" Private="true" Protected="false" Public="false" Static="false" Strictfp="false" Synchronized="false" SyntacticallyFinal="false" SyntacticallyPublic="false" SyntacticallyStatic="false" Transient="false" VariableName="m_foo" Volatile="false">
                            <Type Array="false" ArrayDepth="0" BeginColumn="13" BeginLine="2" EndColumn="15" EndLine="2" Image="" Label="" TypeImage="int">
                                <PrimitiveType Array="false" ArrayDepth="0" BeginColumn="13" BeginLine="2" Boolean="false" EndColumn="15" EndLine="2" Image="int" Label=""/>
                            </Type>
                            <VariableDeclarator BeginColumn="17" BeginLine="2" EndColumn="21" EndLine="2" Image="" Label="">
                                <VariableDeclaratorId Array="false" ArrayDepth="0" BeginColumn="17" BeginLine="2" EndColumn="21" EndLine="2" ExceptionBlockParameter="false" Image="m_foo" Label=""/>
                            </VariableDeclarator>
                        </FieldDeclaration>
                    </ClassOrInterfaceBodyDeclaration>
                    <ClassOrInterfaceBodyDeclaration AnonymousInnerClass="false" BeginColumn="5" BeginLine="3" EndColumn="22" EndLine="3" EnumChild="false" Image="" Label="">
                        <FieldDeclaration Abstract="false" Array="false" ArrayDepth="0" BeginColumn="13" BeginLine="3" EndColumn="22" EndLine="3" Final="false" Image="" InterfaceMember="false" Label="" Modifiers="4" Native="false" PackagePrivate="false" Private="true" Protected="false" Public="false" Static="false" Strictfp="false" Synchronized="false" SyntacticallyFinal="false" SyntacticallyPublic="false" SyntacticallyStatic="false" Transient="false" VariableName="m_two" Volatile="false">
                            <Type Array="false" ArrayDepth="0" BeginColumn="13" BeginLine="3" EndColumn="15" EndLine="3" Image="" Label="" TypeImage="int">
                                <PrimitiveType Array="false" ArrayDepth="0" BeginColumn="13" BeginLine="3" Boolean="false" EndColumn="15" EndLine="3" Image="int" Label=""/>
                            </Type>
                            <VariableDeclarator BeginColumn="17" BeginLine="3" EndColumn="21" EndLine="3" Image="" Label="">
                                <VariableDeclaratorId Array="false" ArrayDepth="0" BeginColumn="17" BeginLine="3" EndColumn="21" EndLine="3" ExceptionBlockParameter="false" Image="m_two" Label=""/>
                            </VariableDeclarator>
                        </FieldDeclaration>
                    </ClassOrInterfaceBodyDeclaration>
                    <ClassOrInterfaceBodyDeclaration AnonymousInnerClass="false" BeginColumn="5" BeginLine="4" EndColumn="5" EndLine="11" EnumChild="false" Image="" Label="">
                        <MethodDeclaration Abstract="false" BeginColumn="12" BeginLine="4" EndColumn="5" EndLine="11" Final="false" Image="" InterfaceMember="false" Label="" MethodName="bar" Modifiers="1" Native="false" PackagePrivate="false" Private="false" Protected="false" Public="true" Static="false" Strictfp="false" Synchronized="false" SyntacticallyAbstract="false" SyntacticallyPublic="true" Transient="false" Void="true" Volatile="false">
                            <ResultType BeginColumn="12" BeginLine="4" EndColumn="15" EndLine="4" Image="" Label="" Void="true" returnsArray="false"/>
                            <MethodDeclarator BeginColumn="17" BeginLine="4" EndColumn="21" EndLine="4" Image="bar" Label="" ParameterCount="0">
                                <FormalParameters BeginColumn="20" BeginLine="4" EndColumn="21" EndLine="4" Image="" Label="" ParameterCount="0"/>
                            </MethodDeclarator>
                            <Block BeginColumn="23" BeginLine="4" EndColumn="5" EndLine="11" Image="" Label="" containsComment="false">
                                <BlockStatement Allocation="false" BeginColumn="7" BeginLine="5" EndColumn="22" EndLine="5" Image="" Label="">
                                    <LocalVariableDeclaration Abstract="false" Array="false" ArrayDepth="0" BeginColumn="7" BeginLine="5" EndColumn="21" EndLine="5" Final="false" Image="" Label="" Modifiers="0" Native="false" PackagePrivate="true" Private="false" Protected="false" Public="false" Static="false" Strictfp="false" Synchronized="false" Transient="false" VariableName="random" Volatile="false">
                                        <Type Array="false" ArrayDepth="0" BeginColumn="7" BeginLine="5" EndColumn="9" EndLine="5" Image="" Label="" TypeImage="int">
                                            <PrimitiveType Array="false" ArrayDepth="0" BeginColumn="7" BeginLine="5" Boolean="false" EndColumn="9" EndLine="5" Image="int" Label=""/>
                                        </Type>
                                        <VariableDeclarator BeginColumn="11" BeginLine="5" EndColumn="21" EndLine="5" Image="" Label="">
                                            <VariableDeclaratorId Array="false" ArrayDepth="0" BeginColumn="11" BeginLine="5" EndColumn="16" EndLine="5" ExceptionBlockParameter="false" Image="random" Label=""/>
                                            <VariableInitializer BeginColumn="20" BeginLine="5" EndColumn="21" EndLine="5" Image="" Label="">
                                                <Expression BeginColumn="20" BeginLine="5" EndColumn="21" EndLine="5" Image="" Label="">
                                                    <PrimaryExpression BeginColumn="20" BeginLine="5" EndColumn="21" EndLine="5" Image="" Label="">
                                                        <PrimaryPrefix BeginColumn="20" BeginLine="5" EndColumn="21" EndLine="5" Image="" Label="" SuperModifier="false" ThisModifier="false">
                                                            <Literal BeginColumn="20" BeginLine="5" CharLiteral="false" EndColumn="21" EndLine="5" FloatLiteral="false" Image="12" IntLiteral="true" Label="" SingleCharacterStringLiteral="false" StringLiteral="false"/>
                                                        </PrimaryPrefix>
                                                    </PrimaryExpression>
                                                </Expression>
                                            </VariableInitializer>
                                        </VariableDeclarator>
                                    </LocalVariableDeclaration>
                                </BlockStatement>
                                <BlockStatement Allocation="false" BeginColumn="7" BeginLine="6" EndColumn="25" EndLine="6" Image="" Label="">
                                    <Statement BeginColumn="7" BeginLine="6" EndColumn="25" EndLine="6" Image="" Label="">
                                        <StatementExpression BeginColumn="7" BeginLine="6" EndColumn="24" EndLine="6" Image="" Label="">
                                            <PrimaryExpression BeginColumn="7" BeginLine="6" EndColumn="24" EndLine="6" Image="" Label="">
                                                <PrimaryPrefix BeginColumn="7" BeginLine="6" EndColumn="15" EndLine="6" Image="" Label="" SuperModifier="false" ThisModifier="false">
                                                    <Name BeginColumn="7" BeginLine="6" EndColumn="15" EndLine="6" Image="calculate" Label=""/>
                                                </PrimaryPrefix>
                                                <PrimarySuffix ArgumentCount="1" Arguments="true" ArrayDereference="false" BeginColumn="17" BeginLine="6" EndColumn="24" EndLine="6" Image="" Label="">
                                                    <Arguments ArgumentCount="1" BeginColumn="17" BeginLine="6" EndColumn="24" EndLine="6" Image="" Label="">
                                                        <ArgumentList BeginColumn="18" BeginLine="6" EndColumn="23" EndLine="6" Image="" Label="">
                                                            <Expression BeginColumn="18" BeginLine="6" EndColumn="23" EndLine="6" Image="" Label="">
                                                                <PrimaryExpression BeginColumn="18" BeginLine="6" EndColumn="23" EndLine="6" Image="" Label="">
                                                                    <PrimaryPrefix BeginColumn="18" BeginLine="6" EndColumn="23" EndLine="6" Image="" Label="" SuperModifier="false" ThisModifier="false">
                                                                        <Name BeginColumn="18" BeginLine="6" EndColumn="23" EndLine="6" Image="random" Label=""/>
                                                                    </PrimaryPrefix>
                                                                </PrimaryExpression>
                                                            </Expression>
                                                        </ArgumentList>
                                                    </Arguments>
                                                </PrimarySuffix>
                                            </PrimaryExpression>
                                        </StatementExpression>
                                    </Statement>
                                </BlockStatement>
                                <BlockStatement Allocation="false" BeginColumn="7" BeginLine="7" EndColumn="24" EndLine="7" Image="" Label="">
                                    <Statement BeginColumn="7" BeginLine="7" EndColumn="24" EndLine="7" Image="" Label="">
                                        <StatementExpression BeginColumn="7" BeginLine="7" EndColumn="23" EndLine="7" Image="" Label="">
                                            <PrimaryExpression BeginColumn="7" BeginLine="7" EndColumn="23" EndLine="7" Image="" Label="">
                                                <PrimaryPrefix BeginColumn="7" BeginLine="7" EndColumn="15" EndLine="7" Image="" Label="" SuperModifier="false" ThisModifier="false">
                                                    <Name BeginColumn="7" BeginLine="7" EndColumn="15" EndLine="7" Image="calculate" Label=""/>
                                                </PrimaryPrefix>
                                                <PrimarySuffix ArgumentCount="1" Arguments="true" ArrayDereference="false" BeginColumn="17" BeginLine="7" EndColumn="23" EndLine="7" Image="" Label="">
                                                    <Arguments ArgumentCount="1" BeginColumn="17" BeginLine="7" EndColumn="23" EndLine="7" Image="" Label="">
                                                        <ArgumentList BeginColumn="18" BeginLine="7" EndColumn="22" EndLine="7" Image="" Label="">
                                                            <Expression BeginColumn="18" BeginLine="7" EndColumn="22" EndLine="7" Image="" Label="">
                                                                <PrimaryExpression BeginColumn="18" BeginLine="7" EndColumn="22" EndLine="7" Image="" Label="">
                                                                    <PrimaryPrefix BeginColumn="18" BeginLine="7" EndColumn="22" EndLine="7" Image="" Label="" SuperModifier="false" ThisModifier="false">
                                                                        <Name BeginColumn="18" BeginLine="7" EndColumn="22" EndLine="7" Image="m_foo" Label=""/>
                                                                    </PrimaryPrefix>
                                                                </PrimaryExpression>
                                                            </Expression>
                                                        </ArgumentList>
                                                    </Arguments>
                                                </PrimarySuffix>
                                            </PrimaryExpression>
                                        </StatementExpression>
                                    </Statement>
                                </BlockStatement>
                                <BlockStatement Allocation="false" BeginColumn="7" BeginLine="8" EndColumn="32" EndLine="8" Image="" Label="">
                                    <Statement BeginColumn="7" BeginLine="8" EndColumn="32" EndLine="8" Image="" Label="">
                                        <StatementExpression BeginColumn="7" BeginLine="8" EndColumn="31" EndLine="8" Image="" Label="">
                                            <PrimaryExpression BeginColumn="7" BeginLine="8" EndColumn="31" EndLine="8" Image="" Label="">
                                                <PrimaryPrefix BeginColumn="7" BeginLine="8" EndColumn="24" EndLine="8" Image="" Label="" SuperModifier="false" ThisModifier="false">
                                                    <Name BeginColumn="7" BeginLine="8" EndColumn="24" EndLine="8" Image="System.out.println" Label=""/>
                                                </PrimaryPrefix>
                                                <PrimarySuffix ArgumentCount="1" Arguments="true" ArrayDereference="false" BeginColumn="25" BeginLine="8" EndColumn="31" EndLine="8" Image="" Label="">
                                                    <Arguments ArgumentCount="1" BeginColumn="25" BeginLine="8" EndColumn="31" EndLine="8" Image="" Label="">
                                                        <ArgumentList BeginColumn="26" BeginLine="8" EndColumn="30" EndLine="8" Image="" Label="">
                                                            <Expression BeginColumn="26" BeginLine="8" EndColumn="30" EndLine="8" Image="" Label="">
                                                                <PrimaryExpression BeginColumn="26" BeginLine="8" EndColumn="30" EndLine="8" Image="" Label="">
                                                                    <PrimaryPrefix BeginColumn="26" BeginLine="8" EndColumn="30" EndLine="8" Image="" Label="" SuperModifier="false" ThisModifier="false">
                                                                        <Name BeginColumn="26" BeginLine="8" EndColumn="30" EndLine="8" Image="m_foo" Label=""/>
                                                                    </PrimaryPrefix>
                                                                </PrimaryExpression>
                                                            </Expression>
                                                        </ArgumentList>
                                                    </Arguments>
                                                </PrimarySuffix>
                                            </PrimaryExpression>
                                        </StatementExpression>
                                    </Statement>
                                </BlockStatement>
                                <BlockStatement Allocation="false" BeginColumn="7" BeginLine="9" EndColumn="32" EndLine="9" Image="" Label="">
                                    <Statement BeginColumn="7" BeginLine="9" EndColumn="32" EndLine="9" Image="" Label="">
                                        <StatementExpression BeginColumn="7" BeginLine="9" EndColumn="31" EndLine="9" Image="" Label="">
                                            <PrimaryExpression BeginColumn="7" BeginLine="9" EndColumn="31" EndLine="9" Image="" Label="">
                                                <PrimaryPrefix BeginColumn="7" BeginLine="9" EndColumn="24" EndLine="9" Image="" Label="" SuperModifier="false" ThisModifier="false">
                                                    <Name BeginColumn="7" BeginLine="9" EndColumn="24" EndLine="9" Image="System.out.println" Label=""/>
                                                </PrimaryPrefix>
                                                <PrimarySuffix ArgumentCount="1" Arguments="true" ArrayDereference="false" BeginColumn="25" BeginLine="9" EndColumn="31" EndLine="9" Image="" Label="">
                                                    <Arguments ArgumentCount="1" BeginColumn="25" BeginLine="9" EndColumn="31" EndLine="9" Image="" Label="">
                                                        <ArgumentList BeginColumn="26" BeginLine="9" EndColumn="30" EndLine="9" Image="" Label="">
                                                            <Expression BeginColumn="26" BeginLine="9" EndColumn="30" EndLine="9" Image="" Label="">
                                                                <PrimaryExpression BeginColumn="26" BeginLine="9" EndColumn="30" EndLine="9" Image="" Label="">
                                                                    <PrimaryPrefix BeginColumn="26" BeginLine="9" EndColumn="30" EndLine="9" Image="" Label="" SuperModifier="false" ThisModifier="false">
                                                                        <Name BeginColumn="26" BeginLine="9" EndColumn="30" EndLine="9" Image="m_two" Label=""/>
                                                                    </PrimaryPrefix>
                                                                </PrimaryExpression>
                                                            </Expression>
                                                        </ArgumentList>
                                                    </Arguments>
                                                </PrimarySuffix>
                                            </PrimaryExpression>
                                        </StatementExpression>
                                    </Statement>
                                </BlockStatement>
                                <BlockStatement Allocation="false" BeginColumn="7" BeginLine="10" EndColumn="28" EndLine="10" Image="" Label="">
                                    <Statement BeginColumn="7" BeginLine="10" EndColumn="28" EndLine="10" Image="" Label="">
                                        <StatementExpression BeginColumn="7" BeginLine="10" EndColumn="27" EndLine="10" Image="" Label="">
                                            <PrimaryExpression BeginColumn="7" BeginLine="10" EndColumn="27" EndLine="10" Image="" Label="">
                                                <PrimaryPrefix BeginColumn="7" BeginLine="10" EndColumn="10" EndLine="10" Image="" Label="this" SuperModifier="false" ThisModifier="true"/>
                                                <PrimarySuffix ArgumentCount="" Arguments="false" ArrayDereference="false" BeginColumn="11" BeginLine="10" EndColumn="20" EndLine="10" Image="calculate" Label=""/>
                                                <PrimarySuffix ArgumentCount="1" Arguments="true" ArrayDereference="false" BeginColumn="21" BeginLine="10" EndColumn="27" EndLine="10" Image="" Label="">
                                                    <Arguments ArgumentCount="1" BeginColumn="21" BeginLine="10" EndColumn="27" EndLine="10" Image="" Label="">
                                                        <ArgumentList BeginColumn="22" BeginLine="10" EndColumn="26" EndLine="10" Image="" Label="">
                                                            <Expression BeginColumn="22" BeginLine="10" EndColumn="26" EndLine="10" Image="" Label="">
                                                                <PrimaryExpression BeginColumn="22" BeginLine="10" EndColumn="26" EndLine="10" Image="" Label="">
                                                                    <PrimaryPrefix BeginColumn="22" BeginLine="10" EndColumn="26" EndLine="10" Image="" Label="" SuperModifier="false" ThisModifier="false">
                                                                        <Name BeginColumn="22" BeginLine="10" EndColumn="26" EndLine="10" Image="m_foo" Label=""/>
                                                                    </PrimaryPrefix>
                                                                </PrimaryExpression>
                                                            </Expression>
                                                        </ArgumentList>
                                                    </Arguments>
                                                </PrimarySuffix>
                                            </PrimaryExpression>
                                        </StatementExpression>
                                    </Statement>
                                </BlockStatement>
                            </Block>
                        </MethodDeclaration>
                    </ClassOrInterfaceBodyDeclaration>
                </ClassOrInterfaceBody>
            </ClassOrInterfaceDeclaration>
        </TypeDeclaration>
    </CompilationUnit>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T13:55:24+00:00Added an answer on May 28, 2026 at 1:55 pm

    I think you are using the contains() function because you have guessed incorrectly that it tests whether a set of strings contains a given string. Don’t guess, read the spec: that’s not what contains() does; rather, it tests whether one string contains another as a substring. To test whether a set of strings $S contains a string $T, use ($S = $T).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I ran into a compiler error that didn't make much sense to me: #include
I ran into this error when building my code with CLANG: In file included
I ran into an error when trying to serialize a linq entitySet. To get
Recently I ran into this error in my web application: java.lang.OutOfMemoryError: PermGen space It's
today I ran into an error and have no clue how to fix it.
I ran into unbound method error in python with this code: import random class
I ran into an interesting error with the following LiNQ query using LiNQPad and
Ran into an Out of Stack Space error trying to serialize an ASP.Net AJAX
I may have just ran into one of those wtf PHP? moments. According to
i've ran into this wierd error since few days where most of the applications/frameworks/modules

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.