kr.co.hit.live.util.xml
Class XmlDocument

java.lang.Object
  extended by kr.co.hit.live.util.xml.XmlDocument

public class XmlDocument
extends Object

XML 문서 처리 기능을 제공하는 클래스이다.

Since:
3.0
Author:
김형도

Constructor Summary
XmlDocument()
           비어있는 Document를 생성한다.
XmlDocument(File file)
           File로 주어진 XML 파일로부터 Document를 생성한다.
XmlDocument(File file, boolean validate)
           File로 주어진 XML 파일로부터 Document를 생성한다.
XmlDocument(File file, String pid, InputStream dtd)
          File로 주어진 XML 파일로부터 Document를 생성한다.
XmlDocument(InputStream is)
           InpusStream로 주어진 XML 파일로부터 Document를 생성한다.
XmlDocument(InputStream is, boolean validate)
           InpusStream로 주어진 XML 파일로부터 Document를 생성한다.
XmlDocument(InputStream is, String pid, InputStream dtd)
           
 
Method Summary
 Node getCurrentNode()
           마지막으로 입력되었거나 참조된 XML Node를 리턴한다.
 Document getDocument()
           
 Node getParentNode()
           마지막으로 입력되었거나 참조된 XML Node(currentNode)의 상위 Node를 리턴하고, currentNode를 상위 Node로 지정한다.
 String getPublicId()
           
 Element getRootElement()
          Document의 최상의 Element 로 currentNode를 이동하고, 이를 리턴한다.
 String getSystemId()
           
 Element insertElement(String id)
           새로운 Elemenet를 생성하여 currentNode의 하위에 넣는다.
 Element insertElement(String id, String text)
           하위에 문자열을 가지는 새로운 Elemenet를 생성하여 currentNode의 하위에 넣는다.
 Text insertText(String text)
           지정한 문자열을 currentNode의 하위에 넣는다.
 boolean isValid()
          XMLDocument 가 올바르게 초기화 되었는지 여부를 리턴한다.
 void normalize()
           
 void setPublicId(String id)
           
 void setSystemId(String id)
           
 void write(File file)
           지정한 파일로 XML을 출력한다.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlDocument

public XmlDocument()

비어있는 Document를 생성한다.


XmlDocument

public XmlDocument(InputStream is)

InpusStream로 주어진 XML 파일로부터 Document를 생성한다.


XmlDocument

public XmlDocument(InputStream is,
                   boolean validate)

InpusStream로 주어진 XML 파일로부터 Document를 생성한다. XML 파싱 시 DTD validating 여부를 지정한다.

Parameters:
validate - DTD validation 여부

XmlDocument

public XmlDocument(InputStream is,
                   String pid,
                   InputStream dtd)

XmlDocument

public XmlDocument(File file)

File로 주어진 XML 파일로부터 Document를 생성한다.


XmlDocument

public XmlDocument(File file,
                   boolean validate)

File로 주어진 XML 파일로부터 Document를 생성한다. XML 파싱 시 DTD validating 여부를 지정한다.

Parameters:
validate - DTD validation 여부

XmlDocument

public XmlDocument(File file,
                   String pid,
                   InputStream dtd)
File로 주어진 XML 파일로부터 Document를 생성한다. DTD validation을 수행하며 이때 사용할 DTD를 InputStream으로 제공한다.

Parameters:
file -
validate -
pid -
dtd -
Method Detail

isValid

public boolean isValid()
XMLDocument 가 올바르게 초기화 되었는지 여부를 리턴한다.

Returns:

insertElement

public Element insertElement(String id)

새로운 Elemenet를 생성하여 currentNode의 하위에 넣는다.

Parameters:
id - 생성될 Element의 ID

insertElement

public Element insertElement(String id,
                             String text)

하위에 문자열을 가지는 새로운 Elemenet를 생성하여 currentNode의 하위에 넣는다.

Parameters:
id - 생성될 Element의 ID
text - Element 하위에 들어갈 문자열
Returns:
Element 생성된 Element

insertText

public Text insertText(String text)

지정한 문자열을 currentNode의 하위에 넣는다.

Parameters:
text - 입력할 문자열

write

public void write(File file)

지정한 파일로 XML을 출력한다.

Parameters:
file - 출력할 파일

setSystemId

public void setSystemId(String id)

setPublicId

public void setPublicId(String id)

getSystemId

public String getSystemId()

getPublicId

public String getPublicId()

normalize

public void normalize()

getDocument

public Document getDocument()

getRootElement

public Element getRootElement()
Document의 최상의 Element 로 currentNode를 이동하고, 이를 리턴한다.

Returns:

getCurrentNode

public Node getCurrentNode()

마지막으로 입력되었거나 참조된 XML Node를 리턴한다.


getParentNode

public Node getParentNode()

마지막으로 입력되었거나 참조된 XML Node(currentNode)의 상위 Node를 리턴하고, currentNode를 상위 Node로 지정한다.



Copyright © 2014. All Rights Reserved.