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 7941537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:42:06+00:00 2026-06-03T23:42:06+00:00

Below is the XML file – <Chapters> <Chapter> <Name>Introduction</Name> <Heads> <Head> <No>1</No> <Title>History of

  • 0

Below is the XML file –

<Chapters>
  <Chapter>
    <Name>Introduction</Name>
    <Heads>
       <Head>
         <No>1</No>
         <Title>History of Internet</Title>
         <Desc>
         ..............
         </Desc>    
      </Head>
      <Head>
         <No>2</No>
         <Title>History of HTML</Title>
         <Desc>
         ..............
         </Desc>    
      </Head>
    </Heads>
  </Chapter>
  <Chapter>
    <Name>Learn HTML</Name>
    <Heads>
      <Head>
         <No>1</No>
         <Title>Browsers</Title>
         <Desc>
         ..............
         </Desc>    
     </Head>
     <Head>
         <No>2</No>
         <Title>Browser War</Title>
         <Desc>
         ..............
         </Desc>    
     </Head>
     <Head>
         <No>3</No>
         <Title>HTML, DHTML</Title>
         <Desc>
         ..............
         </Desc>    
      </Head>
    </Heads>
  </Chapter>
</Chapters>

I want to list the Chapters/Chapter/Name=Introduction and Chapters/Chapter/Heads/Head/No=1
Following is the query which I am executing in baseX –

/Chapters/Chapter[contains(Name,’Introduction’) and contains(Heads/Head/No,’1′)]/Heads/Head/Title

And this is the error –

Query: Chapters/Chapter[contains(Name,'Introduction') and contains(Heads/Head/No,'1')]/Heads/Head/Title

Error: [XPTY0004] Single item expected, (element No { ... }, element No { ... }) found.

As per the baseX website, description of the Error XPTY0004 is –

This error is raised if an expression has the wrong type, or cannot be cast into the specified type. It may be raised both statically (during query compilation) or dynamically (at runtime).

What wrong m i doing??

  • 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-06-03T23:42:07+00:00Added an answer on June 3, 2026 at 11:42 pm

    This one would solve the purpose

    /Chapters/Chapter[Name='Introduction']/Heads/Head[No='1']/Title
    

    but I cant answer your question… ie I cant explain why your query resulted in error!!

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

Sidebar

Related Questions

Below is my XML File - <CVs> <CV> <Name>ABC</Name> <Address></Address> <Introduction></Introduction> <CompSkills>Java, XSLT, XPATH,
Below is the XML file - <Continents> <Continent n=Asia> <Country n=Thailand> <City> <Name>Bangkok</Name> <Desc>Capital
I have an xml file likes below. <?xml version=1.0 encoding=utf-8 ?> <Book> <Title>Title</Title> <Content>Content</Content>
I'm traversing an xml file as below: <?xml version=1.0 encoding=ISO-8859-1?> <wrapper> <site base=http://www.example1.co.uk/ name=example
Below is my XML File - <School> <Std c=8> <Name>ABC</Name> <Age>12</Age> <Name>EFG</Name> <Age>11</Age> <Name>PQR</Name>
I am trying to read the below xml file and get the name-value pairs
Below is my xml file called product.xml <products> <product> <name>Pen</name> <price>8</price> </product> <product> <name>Bag</name>
A test sample of my xml file is shown below: test.xml <feed> <entry> <title>Link
One of my application is generating below XML file. <root> <command name=Set> <property name=PWR.WakeupOnLAN
Below is the XML file - <Seminars> <Seminar> <Venue P=ABC dt=20111223/> <Subject name=Finance> <Topic

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.