PropertyEventMethod찾아보기
WebSquare.ModelUtil - 2.0_1.5225B.20170830.114414

WebSquare.ModelUtil Package

Type

engine

Property Summary

Event Summary

Method Summary

copyChildrenNodes( srcXPath , destXPath , mode )
srcXPath가 가리키는 하위노드들을 destXPath가 가리키는 하위노드들로 복사합니다.
copyNode( srcXPath , destXPath )
srcXPath에 해당하는 Node를 destXPath 에 해당하는 Node의 Child Node로 append합니다.
executeSubmission( submissionID , requestData , obj )
submissionID에 해당하는 submission을 실행시킵니다
findInstanceNode( xpath )
xpath에 해당하는 Instance 내부의 노드를 반환합니다
findInstanceNodes( xpath )
xpath에 해당하는 Instance 내부의 노드들을 배열 형태로 반환합니다
findSerializedNode( xpath )
WebSquare
getInstanceValue( xpath )
주어진 xpath에 해당하는 Instance 내부의 노드의 nodeValue를 반환합니다.
getSubmission( id )
id에 해당하는 submission 을 반환합니다
removeChildNodes( xpath )
xpath에 해당하는 부모의 childNode들을 제거합니다
removeInstanceNode( xpath )
xpath에 해당하는 node를 부모로부터 제거합니다
removeInstanceNodes( xpath )
xpath에 해당하는 여러 개의 node를 부모로 부터 제거합니다
setInstanceNode( doc , xpath , modelID , mode )
Document 혹은 Element를 Instance의 xpath에 해당하는 경로에 위치시킵니다.
setInstanceValue( xpath , value )
주어진 xpath에 해당하는 Instance 내부 노드를 찾아 nodeValue를 설정합니다

Property Detail

Event Detail

Method Detail

copyChildrenNodes( srcXPath , destXPath , mode )
srcXPath가 가리키는 하위노드들을 destXPath가 가리키는 하위노드들로 복사합니다.
이 때 mode에 따라 완전히 srcXPath의 하위노드로 replace 하는 것과 ( replaceAll )
srcXPath와 destXPath의 하위노드를 merge하는 것과 ( overwrite )
srcXPath의 하위노드와 destXPath의 하위노드 간 합집합을 구하는 것 ( append )
destXPath 하위노드에 존재하는 노드만 값을 세팅하는 것으로 나누어 집니다. ( replaceOnly )
Parameter
nametyperequireddescription
srcXPathStringY복사할 데이터의 xPath
destXPathStringY복사할 장소의 XPath
modeStringY( "replaceAll", "overwrite", "replaceOnly", "append" )
Sample
Model에 바인드된 데이터가 다음과 같다. <bookstore> <book idx="1"> <title lang="eng">Harry Potter</title> <price>29.99</price> </book> <book idx="2"> <title lang="eng">Learning XML</title> <price>39.95</price> </book> </bookstore> <selectedBook> <title lang="eng">Learning XML2</title> <price>39.952</price> <author>Erik T. Ray</author> </selectedBook> WebSquare.ModelUtil.copyChildrenNodes( "bookstore/book[@idx='2']" , "selectedBook", "replaceAll"); Model에 selectedBook 노드는 다음과 같다. <selectedBook> <title lang="eng">Learning XML</title> <price>39.95</price> </selectedBook> WebSquare.ModelUtil.copyChildrenNodes( "bookstore/book[@idx='2']" , "selectedBook", "overwrite"); <selectedBook> <title lang="eng">Learning XML</title> <price>39.95</price> <author>Erik T. Ray</author> </selectedBook> WebSquare.ModelUtil.copyChildrenNodes( "bookstore/book[@idx='2']" , "selectedBook", "append"); <selectedBook> <title lang="eng">Learning XML2</title> <price>39.952</price> <author>Erik T. Ray</author> <title lang="eng">Learning XML</title> <price>39.95</price> </selectedBook> WebSquare.ModelUtil.copyChildrenNodes( "bookstore/book[@idx='2']" , "selectedBook", "replaceOnly");
copyNode( srcXPath , destXPath )
srcXPath에 해당하는 Node를 destXPath 에 해당하는 Node의 Child Node로 append합니다.
기존의 destXPath밑에 있던 node들은 사라집니다.
Parameter
nametyperequireddescription
srcXPathStringYappend시킬 데이터의 xPath
destXPathStringYappend되는 곳의 xPath
Sample
Model에 바인드된 데이터가 다음과 같다. <bookstore> <book idx="1"> <title lang="eng">Harry Potter</title> <price>29.99</price> </book> <book idx="2"> <title lang="eng">Learning XML</title> <price>39.95</price> </book> </bookstore> WebSquare.ModelUtil.copyNode( "bookstore/book[@idx='2']" , "selectedBook"); Model에 selectedBook 노드는 다음과 같다. <selectedBook> <book idx='2'> <title lang='eng'>Learning XML</title> <price>39.95</price> </book> </selectedBook>
executeSubmission( submissionID , requestData , obj )
submissionID에 해당하는 submission을 실행시킵니다.
Parameter
nametyperequireddescription
submissionIDStringYsubmission의 아이디
requestDataObjectN요청 데이터
objObjectN전송중 disable시킬 컴퍼넌트
Sample
WebSquare.ModelUtil.executeSubmission ("submission1") ; id가 submission1인 submission을 실행.
findInstanceNode( xpath )
xpath에 해당하는 Instance 내부의 노드를 반환합니다. 여러개의 노드가 존재할 때 첫번째 노드를 반환합니다.
Parameter
nametyperequireddescription
xpathStringY반환될 instance Node의 XPath
Return
typedescription
Xml Elementxpath로 찾은 xml element
Sample
Model에 바인드된 데이터가 다음과 같다. <bookstore> <book idx="1"> <title lang="eng">Harry Potter</title> <price>29.99</price> </book> <book idx="2"> <title lang="eng">Learning XML</title> <price>39.95</price> </book> </bookstore> var xmlDoc = WebSquare.ModelUtil.findInstanceNode ("bookstore/book"); xmlDoc은 다음과 같다. <book idx="1"> <title lang="eng">Harry Potter</title> <price>29.99</price> </book>
findInstanceNodes( xpath )
xpath에 해당하는 Instance 내부의 노드들을 배열 형태로 반환합니다.
Parameter
nametyperequireddescription
xpathStringY반환될 instance Node의 XPath
Return
typedescription
Objectxpath로 찾은Document Element(node)로 이루어진 배열
Sample
Model에 바인드된 데이터가 다음과 같다. <bookstore> <book idx="1"> <title lang="eng">Harry Potter</title> <price>29.99</price> </book> <book idx="2"> <title lang="eng">Learning XML</title> <price>39.95</price> </book> </bookstore> var xmlDoc = WebSquare.ModelUtil.findInstanceNodes( "bookstore/book" ); xmlDoc.length는 2이다. xmlDoc[0] 은 다음과 같다. <book idx="1"> <title lang="eng">Harry Potter</title> <price>29.99</price> </book> xmlDoc[1] 은 다음과 같다. <book idx="2"> <title lang="eng">Learning XML</title> <price>39.95</price> </book>
findSerializedNode( xpath )
WebSquare.ModelUtil.findInstanceNode로 찾은 노드를 serialize해서 반환합니다.
Parameter
nametyperequireddescription
xpathStringY반환될 instance Node의 XPath
Return
typedescription
StringSerialize된 Document Element(node)
Sample
Model에 바인드된 데이터가 다음과 같다. <bookstore> <book idx="1"> <title lang="eng">Harry Potter</title> <price>29.99</price> </book> <book idx="2"> <title lang="eng">Learning XML</title> <price>39.95</price> </book> </bookstore> var xmlStr = WebSquare.ModelUtil.findSerializedNode ("bookstore/book"); xmlStr은 다음과 같다. <book idx="1"> <title lang="eng">Harry Potter</title> <price>29.99</price> </book>
getInstanceValue( xpath )
주어진 xpath에 해당하는 Instance 내부의 노드의 nodeValue를 반환합니다.
만약 이 노드가 element 라면 첫번째 자식노드부터 시작하여 그의 형제 노드들을 검색하는 식으로 하여
노드의 nodevalue를 찾습니다.
만약 노드가 attribute 라면 자식노드를 검색할 필요없이 바로 노드의 nodeValue를 반환합니다.
Parameter
nametyperequireddescription
xpathStringY반환될 instance Node의 XPath
Return
typedescription
Stringxpath로 찾은 노드의 value
Sample
Model에 바인드된 데이터가 다음과 같다. <bookstore> <book idx="1"> <title lang="eng">Harry Potter</title> <price>29.99</price> </book> <book idx="2"> <title lang="eng">Learning XML</title> <price>39.95</price> </book> </bookstore> var value1 = WebSquare.ModelUtil.getInstanceValue( "bookstore/book/title[@lang='eng']" ); var value2 = WebSquare.ModelUtil.getInstanceValue( "bookstore/book/title" ); var value3 = WebSquare.ModelUtil.getInstanceValue( "bookstore/book/title/@lang" ); value1, value2는 Harry Potter. value3은 eng.
getSubmission( id )
id에 해당하는 submission 을 반환합니다.
Parameter
nametyperequireddescription
idStringYsubmission의 아이디
Return
typedescription
Objectid를 통해서 찾은 submission
Sample
다음과 같이 submission이 존재하는 경우. <xf:submission id="submission1" ref="request" target="response" action="" method="" mediatype="text/xml" encoding="UTF-8" instance="" replace="instance" errorHandler="" customHandler="" mode="asynchronous" processMsg=""> </xf:submission> var sub = WebSquare.ModelUtil.getSubmission( "submission1" ); sub는 submission 객체이며 접근 방법은 다음과 같다. sub.action = "/getBookInfo.jsp"; sub.method = "get"; ...
removeChildNodes( xpath )
xpath에 해당하는 부모의 childNode들을 제거합니다.
Parameter
nametyperequireddescription
xpathStringYchildNode들을 제거할 부모의 xPath
Sample
Model에 바인드된 데이터가 다음과 같다. <bookstore> <book idx="1"> <title lang="eng">Harry Potter</title> <price>29.99</price> </book> <book idx="2"> <title lang="eng">Learning XML</title> <price>39.95</price> </book> </bookstore> WebSquare.ModelUtil.removeChildNodes("bookstore/book"); bookstore 노드는 다음과 같다. <bookstore> <book idx="1"/> <book idx="2"> <title lang="eng">Learning XML</title> <price>39.95</price> </book> </bookstore>
removeInstanceNode( xpath )
xpath에 해당하는 node를 부모로부터 제거합니다.
Parameter
nametyperequireddescription
xpathStringY제거할 node의 XPath
Sample
Model에 바인드된 데이터가 다음과 같다. <bookstore> <book idx="1"> <title lang="eng">Harry Potter</title> <price>29.99</price> </book> <book idx="2"> <title lang="eng">Learning XML</title> <price>39.95</price> </book> </bookstore> WebSquare.ModelUtil.removeInstanceNode("bookstore/book"); bookstore 노드는 다음과 같다. <bookstore> <book idx="2"> <title lang="eng">Learning XML</title> <price>39.95</price> </book> </bookstore>
removeInstanceNodes( xpath )
xpath에 해당하는 여러 개의 node를 부모로 부터 제거합니다.
Parameter
nametyperequireddescription
xpathStringY제거할 node의 xPath
Sample
Model에 바인드된 데이터가 다음과 같다. <bookstore> <book idx="1"> <title lang="eng">Harry Potter</title> <price>29.99</price> </book> <book idx="2"> <title lang="eng">Learning XML</title> <price>39.95</price> </book> </bookstore> WebSquare.ModelUtil.removeInstanceNodes("bookstore/book"); bookstore 노드는 다음과 같다. <bookstore/>
setInstanceNode( doc , xpath , modelID , mode )
Document 혹은 Element를 Instance의 xpath에 해당하는 경로에 위치시킵니다.
mode가 replace인 경우에 기존에 있던 것들을 삭제하고 새로운 노드를 추가하고
append인 경우 기존의 노드들은 놔두고 새로운 노드를 추가합니다.
mode를 명시하지 않을 경우에는 "replace" 모드입니다.
Parameter
nametyperequireddescription
docObjectYDocument 또는 Document Element(node)
xpathStringN노드를 추가할 경로. 값을 주지 않을 경우 root노드인 안에 노드가 삽입된다.
modelIDStringN노드를 추가할 경로의 Model ID(현재 사용하지 않는 옵션)
modeStringNmode ("replace", "append")
Sample
Model에 바인드된 데이터가 다음과 같다. <bookstore> <book idx="1"> <title lang="eng">Harry Potter</title> <price>29.99</price> </book> <book idx="2"> <title lang="eng">Learning XML</title> <price>39.95</price> </book> </bookstore> <selectedBook> <title lang="eng">Learning XML2</title> <price>39.952</price> <author>Erik T. Ray</author> </selectedBook> var doc = WebSquare.ModelUtil.findInstanceNode( "bookstore/book" ); WebSquare.ModelUtil.setInstanceNode( doc, "selectedBook", null , "replace" ); Model에 selectedBook 노드는 다음과 같다. <selectedBook> <book idx="1"> <title lang="eng">Harry Potter</title> <price>29.99</price> </book> </selectedBook> var doc = WebSquare.ModelUtil.findInstanceNode( "bookstore/book" ); WebSquare.ModelUtil.setInstanceNode( doc, "selectedBook", null , "append" ); <selectedBook> <title lang="eng">Learning XML2</title> <price>39.952</price> <author>Erik T. Ray</author> <book idx="1"> <title lang="eng">Harry Potter</title> <price>29.99</price> </book> </selectedBook>
setInstanceValue( xpath , value )
주어진 xpath에 해당하는 Instance 내부 노드를 찾아 nodeValue를 설정합니다.
Parameter
nametyperequireddescription
xpathStringYinstance Node의 XPath
valueStringY설정할 text value
Return
typedescription
Booleannode가 존재하지 않을 경우 false, 반영 성공 할 경우 true
Sample
Model에 바인드된 데이터가 다음과 같다. <bookstore> <book idx="1"> <title lang="eng">Harry Potter</title> <price>29.99</price> </book> <book idx="2"> <title lang="eng">Learning XML</title> <price>39.95</price> </book> </bookstore> var value1 = WebSquare.ModelUtil.setInstanceValue( "bookstore/book/title/@lang" , "kor"); var value2 = WebSquare.ModelUtil.setInstanceValue( "bookstore/book/title" , "해리포터"); value1, value2는 true. 반영된 xml Document. <bookstore> <book idx="1"> <title lang="kor">해리포터</title> <price>29.99</price> </book> <book idx="2"> .. 중략 </book> </bookstore>