This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Java & XML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Java & XML" Watch "Java & XML" New topic

Java & XML

Ed Berrey

Joined: Apr 23, 2004
Posts: 6
Error is: no protocol: <?xml version="1.0"?>

Code used is:
try {
factory = SAXParserFactory.newInstance();
saxParser = factory.newSAXParser();
} catch (Exception e) {
System.out.println("In ShipmentTrackingAction.execute - " + e);
try {
handler = new DefaultHandler() {
boolean Shipment_ = false;
public void startElement(String uri, String localName, String qName, Attributes attributes)
throws SAXException {
if (qName.equalsIgnoreCase("Shipment")) {
Shipment_ = true;

public void characters(char ch[], int start, int length) throws SAXException {
if (Shipment_) {
System.out.println("Shipment: ");
parsedResponse.append("Shipment: ");
Shipment_ = false;
saxParser.parse(dhlResponse, handler);
} catch (Exception e) {
System.out.println("In ShipmentTrackingAction.dhlParser - " + e);
//return parsedResponse.toString();
return parsedResponse.toString();

XML trying to parse starts like this:
<?xml version="1.0"?>
<ECommerce version="1.1" action="Response" timestamp="2005/08/18T12:35:54" transmission_reference="E14D4E8C">

Stack trace is:<init>( Code))<init>( Compiled Code))<init>( Compiled Code))
org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
javax.xml.parsers.SAXParser.parse(Unknown Source)
javax.xml.parsers.SAXParser.parse(Unknown Source)
Jason Menard

Joined: Nov 09, 2000
Posts: 6450
You haven't actually asked a question, but I'll assume you are looking for help in why your code is erroring out. Unless I'm missing something, the XML and Related Technologies forum seems like a better place for this thread, so I'll see if I can have it moved there.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15302


GenRocket - Experts at Building Test Data
DW Bolton

Joined: Jun 29, 2005
Posts: 28
Already answered same cross-post in this forum:
SAXParser and Malformed URL Exception
I agree. Here's the link:
subject: Java & XML
jQuery in Action, 3rd edition