[jdom-interest] About PI-Urgent

Jeelani sjeelani at infinitymarkets.com
Wed Jan 10 04:27:00 PST 2001


I have used getMixedContent to set the ProcessingInstruction and Comment,
Reason being  if I use 
	Document_Obj.addContent(ProcessingInstruction p);
	Document_Obj.addContent(Comment c);
Both PI and comment are appearing at the end of document after root element.

After setting the content using setMixedContent(),still when I try to get the root element, it is returning null;

I also have a feeling that since get/setMixedContent can contain only Root Element, PI and Comment,
it doesn't really make sense of using it when addCotent(PI) and addContent(Comment) are provided.
and I didn't get the logic behind implemetation of addContent(PI) and addContent(Comment) to append
the same at the end of document.


Element eRoot = new Element("PriceCheckResult");
Document doc = new Document(eRoot);

ProcessingInstruction process = new ProcessingInstruction("PIName","PIValue");
Comment comment = new Comment("Instance of PriceCheckResult");

List list = doc.getMixedContent();

System.out.println("-size of list "+list.size());

doc = doc.setMixedContent(list);

Element eRoot1 = doc.getRootElement();
if(eRoot1 == null)
	System.out.println("root element is null");
	System.out.println("root element is not null");


-size of list 3
[Processing Instruction: <?name value?>]
[Comment: <!--Instance of PriceCheckResult-->]
[Element: <PriceCheckResult />]
root element is null

Thanks and Regards,

More information about the jdom-interest mailing list