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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:53:19+00:00 2026-06-05T00:53:19+00:00

I have the following XML document: <application xmlns=http://www.example.com/schemas/app-config/1.0 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation=http://www.example.com/schemas/app-config/1.0 http://www.example.com/schemas/app-config/1.0/app-config-1.0.xsd> <info name=Dummy Application

  • 0

I have the following XML document:

<application xmlns="http://www.example.com/schemas/app-config/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.example.com/schemas/app-config/1.0   http://www.example.com/schemas/app-config/1.0/app-config-1.0.xsd">
    <info name="Dummy Application" runningOn="Dev"/>
</application>

When I run the following code:

XPathFactory factory = XPathFactory.newInstance();
XPath xpath = factory.newXPath();
XPathExpression expr = xpath.compile("/application/info@name");

I get an XPathExpressionException on the compile method. The exception’s message is simply “null“. It looks like I’m correctly using XPath to locate the name attribute, but I’m wondering if all my XMLNS and XSI declarations are causing problems here? If not then I’m totally clueless and have no idea what’s causing this exception.

One thing – how can compile be failing before I ever associate the xpath instance with my actual Document object?!?

  • 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-05T00:53:20+00:00Added an answer on June 5, 2026 at 12:53 am

    You simply have a syntax error in the expression /application/info@name, the correct syntax is /application/info/@name. Note however that your XML sample has a default namespace so with XPath 1.0 the expression /application/info/@name does not select anything in that sample, with XPath 2.0 you would need to make sure you associate define the default namespace for the XPath evaluation. With XPath 1.0 you need to define a prefix (e.g. df) for the default namespace in your Java code and then use e.g. /df:application/df:info/@name. I am not familiar with the Java XPath API so someone else needs to help with concrete code on how to set up the namespaces with an XPathNamespaceContext or similar.

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

Sidebar

Related Questions

I have the following XML document <?xml version='1.0' encoding='UTF-8'?><entry xmlns='http://www.w3.org/2005/Atom' xmlns:gd='http://schemas.google.com/g/2005' xmlns:issues='http://schemas.google.com/projecthosting/issues/2009' gd:etag='W/DEAERH47eCl7ImA9WhZTFEQ.'><id>http://code.google.com/feeds/issues/p/chromium/issues/full/921</id><published>2008-09-03T22:51:22.000Z</published><updated>2011-03-19T01:05:05.000Z</updated><title>Incorrect rendering</title><content
I have the following XML document: <tt xmlns=http://www.w3.org/ns/ttml xmlns:tts=http://www.w3.org/ns/ttml#styling xml:lang=en> <head></head> <body> <div xml:lang=it>
I have following XML file: <?xml version=1.0 encoding=UTF-8?> <beans xmlns=http://www.springframework.org/schema/beans xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:jaxrs=http://cxf.apache.org/jaxrs xmlns:context=http://www.springframework.org/schema/context xmlns:cxf=http://cxf.apache.org/core
I have the following XML: <?xml version=1.0 encoding=UTF-8 standalone=yes?> <application xmlns=http://research.sun.com/wadl/2006/10> <doc xmlns:jersey=http://jersey.dev.java.net/ jersey:generatedBy=Jersey:
I have the following XML document <?mso-infoPathSolution name=urn:schemas-microsoft-com:office:infopath:TCM-TCP:-myXSD-2012-02-20T14-33-22 solutionVersion=1.0.0.65 productVersion=14.0.0.0 PIVersion=1.0.0.0 href=https://devcoop.oceanspray.com/sites/TCM2/FormServerTemplates/TCM-TCP.xsn?> <?mso-application progid=InfoPath.Document
I have following CDATA inside xml document: <![CDATA[ <p xmlns=>Refer to the below: <br/>
I have the following XML document: <MimeType> <Extension>.aab</Extension> <Value>application/x-authorware-</Value> </MimeType> <MimeType> <Extension>.aam</Extension> <Value>application/x-authorware-</Value> </MimeType>
I have the following XML Document (that can be redesigned if necessary) that stores
I have an XML document with a section similar to the following: <release_list> <release>
I have an xml document which consists of a number of the following: -

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.