本文整理汇总了C#中org.getText方法的典型用法代码示例。如果您正苦于以下问题:C# org.getText方法的具体用法?C# org.getText怎么用?C# org.getText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org
的用法示例。
在下文中一共展示了org.getText方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: readThisValueXml
/// <exception cref="org.xmlpull.v1.XmlPullParserException"></exception>
/// <exception cref="System.IO.IOException"></exception>
private static object readThisValueXml(org.xmlpull.v1.XmlPullParser parser, string
[] name)
{
string valueName = parser.getAttributeValue(null, "name");
string tagName = parser.getName();
//System.out.println("Reading this value tag: " + tagName + ", name=" + valueName);
object res;
if (tagName.Equals("null"))
{
res = null;
}
else
{
if (tagName.Equals("string"))
{
string value = string.Empty;
int eventType;
while ((eventType = parser.next()) != org.xmlpull.v1.XmlPullParserClass.END_DOCUMENT
)
{
if (eventType == org.xmlpull.v1.XmlPullParserClass.END_TAG)
{
if (parser.getName().Equals("string"))
{
name[0] = valueName;
//System.out.println("Returning value for " + valueName + ": " + value);
return value;
}
throw new org.xmlpull.v1.XmlPullParserException("Unexpected end tag in <string>: "
+ parser.getName());
}
else
{
if (eventType == org.xmlpull.v1.XmlPullParserClass.TEXT)
{
value += parser.getText();
}
else
{
if (eventType == org.xmlpull.v1.XmlPullParserClass.START_TAG)
{
throw new org.xmlpull.v1.XmlPullParserException("Unexpected start tag in <string>: "
+ parser.getName());
}
}
}
}
throw new org.xmlpull.v1.XmlPullParserException("Unexpected end of document in <string>"
);
}
else
{
if (tagName.Equals("int"))
{
res = System.Convert.ToInt32(parser.getAttributeValue(null, "value"));
}
else
{
if (tagName.Equals("long"))
{
res = long.Parse(parser.getAttributeValue(null, "value"));
}
else
{
if (tagName.Equals("float"))
{
res = System.Convert.ToSingle(parser.getAttributeValue(null, "value"));
}
else
{
if (tagName.Equals("double"))
{
res = System.Convert.ToDouble(parser.getAttributeValue(null, "value"));
}
else
{
if (tagName.Equals("boolean"))
{
res = bool.Parse(parser.getAttributeValue(null, "value"));
}
else
{
if (tagName.Equals("int-array"))
{
parser.next();
res = readThisIntArrayXml(parser, "int-array", name);
name[0] = valueName;
//System.out.println("Returning value for " + valueName + ": " + res);
return res;
}
else
{
if (tagName.Equals("map"))
{
parser.next();
res = readThisMapXml(parser, "map", name);
name[0] = valueName;
//System.out.println("Returning value for " + valueName + ": " + res);
//.........这里部分代码省略.........
示例2: readValueXml
/// <summary>Read a flattened object from an XmlPullParser.</summary>
/// <remarks>
/// Read a flattened object from an XmlPullParser. The XML data could
/// previously have been written with writeMapXml(), writeListXml(), or
/// writeValueXml(). The XmlPullParser must be positioned <em>at</em> the
/// tag that defines the value.
/// </remarks>
/// <param name="parser">The XmlPullParser from which to read the object.</param>
/// <param name="name">
/// An array of one string, used to return the name attribute
/// of the value's tag.
/// </param>
/// <returns>Object The newly generated value object.</returns>
/// <seealso cref="readMapXml(java.io.InputStream)">readMapXml(java.io.InputStream)</seealso>
/// <seealso cref="readListXml(java.io.InputStream)">readListXml(java.io.InputStream)
/// </seealso>
/// <seealso cref="writeValueXml(object, string, org.xmlpull.v1.XmlSerializer)">writeValueXml(object, string, org.xmlpull.v1.XmlSerializer)
/// </seealso>
/// <exception cref="org.xmlpull.v1.XmlPullParserException"></exception>
/// <exception cref="System.IO.IOException"></exception>
public static object readValueXml(org.xmlpull.v1.XmlPullParser parser, string[] name
)
{
int eventType = parser.getEventType();
do
{
if (eventType == org.xmlpull.v1.XmlPullParserClass.START_TAG)
{
return readThisValueXml(parser, name);
}
else
{
if (eventType == org.xmlpull.v1.XmlPullParserClass.END_TAG)
{
throw new org.xmlpull.v1.XmlPullParserException("Unexpected end tag at: " + parser
.getName());
}
else
{
if (eventType == org.xmlpull.v1.XmlPullParserClass.TEXT)
{
throw new org.xmlpull.v1.XmlPullParserException("Unexpected text: " + parser.getText
());
}
}
}
eventType = parser.next();
}
while (eventType != org.xmlpull.v1.XmlPullParserClass.END_DOCUMENT);
throw new org.xmlpull.v1.XmlPullParserException("Unexpected end of document");
}