本文整理汇总了C#中org.getEventType方法的典型用法代码示例。如果您正苦于以下问题:C# org.getEventType方法的具体用法?C# org.getEventType怎么用?C# org.getEventType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org
的用法示例。
在下文中一共展示了org.getEventType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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");
}
示例2: readThisSetXml
/// <summary>Read a HashSet object from an XmlPullParser.</summary>
/// <remarks>
/// Read a HashSet object from an XmlPullParser. The XML data could previously
/// have been generated by writeSetXml(). The XmlPullParser must be positioned
/// <em>after</em> the tag that begins the set.
/// </remarks>
/// <param name="parser">The XmlPullParser from which to read the set data.</param>
/// <param name="endTag">Name of the tag that will end the set, usually "set".</param>
/// <param name="name">
/// An array of one string, used to return the name attribute
/// of the set's tag.
/// </param>
/// <returns>HashSet The newly generated set.</returns>
/// <exception cref="org.xmlpull.v1.XmlPullParserException">org.xmlpull.v1.XmlPullParserException
/// </exception>
/// <exception cref="System.IO.IOException">System.IO.IOException</exception>
/// <seealso cref="readSetXml(java.io.InputStream)">readSetXml(java.io.InputStream)</seealso>
public static java.util.HashSet<object> readThisSetXml(org.xmlpull.v1.XmlPullParser
parser, string endTag, string[] name)
{
java.util.HashSet<object> set = new java.util.HashSet<object>();
int eventType = parser.getEventType();
do
{
if (eventType == org.xmlpull.v1.XmlPullParserClass.START_TAG)
{
object val = readThisValueXml(parser, name);
set.add(val);
}
else
{
//System.out.println("Adding to set: " + val);
if (eventType == org.xmlpull.v1.XmlPullParserClass.END_TAG)
{
if (parser.getName().Equals(endTag))
{
return set;
}
throw new org.xmlpull.v1.XmlPullParserException("Expected " + endTag + " end tag at: "
+ parser.getName());
}
}
eventType = parser.next();
}
while (eventType != org.xmlpull.v1.XmlPullParserClass.END_DOCUMENT);
throw new org.xmlpull.v1.XmlPullParserException("Document ended before " + endTag
+ " end tag");
}
示例3: readThisIntArrayXml
/// <summary>Read an int[] object from an XmlPullParser.</summary>
/// <remarks>
/// Read an int[] object from an XmlPullParser. The XML data could
/// previously have been generated by writeIntArrayXml(). The XmlPullParser
/// must be positioned <em>after</em> the tag that begins the list.
/// </remarks>
/// <param name="parser">The XmlPullParser from which to read the list data.</param>
/// <param name="endTag">Name of the tag that will end the list, usually "list".</param>
/// <param name="name">
/// An array of one string, used to return the name attribute
/// of the list's tag.
/// </param>
/// <returns>Returns a newly generated int[].</returns>
/// <seealso cref="readListXml(java.io.InputStream)">readListXml(java.io.InputStream)
/// </seealso>
/// <exception cref="org.xmlpull.v1.XmlPullParserException"></exception>
/// <exception cref="System.IO.IOException"></exception>
public static int[] readThisIntArrayXml(org.xmlpull.v1.XmlPullParser parser, string
endTag, string[] name)
{
int num;
try
{
num = System.Convert.ToInt32(parser.getAttributeValue(null, "num"));
}
catch (System.ArgumentNullException)
{
throw new org.xmlpull.v1.XmlPullParserException("Need num attribute in byte-array"
);
}
catch (System.ArgumentException)
{
throw new org.xmlpull.v1.XmlPullParserException("Not a number in num attribute in byte-array"
);
}
int[] array = new int[num];
int i = 0;
int eventType = parser.getEventType();
do
{
if (eventType == org.xmlpull.v1.XmlPullParserClass.START_TAG)
{
if (parser.getName().Equals("item"))
{
try
{
array[i] = System.Convert.ToInt32(parser.getAttributeValue(null, "value"));
}
catch (System.ArgumentNullException)
{
throw new org.xmlpull.v1.XmlPullParserException("Need value attribute in item");
}
catch (System.ArgumentException)
{
throw new org.xmlpull.v1.XmlPullParserException("Not a number in value attribute in item"
);
}
}
else
{
throw new org.xmlpull.v1.XmlPullParserException("Expected item tag at: " + parser
.getName());
}
}
else
{
if (eventType == org.xmlpull.v1.XmlPullParserClass.END_TAG)
{
if (parser.getName().Equals(endTag))
{
return array;
}
else
{
if (parser.getName().Equals("item"))
{
i++;
}
else
{
throw new org.xmlpull.v1.XmlPullParserException("Expected " + endTag + " end tag at: "
+ parser.getName());
}
}
}
}
eventType = parser.next();
}
while (eventType != org.xmlpull.v1.XmlPullParserClass.END_DOCUMENT);
throw new org.xmlpull.v1.XmlPullParserException("Document ended before " + endTag
+ " end tag");
}
示例4: readThisMapXml
/// <summary>Read a HashMap object from an XmlPullParser.</summary>
/// <remarks>
/// Read a HashMap object from an XmlPullParser. The XML data could
/// previously have been generated by writeMapXml(). The XmlPullParser
/// must be positioned <em>after</em> the tag that begins the map.
/// </remarks>
/// <param name="parser">The XmlPullParser from which to read the map data.</param>
/// <param name="endTag">Name of the tag that will end the map, usually "map".</param>
/// <param name="name">
/// An array of one string, used to return the name attribute
/// of the map's tag.
/// </param>
/// <returns>HashMap The newly generated map.</returns>
/// <seealso cref="readMapXml(java.io.InputStream)">readMapXml(java.io.InputStream)</seealso>
/// <exception cref="org.xmlpull.v1.XmlPullParserException"></exception>
/// <exception cref="System.IO.IOException"></exception>
public static java.util.HashMap<object, object> readThisMapXml(org.xmlpull.v1.XmlPullParser
parser, string endTag, string[] name)
{
java.util.HashMap<object, object> map = new java.util.HashMap<object, object>();
int eventType = parser.getEventType();
do
{
if (eventType == org.xmlpull.v1.XmlPullParserClass.START_TAG)
{
object val = readThisValueXml(parser, name);
if (name[0] != null)
{
//System.out.println("Adding to map: " + name + " -> " + val);
map.put(name[0], val);
}
else
{
throw new org.xmlpull.v1.XmlPullParserException("Map value without name attribute: "
+ parser.getName());
}
}
else
{
if (eventType == org.xmlpull.v1.XmlPullParserClass.END_TAG)
{
if (parser.getName().Equals(endTag))
{
return map;
}
throw new org.xmlpull.v1.XmlPullParserException("Expected " + endTag + " end tag at: "
+ parser.getName());
}
}
eventType = parser.next();
}
while (eventType != org.xmlpull.v1.XmlPullParserClass.END_DOCUMENT);
throw new org.xmlpull.v1.XmlPullParserException("Document ended before " + endTag
+ " end tag");
}