You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Randy George <rk...@cadmaps.com> on 2002/04/16 18:55:59 UTC

Re: creating ProcessingInstruction

Hello,

    I am trying to add a processing instruction to a document similar to
this:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
                     "http://www.w3.org/TR/SVG/DTD/svg10.dtd">
<?xml-stylesheet href="focus.css" type="text/css"?>
<svg width="150" height="450" preserveAspectRatio="xMinYMin" viewBox="0 0
150 450"
	xmlns="http://www.w3.org/2000/svg">
			.
			.


   However I can't seem to find a way to add the ProcessingInstruction
before the svgdocument. The following approach will not work since the pi
will always be after the root svg element and only seems to work if it is
before?
			.
			.
      DOMImplementation dm = builder.getDOMImplementation();
      Document newdoc = dm.createDocument(null,"svg",null);

      ProcessingInstruction pi =
newdoc.createProcessingInstruction("xml-stylesheet","href=\"focus.css\"
type=\"text/css\"");
      newdoc.appendChild(pi);
			.
			.

  Any clues will be appreciated by the clueless :)

Thanks
Randy George
www.web-maps.com
SVG for Mapping!


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


RE: creating ProcessingInstruction

Posted by Julian Reschke <ju...@gmx.de>.
Try something like

	newdoc.insertBefore(pi, newdoc.getFirstChild())

> -----Original Message-----
> From: Randy George [mailto:rkgeorge@cadmaps.com]
> Sent: Tuesday, April 16, 2002 6:56 PM
> To: xerces-j-user@xml.apache.org
> Subject: Re: creating ProcessingInstruction 
> 
> 
> Hello,
> 
>     I am trying to add a processing instruction to a document similar to
> this:
> <?xml version="1.0" encoding="utf-8"?>
> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
>                      "http://www.w3.org/TR/SVG/DTD/svg10.dtd">
> <?xml-stylesheet href="focus.css" type="text/css"?>
> <svg width="150" height="450" preserveAspectRatio="xMinYMin" viewBox="0 0
> 150 450"
> 	xmlns="http://www.w3.org/2000/svg">
> 			.
> 			.
> 
> 
>    However I can't seem to find a way to add the ProcessingInstruction
> before the svgdocument. The following approach will not work since the pi
> will always be after the root svg element and only seems to work if it is
> before?
> 			.
> 			.
>       DOMImplementation dm = builder.getDOMImplementation();
>       Document newdoc = dm.createDocument(null,"svg",null);
> 
>       ProcessingInstruction pi =
> newdoc.createProcessingInstruction("xml-stylesheet","href=\"focus.css\"
> type=\"text/css\"");
>       newdoc.appendChild(pi);
> 			.
> 			.
> 
>   Any clues will be appreciated by the clueless :)
> 
> Thanks
> Randy George
> www.web-maps.com
> SVG for Mapping!
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org