Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Xerces 2.4 / namespace error

Reply
Thread Tools

Xerces 2.4 / namespace error

 
 
edwinek
Guest
Posts: n/a
 
      10-08-2003
While trying to migrate an application from Websphere 3.5 to Websphere
5, I encountered a weird problem. When reading an XML file into a
DOMResult object, I get the following error:

org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create
or change an object in a way which is incorrect with regard to
namespaces.
at org.apache.xml.utils.DOMBuilder.startElement(DOMBu ilder.java:354)
at org.apache.xalan.transformer.TransformerIdentityIm pl.startElement(TransformerIdentityImpl.java:1042)
at org.apache.xerces.parsers.AbstractSAXParser.startE lement(Unknown
Source)
....

The source:

import javax.xml.transform.*;
import javax.xml.transform.dom.*;
import javax.xml.transform.stream.*;

import org.apache.tools.ant.filters.*;
import org.apache.xerces.impl.*;
import org.w3c.dom.*;

....

Version version = new Version();
System.out.println("Version: "+version.getVersion());
DOMResult domResult = new DOMResult();
try {
Transformer identityTransformer =
TransformerFactory.newInstance().newTransformer();
String xml =
"<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>"
+ "<validation:config xmlns:validation=\"http://domain.nl\">"
+ " <validation:resourceManager attr=\"someattr\>"
+ "</validation:config>";

InputStream inputStream = new StringInputStream(xml);
identityTransformer.transform(new StreamSource(inputStream),
domResult);
} catch (Exception e) {
e.printStackTrace();
}

This doesn't happen using 1.x versions of Xalan and Xerces, but does
with the IBM versions and the latest versions from Apache. So it seems
to be a version 1/version 2 issue. Any ideas on how to solve this
problem?

Regards,
Edwin
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Parsing XSD Schema from namespace schemaLocation using Xerces CDT christian.eickhoff@nt.uni-saarland.de XML 1 11-21-2006 01:07 PM
java xerces xpath fails with namespace jacksu XML 18 02-27-2006 07:47 AM
Fixed/default attributes in Xerces: Namespace prefix missing?... VanOrton XML 2 11-30-2005 03:17 PM
Xerces XS*, namespace prefixes and XSIDCDefinition string selector S ML XML 0 03-24-2005 04:28 AM
Upgrade of Xalan 1.2.2 and Xerces 1.4.4 to Xalan 2.6 and Xerces 2.6.2 cvissy XML 0 11-16-2004 07:06 AM



Advertisments