Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within XML
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
XML and Related Technologies
The prefix "xml" cannot be bound to any namespace
Maha Hassan
Ranch Hand
Posts: 133
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
hi,
i am trying to open a schema as if it is an xml file and retrieve everything in it. but when i run i get this error
[Fatal Error] test.xml:3:59: The prefix "xml" cannot be bound to any namespace o ther than its usual namespace; neither can the namespace for "xml" be bound to a ny prefix other than "xml". javax.xml.xpath.XPathExpressionException Press any key to continue...
My code is :
import javax.xml.xpath.*; import javax.xml.*; import javax.xml.xpath.XPathConstants; import org.xml.sax.InputSource; import org.w3c.dom.NodeList; import org.w3c.dom.Node; public class test{ public static void main (String args[]){ String stmtExpr="//*"; XPath xpath = XPathFactory.newInstance().newXPath(); try{ InputSource inputSource = new InputSource("test.xml"); NodeList l = (NodeList) xpath.evaluate(stmtExpr, inputSource, XPathConstants.NODESET); for(int i =0;i<l.getLength(); i++){ System.out.println(l.item(i).getTextContent()); } }catch(Exception e){ System.out.println(e); } } }
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Seems to me that error indicates that the schema is badly formatted - where did it come from?
Bill
Maha Hassan
Ranch Hand
Posts: 133
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
it is an example for schema..i will try to run it on a software like altova or something and tell u
thanks
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
java.lang.ClassCastException:
Getting the result from xpath+using interfaces
Updating XML values
Please help in XPath to parse XML with namespace
selectNodeIterator() problem
More...