| 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
|
|
|
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
|
|
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
|
 |
 |
|
|
subject: Exception
|
|
|