org.eclipse.ohf.stem.ui.ge.kml
Class KmlDoc

java.lang.Object
  extended by org.eclipse.ohf.stem.ui.ge.kml.KmlDoc

public class KmlDoc
extends java.lang.Object

Utility class used for Google Earth KML support. This class is used to build a KML file to be passed to Google Earth. It basically creates an XML file using KML related arguments. See the example in the "main()" method for an example of how to use the class.


Constructor Summary
KmlDoc()
          Construct an instance of KmlDoc.
 
Method Summary
 org.w3c.dom.Element appendAttr(org.w3c.dom.Element element, java.lang.String tag, boolean value)
          Utility method to Create an element that has a name and boolean value only.
 org.w3c.dom.Element appendCDATA(org.w3c.dom.Element element, java.lang.String tag, java.lang.String value)
          Utility method to append an element that has a name and CData value only.
 org.w3c.dom.Element appendElement(org.w3c.dom.Element element, java.lang.String tag)
          Utility method to append an element that has no values.
 org.w3c.dom.Element appendText(org.w3c.dom.Element element, java.lang.String tag, java.lang.String value)
          Utility method to Create an element that has a name and Text value only.
static org.w3c.dom.Element createAttr(org.w3c.dom.Document doc, java.lang.String tag, java.lang.String value)
          Utility method to Create an element that has a name and value only.
 void debug(java.lang.String msg)
          debug output method
 void debug(java.lang.String method, java.lang.String msg)
          debug output method
 void debug(java.lang.String msg, java.lang.Throwable t)
          debug output method
 void debug(java.lang.Throwable t)
          debug output method
 void display()
          Display the current Kml document on stdOut.
 org.w3c.dom.Document getDocument()
           
static void main(java.lang.String[] args)
          main class used for debug
 void setDocument(org.w3c.dom.Document _doc)
           
 org.w3c.dom.Element setRoot(java.lang.String xmlns)
          Setup the root of the KML document.
 void write(java.io.OutputStream os)
          Write an Xml document to an outputStream
 void writeFile(java.lang.String xmlFileName_)
          Write an Xml document to an outputStream
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KmlDoc

public KmlDoc()
Construct an instance of KmlDoc. The Document object is created but nothing is put into it.

Method Detail

setRoot

public org.w3c.dom.Element setRoot(java.lang.String xmlns)
Setup the root of the KML document.

Parameters:
xmlns - Value for xmlns (if null, use default "http://earth.google.com/kml/2.0")
Returns:
xml element

writeFile

public void writeFile(java.lang.String xmlFileName_)
Write an Xml document to an outputStream

Parameters:
xmlFileName_ -

write

public void write(java.io.OutputStream os)
Write an Xml document to an outputStream

Parameters:
os - Allocated output Stream

display

public void display()
Display the current Kml document on stdOut.
*


debug

public void debug(java.lang.String msg)
debug output method

Parameters:
msg -

debug

public void debug(java.lang.String method,
                  java.lang.String msg)
debug output method

Parameters:
method -
msg -

debug

public void debug(java.lang.Throwable t)
debug output method

Parameters:
t -

debug

public void debug(java.lang.String msg,
                  java.lang.Throwable t)
debug output method

Parameters:
msg -
t -

getDocument

public org.w3c.dom.Document getDocument()
Returns:
Returns the _doc.

setDocument

public void setDocument(org.w3c.dom.Document _doc)
Parameters:
_doc - The _doc to set.

createAttr

public static org.w3c.dom.Element createAttr(org.w3c.dom.Document doc,
                                             java.lang.String tag,
                                             java.lang.String value)
Utility method to Create an element that has a name and value only.
 There is probably a better way to do this but ...
  
   
   
 * @param doc Document

Parameters:
tag - xml tag
value - string value of tag
Returns:
XML element

appendElement

public org.w3c.dom.Element appendElement(org.w3c.dom.Element element,
                                         java.lang.String tag)
Utility method to append an element that has no values.
     
  Creates an XML tag and
  places it in the document as a child of the 
  specified element.
  
   Creates value 
 

Parameters:
element - existing element where new tag is to go
tag - XML tag
Returns:
XML element

appendText

public org.w3c.dom.Element appendText(org.w3c.dom.Element element,
                                      java.lang.String tag,
                                      java.lang.String value)
Utility method to Create an element that has a name and Text value only.
     
  Creates an XML tag with a text value  and
  places it in the document as a child of the 
  specified element.
   Creates value 
 

Parameters:
element - existing element where new tag is to go
tag - XML tag
value - value of tag
Returns:
XML element

appendCDATA

public org.w3c.dom.Element appendCDATA(org.w3c.dom.Element element,
                                       java.lang.String tag,
                                       java.lang.String value)
Utility method to append an element that has a name and CData value only.
 
  
   value of tag with  html in it
 

Parameters:
element - existing element where new tag is to go
tag - XML tag
value - value of tag
Returns:
XML element

appendAttr

public org.w3c.dom.Element appendAttr(org.w3c.dom.Element element,
                                      java.lang.String tag,
                                      boolean value)
Utility method to Create an element that has a name and boolean value only.
 
  1 or 0
   
 

Parameters:
doc - root document
element - existing element where new tag is to go
tag - XML tag
value - true or false
Returns:
XML element

main

public static void main(java.lang.String[] args)
main class used for debug

Parameters:
args -