Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

XULRunner with Java: JavaXPCOM Tutorial 3

6 ¼ÓÔØÒ³ÃæµÄW3C DOM·ÃÎÊ
6.1 mozdom4java¿â
  ·ÃÎÊW3C DOMÊ÷±È·ÃÎÊMozillaµÄDOMÊ÷ÒªºÃ£¬ÒòΪËüÊÇÒ»¸ö¶¯Ì¬·ÃÎÊHTMLºÍXMLµÄDOMÊ÷µÄ±ê×¼¡£ÎªÁËʵÏÖÕâ¸ö£¬ÎÒÃÇʹÓôÓMozilla
DOMµ½W3C DOMµÄjava Bridge¡£ÓÐÒ»¸ö½Ð×ömozdom4javaµÄÏîÄ¿http://mozdom4java.mozdev.org/index.html¡£
  ÏÂÔØÕâ¸ö°üºó£¬ÎÒÃǰÑjar°ü·Åµ½classpathÀï¡£ÀýÈ磬ÎÒÃÇÔö¼ÓÒ»¸ö°´Å¥À´³éÈ¡HTMLÎĵµÀïµÄËùÓÐÁ´½Ó¡£
// When that button is pressed, then we obtain the HTML document corresponding to
// the URL loaded in browser. Next, we extract all its child nodes with 'a' tag name
// and print its content.
final ToolItem anchorItem = new ToolItem(toolbar, SWT.PUSH);
anchorItem.setImage(getImage("resources/anchors.png"));
anchorItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {

// First, we obtain a Mozilla DOM Document representation
nsIDOMDocument doc = browser.getDocument();

// Get all anchors from the loaded HTML document
nsIDOMNodeList nodeList = doc.getElementsByTagName("a");
for ( int i = 0; i < nodeList.getLength(); i++ ){

// Get Mozilla DOM node
nsIDOMNode mozNode = nodeList.item(i);

// Get the appropiate interface
nsIDOMHTMLAnchorElement mozAnchor =
(nsIDOMHTMLAnchorElement) mozNode.queryInterface(
nsIDOMHTMLAnchorElement.NS_IDOMHTMLANCHORELEMENT_IID);

// Get the corresponding W3C DOM node
HTMLAnchorElement a = (HTMLAnchorElement)
HTMLAnchorElementImpl.getDOMInstance(mozAnchor);


Ïà¹ØÎĵµ£º

JavaÕýÔò±í´ïʽÏê½â


Èç¹ûÄãÔø¾­ÓùýPerl»òÈÎºÎÆäËûÄÚ½¨ÕýÔò±í´ïʽ֧³ÖµÄÓïÑÔ£¬ÄãÒ»¶¨ÖªµÀÓÃÕýÔò±í´ïʽ´¦ÀíÎı¾ºÍÆ¥ÅäģʽÊǶàô¼òµ¥¡£Èç¹ûÄã²»ÊìϤÕâ¸öÊõÓÄÇô“ÕýÔò±í´ïʽ”£¨Regular Expression£©¾ÍÊÇÒ»¸ö×Ö·û¹¹³ÉµÄ´®£¬Ëü¶¨ÒåÁËÒ»¸öÓÃÀ´ËÑË÷Æ¥Åä×Ö·û´®µÄģʽ¡£
Ðí¶àÓïÑÔ£¬°üÀ¨Perl¡¢PHP¡¢Python¡¢JavaScriptºÍJScript£¬¶¼Ö§ ......

Object Ordering java ÅÅÐò

Object Ordering
A List l may be sorted as follows.
Collections.sort(l);
If the List consists of String elements, it will be sorted into alphabetical order. If it consists of Date elements, it will be sorted into chronological order. How does this happen? String and Date both implement the Compara ......

java cstÊ±Çø×ª»»


BODY { color: #000000; font-size: 9pt; font-family: ËÎÌå }
TABLE { font-size: 9pt; font-family: ËÎÌå }
SimpleDateFormat sdfy = new SimpleDateFormat("HH:mm"); 
        String tt =
"Tue Feb 09 10:43:00 CST 2010";
   &n ......

JAVAÐòÁл¯

JAVAµÄÐòÁл¯API£¬ËüÌṩÁËÒ»¸ö¿ò¼Ü£¬ÓÃÀ´½«¶ÔÏó±àÂë³ÉÒ»¸ö×Ö½ÚÁ÷£¬ÒÔ¼°´Ó×Ö½ÚÁ÷±àÂëÖÐÖØÐ¹¹½¨¶ÔÏó¡£½«Ò»¸ö¶ÔÏó±àÂë³ÉÒ»¸ö×Ö½ÚÁ÷£¬Õâ¸öÊÇÐòÁл¯¹ý³Ì£¬·´¹ýÀ´¾ÍÊÇ·¹ÐòÁл¯¡£Ò»µ©Ò»¸ö¶ÔÏó±»ÐòÁл¯ºó£¬ÔòËüµÄ±àÂë¿ÉÒÔ´ÓÒ»¸öÕýÔÚÔËÐеÄÐéÄâ»ú±»´«µÝµ½ÁíÍâÒ»¸öÐéÄâ»úÉÏ£¬»òÕß±»´æ´¢ÔÚ´ÅÅÌÉÏ£¬¹©ÒÔºó·´ÐòÁл¯Ê¹Óá£ÐòÁл¯¼¼ÊõÎªÔ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ