문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 다음 판 | 이전 판 | ||
groovy:xml [2014/02/12 10:36] kwon37xi [Namespace] |
groovy:xml [2017/12/27 08:29] kwon37xi [XML Builder] |
||
---|---|---|---|
줄 2: | 줄 2: | ||
===== XMLParser ===== | ===== XMLParser ===== | ||
- | [[http:// | + | * [[http:// |
+ | * [[http:// | ||
==== Namespace ==== | ==== Namespace ==== | ||
[[http:// | [[http:// | ||
- | Namespace가 존재할 경우 각 노드의 이름 구조가 달라진다. '' | + | Namespace가 존재할 경우 각 노드의 이름([[http:// |
<code groovy> | <code groovy> | ||
def pom = new XmlParser().parse(new File(' | def pom = new XmlParser().parse(new File(' | ||
줄 18: | 줄 19: | ||
</ | </ | ||
+ | ===== XML Builder ===== | ||
+ | * '' | ||
+ | * '' | ||
+ | * [[https:// | ||
+ | // < | ||
+ | identity([: | ||
+ | groupId(catalog.groupId) | ||
+ | artifactId(catalog.artifactId) | ||
+ | version(catalog.version) | ||
+ | } | ||
+ | // 뒤에 ([:]) 로 호출하여 다른 메소드 시그너처로 바꿔치기함 | ||
+ | </ | ||
+ | * 혹은 '' | ||
+ | def builder = new MarkupBuilder(writer) | ||
+ | builder.message { | ||
+ | delegate.body(contentType: | ||
+ | text ' | ||
+ | } | ||
+ | } | ||
+ | // --> | ||
+ | < | ||
+ | <body contentType=' | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | ===== Pretty Print ===== | ||
+ | * [[http:// | ||
+ | <code groovy> | ||
+ | println XmlUtil.serialize(xmlDocument) // 문자열 혹은 SteramingMarkupBuilder 객체 등. | ||
+ | </ | ||
+ | ===== DOMBuilder ===== | ||
+ | * [[http:// | ||