2013年12月10日星期二

How to achieve the following functions

XML To get the root node ELEMENT root;
how to implement the following method
public NodeList get (String [] tag, String [] arg) {
......
}
such as get ({"content" "type"}, {"" "2"});

<content>
<type>2</type>
<resource>dddddd</resource>
</content>
<content>
<type>3</type>
<resource>eeeeee</resource>
</content>

------ Solution ----------------------------------- ---------
you really have a clear wood
------ Solution - -------------------------------------------

I understand that the first parameter is the label name, the second is the corresponding value
return the corresponding node list

------ Solution ------------------------------------ --------
build a Node class , which contains the tag names , attributes, values ​​, whether to include the next level , the one , then loop your array , the corresponding values ​​into them
------ For reference only ---------------------------------------
No one answered it? Still not sure I expressed
------ For reference only ------------------------------- --------


The first parameter is the label name, the second is the corresponding value
return the corresponding node list
seeking how to achieve ? Seeking a solution , or give ideas.

------ For reference only ---------------------------------- -----
nobody answered yet
------ For reference only -------------------------- -------------

I remember , there is a pattern design pattern can solve the tree problem, but I'm not familiar with , you can not solve with the idea of ?
------ For reference only -------------------------------------- -


I think of it . Is a combination of modes. . .
------ For reference only -------------------------------------- -
finally had to use Xpath resolved. But found that the efficiency is too low. . . Not a general low .

没有评论:

发表评论