Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDOM -- addProcessingInstruction doesn't work correctly with IE6

 
Mike London
Ranch Hand
Posts: 1190
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've noticed that when you add a processing instruction that points to an XSL stylesheet the way most JDOM books recommend, you end up with the processing instruction at the bottom of the JDOM-created XML file.
The basic high-level code skeleton looks like this:
makeRootElt("root");
makeJDOMDoc();
// add processing instruction to document level
addProcessingInstruction(xslSheetName);
For some reason IE 6 can't handle having the xsl processing instruction at the bottom and renders the XML File in raw mode (just the XML tree without the XSL stylesheet).
It's not until I move the xsl processing instruction underneath the main ?xml = 1.0 ... instruction at the top before it works.
I've found several posts of this problem but, so far, no solution that works for me...
Has anybody run into this problem?
I can't seem to juggle the code around so the processing instruction is created in the necessary place.
Thanks for any replies.
-- Mike
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just wrote a JDOM code yesterday, saw your question this morning. I added ProcessingInstructions to the code and it shows up on the right place. Take a look:
Q. I want to create a new XML file by using JDOM. Can you give a simple example? (With PI)
 
Mike London
Ranch Hand
Posts: 1190
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're right, it worked!!!
Thank you very, very much.
I sent the author of the Java/XML book your code which will fix his code listing as well.

- Mike
 
Mike London
Ranch Hand
Posts: 1190
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The smiley faces in my posting above were meant to be *just* smiling faces. I didn't realize they stuck their tounges out until after I saw my own posting.
Sorry about that ... <s>
-- Mike
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic