This week's giveaways are in the MongoDB and Jobs Discussion forums.
We're giving away four copies of Mongo DB Applied Patterns and 4 resume reviews from Five Year Itch and have the authors/reps on-line!
See this thread and this one for details.
The moose likes XML and Related Technologies and the fly likes Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply Bookmark "Exception" Watch "Exception" New topic
Author

Exception

Mary Cole
Ranch Hand

Joined: Dec 02, 2000
Posts: 362
Hi all,
Am building an XML and while paring thru JDOM am getting exception like this..So what might be the reason

org.jdom.JDOMException: Error in building: no protocol:
My XML is like this

<?xml version="1.0" encoding="UTF-8"?>
<MassC>
<AOptions>
<OOptions ALL="" UN="Y" CA="" US="Y" JP="" EU="" />
<TOptions address1="Y" />
</AOptions>
<TradeP>
<Reference>TP1</Reference>
<Reference>TradePPT</Reference>
</TradeP>
</MassC>
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Sounds like the problem isn't with the XML but the instructions your code gives to the JDom parser. Could you post the piece of code telling the parser which document to parse?


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Mary Cole
Ranch Hand

Joined: Dec 02, 2000
Posts: 362
I have built this XML using JDOM
and I convert this to a string and again pass it to JDOM
using the code below

SAXBuilder builder = new SAXBuilder();
org.jdom.Document jDomObj = builder.build(psXML);
And it throws that Exception after this line...
Pls reply urgently
pls Note-- am not using any DTD
Thx
Mary Cole
Ranch Hand

Joined: Dec 02, 2000
Posts: 362
I conver that XML into a string like this
StringBuffer loStringBuffer = new StringBuffer();
loStringBuffer.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
loStringBuffer.append(xmlOutputter.outputString(eleM));

Where eleM is my root element( which is MassC)
Thx
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Your problem is that you're trying to pass the XML document as a string into a method of which signature is build(java.lang.String systemId) and that causes the exception.
In other words, you need to doinstead of
Mary Cole
Ranch Hand

Joined: Dec 02, 2000
Posts: 362
Thx Lasse Koskela,

Hats off to u
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Exception
 
Similar Threads
Simple question for XML Gurus
One big XML file or lots of small ones
Adding attributes to an XML schema
need help with practise questions.
array of files,losing their attributes.