OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Adding PI in XML Document

[ Lists Home | Date Index | Thread Index ]

 Hi All,

 How to add stylesheet processing intstruction in a xml document which is
generated by DOM.

 Here is the code am trying 

             String data = "type=\"text/xsl\" href=\"cdcatalog.xsl\"";
	 ProcessingInstruction pi =
doc.createProcessingInstruction("xml-stylesheet",data); 
  	doc.appendChild( pi );	

 But when I write to a file after finishing no pi appeares in xml document.

 When I tried with following code..

             String data = "type=\"text/xsl\" href=\"cdcatalog.xsl\"";
	 ProcessingInstruction pi =
doc.createProcessingInstruction("xml-stylesheet",data); 
             root.insertBefore((Node)pi,root.getFirstChild());

 Then I found the following in xml document
            <?xml version="1.0" ?>
             <root>
 	<?xml-stylesheet type="text/xsl" href="cdcatalog.xsl"?>
	.....
	</root>

 But I want to generate like 

            <?xml version="1.0" ?>
 	<?xml-stylesheet type="text/xsl" href="cdcatalog.xsl"?>
             <root>
	.....
	</root>


 TIA,
 Samba
************************************************************************** 
This email (including any attachments) is intended for the sole use of the
intended recipient/s and may contain material that is CONFIDENTIAL AND
PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or
distribution or forwarding of any or all of the contents in this message is
STRICTLY PROHIBITED. If you are not the intended recipient, please contact
the sender by email and delete all copies; your cooperation in this regard
is appreciated.
**************************************************************************




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS