로그인

이메일
비밀번호
DaeYoung's Blog : 위치로그 : 태그 : 방명록 : 관리자 : 새글쓰기

인터넷 예제는 대부분 XPath로 구현 되어 있어
Eclisp에서 사용하니 XPath 로 표시되는게 아닌가

JDOM2가 되면서 XPath 를 반대하기 시작했다(뭔소리??)
원문: JDOM API http://www.jdom.org/docs/apidocs/org/jd ··· ath.html
Class XPath
Deprecated. Use XPathFactory/XPathExpression/XPathBuilder instead.

어 정말이네. XPathFactory에 가보면 더 이상 확장 안한다고 한다
원문:JDOM API http://www.jdom.org/docs/apidocs/org/jd ··· ory.html
Class XPathFactory
JDOM does not extend the core Java XPath API (javax.xml.xpath.XPath).

그럼 XPath 대신 XPathFactory, XPathExpression 쓰기로 하고
다시 조사 시작


/**
  * XML Document에서 xPath에 해당 하는 모든Element을 반환한다.
  * @param doc
  * @param xPath (ex."/root/Items/Item")
  * @return List<Element>
  */
 public static List<Element> getElements(Document doc, String xPath) {
  XPathExpression<Element> compile = XPathFactory.instance().compile(
    xPath, Filters.element());
  return compile.evaluate(doc);
 }
/**
  * XML Document에서 xPath에 첫 번째Element을 반환한다.
  * @param doc
  * @param xPath
  * @return
  */
 public static Element getElement(Document doc,String xPath) {  
  org.jdom2.xpath.XPathExpression<Element> compile = XPathFactory.instance().compile(
    xPath, Filters.element());
  return compile.evaluateFirst(doc);
 }

/**
  * XML Document에서  xPath에 해당하는 Element의 Value를 변경한다.
  * @param doc
  * @param locationPath
  * @param value
  */
 public static void setXmlData(Document doc, String xPath,   String value) {

  try {  
   Element element = getElement(doc, xPath);
   if (element != null)
    element.setText(value);

  } catch (Exception e) {
   logger.debug("", e);
  }

 }

http://laedu.net/trackback/34
DaeYoung's Blog 블로그에 오신것을 환영해요^^
웹기반 프로그래밍에 관한 것들을 모을 예정이었는데..
«   2024년 09월   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30          
Javax.mail 참고 사이트.
C# TextBox KeyDown, KeyPr...
SID가 여러개 있을때 'ORA...
https://scrapingmaster.blogg...
https://scrapingmaster.blogg.. 2023년
expertdecoders.com.
expertdecoders.com 2023년
expertdecoders.
expertdecoders 2023년
best decaptcha service.
best decaptcha service 2023년
capcher.
capcher 2023년
21
108
1020391