Two Laptop Bag*
The moose likes XML and Related Technologies and the fly likes XML creation error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XML creation error "The namespace prefix "ns1" was not declared."" Watch "XML creation error "The namespace prefix "ns1" was not declared."" New topic
Author

XML creation error "The namespace prefix "ns1" was not declared."

Deepa S.
Greenhorn

Joined: Aug 31, 2003
Posts: 1
Hi,

I have an xsd. I have used castor to generate the code. However during marshalling I am faced with this error

org.jdom.input.JDOMParseException: Error on line 2: The namespace prefix "ns1" was not declared.
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:466)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:769)
at com.polaris.liquidity.processing.interfaces.GCM.XercesParser.marshal(XercesParser.java:44)
at com.polaris.liquidity.processing.interfaces.GCM.GCMRequestHandler.main(GCMRequestHandler.java:82)
Caused by: org.xml.sax.SAXParseException: The namespace prefix "ns1" was not declared.
at weblogic.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1093)
at weblogic.apache.xerces.validators.common.XMLValidator.bindNamespacesToElementAndAttributes(XMLValidator.java:2662)
at weblogic.apache.xerces.validators.common.XMLValidator.callStartElement(XMLValidator.java:1145)
at weblogic.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumentScanner.java:1891)
at weblogic.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1267)
at weblogic.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:396)
at weblogic.apache.xerces.framework.XMLParser.parse(XMLParser.java:975)
at weblogic.xml.jaxp.WebLogicXMLReader.parse(WebLogicXMLReader.java:123)
at weblogic.xml.jaxp.RegistryXMLReader.parse(RegistryXMLReader.java:125)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:455)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:769)
at com.polaris.liquidity.processing.interfaces.GCM.XercesParser.marshal(XercesParser.java:44)
at com.polaris.liquidity.processing.interfaces.GCM.GCMRequestHandler.main(GCMRequestHandler.java:82.

Can someone please help me with this error.

I have two xsd's one included in the other and also have a targetnamespace defined.

Can someone help me if they have faced a similar error. Am I missing something. There is no ns1 declared anywhere in my code. Is this a default namespace taken by the system.

Regards
Deepa
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18150
    
    8

"Deepa S.", welcome to JavaRanch.

We're a friendly group, but we do require members to have valid display names.

Display names must contain your first name, a space, then your last name. Fictitious names are not allowed.

Please edit your profile and correct your display name since accounts with invalid display names will be deleted.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XML creation error "The namespace prefix "ns1" was not declared."
 
Similar Threads
using jdom to read xmlfile
Xerces 1.4.4 with JDK 1.3.1_01 schema validation problem
"Content is not allowed in prolog" issues was 6 to was7.
org.jdom.JDOMException: Error on line -1: Premature end of file.
problem with loading mapping.xml