org.exolab.castor.xml.util.XMLFieldDescriptorImpl.setLocationPath()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(1.6k)|赞(0)|评价(0)|浏览(85)

本文整理了Java中org.exolab.castor.xml.util.XMLFieldDescriptorImpl.setLocationPath()方法的一些代码示例,展示了XMLFieldDescriptorImpl.setLocationPath()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLFieldDescriptorImpl.setLocationPath()方法的具体详情如下:
包路径:org.exolab.castor.xml.util.XMLFieldDescriptorImpl
类名称:XMLFieldDescriptorImpl
方法名:setLocationPath

XMLFieldDescriptorImpl.setLocationPath介绍

[英]Sets the location path for the field being described.

In most cases, this isn't needed. However sometimes a field may be mapped to a nested element. In which case the value of the location path should be the nested element name. If more than one level of nesting is needed each nested element name should be separated by a path separator (forward slash '/').

The location path name is "relative" to the parent Class. The name of the parent should not be included in the path.

For example, give the following two classes: class Root { Bar bar; } class Bar { String value; } And the following XML: <root> <foo> <bar> value of bar </bar> </foo> </root> Since foo has no associated class, the path for 'bar' would be: "foo"
[中]设置所描述字段的位置路径。
在大多数情况下,这是不必要的。但是,有时字段可能会映射到嵌套元素。在这种情况下,位置路径的值应该是嵌套的元素名。如果需要多个嵌套级别,则每个嵌套元素名称应使用路径分隔符(正斜杠“/”分隔)。
位置路径名与父类“相对”。路径中不应包含父级的名称。
例如,给出以下两个类:class Root { Bar bar; } class Bar { String value; }和以下XML:<root> <foo> <bar> value of bar </bar> </foo> </root>,因为foo没有关联的类,“bar”的路径是:“foo”

代码示例

代码示例来源:origin: org.codehaus.castor/castor-xml

xmlDesc.setLocationPath(xml.getLocation());

代码示例来源:origin: org.codehaus.castor/com.springsource.org.castor

xmlDesc.setLocationPath(xml.getLocation());

相关文章