I have some quick questions regarding XML parsing:
我有一些关于XML解析的快速问题:
- Is it possible to parse, as a Java type, specific XML elements that are positioned in various deep levels of the XML document hierarchy without having to map each ancestor element to corresponding java type and parsing it? In other words parsing a 'deep_nested_element' as DeepNestedElement.class without the need of parsing 'root_element' as Root.class?
- Is it possible to parse, as a Java type, specific XML elements that have two attributes which have equal values, in other words parsing <person name="John" nickname="John"/> and not parsing <person name="Jack" nickname="Jack The Ripper"/>?
是否有可能作为Java类型解析位于XML文档层次结构的各个深层中的特定XML元素,而不必将每个祖先元素映射到相应的java类型并解析它?换句话说,将“deep_nested_element”解析为DeepNestedElement.class而无需将“root_element”解析为Root.class?
是否可以作为Java类型解析具有两个具有相同值的属性的特定XML元素,换句话说,解析
Regards, Bonev
1 个解决方案
#1
0
Yes it is for both questions. Two links: http://docs.oracle.com/javase/1.5.0/docs/api/javax/xml/xpath/package-summary.html and http://www.w3schools.com/xpath/default.asp .
是的,这是两个问题。两个链接:http://docs.oracle.com/javase/1.5.0/docs/api/javax/xml/xpath/package-summary.html和http://www.w3schools.com/xpath/default.asp 。
#1
0
Yes it is for both questions. Two links: http://docs.oracle.com/javase/1.5.0/docs/api/javax/xml/xpath/package-summary.html and http://www.w3schools.com/xpath/default.asp .
是的,这是两个问题。两个链接:http://docs.oracle.com/javase/1.5.0/docs/api/javax/xml/xpath/package-summary.html和http://www.w3schools.com/xpath/default.asp 。