com.sun.org.apache.xpath.internal.operations.String的目的是什么? [英] What is the purpose of com.sun.org.apache.xpath.internal.operations.String?

查看:457
本文介绍了com.sun.org.apache.xpath.internal.operations.String的目的是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个Java程序,当我尝试使用字符串时,弹出的建议是 com.sun.org.apache.xpath.internal.operations.String

I was writing a Java program, and when I tried to use a string, a suggestion that popped up was com.sun.org.apache.xpath.internal.operations.String.

什么是 com.sun.org.apache.xpath.internal.operations.String ,我什么时候应该使用它?

What is com.sun.org.apache.xpath.internal.operations.String, and when should I use it?

我在网上看过,但是我找不到文档。

I have looked online, but I cannot find the documentation.

谢谢你好!

推荐答案

你可以根据包裹名称向后工作。第一篇让我们知道它的作用的是 Xpath 。然后是Apache,它是 Apache软件基金会。所以这是一个名为Apache的Xpath API。

You can work backwards based on the package name. The first piece that gives us a clue to what it does is Xpath. Then there's Apache, which is a the Apache Software Foundation. So it's an API called Xpath from Apache.

XPath 是一种用于解析和处理XML内容的语言。它具有一些简单的功能,如数学或数据转换。在这种情况下, String 是一个将文本转换为String的一元运算符,而不是Number或boolean。它有一个静态方法操作

XPath is a language for parsing and processing XML content. It has some simple capabilities such as math or data conversions. In this case, String is a unary operator that converts text to a String, as opposed to a Number or a boolean. It has one static method operate:

public XObject operate(XObject right)
            throws TransformerException

它需要某个未知类型的XObject并将其转换为String类型。

It takes an XObject of some unknown type and converts it to a String type.

用于字符串转换的XPath示例片段最简单:

An example snippet of XPath for String conversion would be, at its barest:

string($x) //convert variable x to a String

你可能永远不需要调用它,因为它是内部包的一部分。在解释XML以将结果作为String用于其他Xpath内部组件时,最常使用它。实际上,返回的结果是 XObject ,其类型与之关联,因此将其解释为普通的Java String会破坏某些东西。知道它在那里很有帮助,并且每个设计都是 public ,但除​​非你在xpath上扩展,否则你将在现实世界中使用它API本身。

You probably would never need to call this, seeing as it is part of an internal package. It is most probably used when interpreting XML to get the result as a String for use with other Xpath internal components. Indeed, the returned result is an XObject with a type associated to it, so interpreting it as a normal Java String would break something. It is nice to helpful to know that it's there, and it is public per design, but you'd ever use this in the real world unless you're expanding on the xpath API yourself.

源包树

这篇关于com.sun.org.apache.xpath.internal.operations.String的目的是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆