This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception

 
Mary Cole
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Mary Cole
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thx Lasse Koskela,

Hats off to u
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic