当前位置: 首页>>代码示例>>Java>>正文


Java MXParser类代码示例

本文整理汇总了Java中org.xmlpull.mxp1.MXParser的典型用法代码示例。如果您正苦于以下问题:Java MXParser类的具体用法?Java MXParser怎么用?Java MXParser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MXParser类属于org.xmlpull.mxp1包,在下文中一共展示了MXParser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Combiner

import org.xmlpull.mxp1.MXParser; //导入依赖的package包/类
public Combiner(ManifestResolver resolver, Writer output) throws IOException, XmlPullParserException
{
	this.output = output;
	this.resolver = resolver;

	Reader reader = null;
	try
	{
		reader = resolver.getStream();

		parser = new MXParser();
		parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
		parser.setInput(reader);

		parseXml();
	}
	finally
	{
		Closeables.close(reader, true); // Quietly
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:22,代码来源:IMSUtilities.java

示例2: loadMainParts

import org.xmlpull.mxp1.MXParser; //导入依赖的package包/类
private void loadMainParts(String dateiname)
{
    try
    {
        XmlPullParser parser = new MXParser();
        FileReader reader = new FileReader(dateiname);
        parser.setInput(reader);

        processXML(parser);

        reader.close();
    }
    catch (Exception e)
    {
        e.printStackTrace();
    }
}
 
开发者ID:wolfposd,项目名称:IMSQTI2PDF,代码行数:18,代码来源:XmlParser.java

示例3: testPathsAreDecodedInTracker

import org.xmlpull.mxp1.MXParser; //导入依赖的package包/类
public void testPathsAreDecodedInTracker() {
    Reader input = new StringReader("" +
            "<a>" +
            "  <b__1/>" +
            "</a>");
    HierarchicalStreamReader reader = new XppReader(input, new MXParser());
    PathTracker pathTracker = new PathTracker();

    reader = new PathTrackingReader(reader, pathTracker);
    assertEquals(new Path("/a"), pathTracker.getPath());

    reader.moveDown();
    assertEquals(new Path("/a/b_1"), pathTracker.getPath());
    assertEquals("b_1", pathTracker.peekElement());

    reader.moveUp();
    assertEquals(new Path("/a"), pathTracker.getPath());
}
 
开发者ID:x-stream,项目名称:xstream,代码行数:19,代码来源:PathTrackingReaderTest.java

示例4: parseMacroGroups

import org.xmlpull.mxp1.MXParser; //导入依赖的package包/类
public MacroGroup parseMacroGroups(String macros) throws Exception {

        	MacroGroup group = null;
        	XmlPullParser parser = new MXParser();
        	parser.setInput(new StringReader(macros));
			int eventType = parser.getEventType();
			while (eventType != XmlPullParser.END_DOCUMENT) {		
				eventType = parser.next();
				 if (eventType == XmlPullParser.START_TAG) {
	                    if (parser.getName().equals("macrogroup")) {
	                    	group = parseMacroGroup(parser);
	                    }
				 }
			}
			return group;
        }
 
开发者ID:bejayoharen,项目名称:java-bells,代码行数:17,代码来源:Macros.java

示例5: setUp

import org.xmlpull.mxp1.MXParser; //导入依赖的package包/类
public void setUp()
            throws Exception
    {
//        xmlPullParserFactory = XmlPullParserFactory.newInstance();
//        xmlPullParserFactory.setNamespaceAware(true);
//
//        xmlPullParser = xmlPullParserFactory.newPullParser();
        xmlPullParser = new MXParser();
        xmlPullParser.setFeature(
            "http://xmlpull.org/v1/doc/features.html#process-namespaces",
            true);

        AbstractSmackInteroperabilityLayer.setImplementationClass(
                SmackV3InteroperabilityLayer.class);
        colibriIQProvider = new ColibriIQProvider();
    }
 
开发者ID:jitsi,项目名称:jitsi,代码行数:17,代码来源:ColibriIQProviderTest.java

示例6: getScormVersion

import org.xmlpull.mxp1.MXParser; //导入依赖的package包/类
public static String getScormVersion(Reader xml, boolean alwaysReturnDefaultVersion) throws XmlPullParserException,
	IOException
{
	XmlPullParser parser = new MXParser();
	parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
	parser.setInput(xml);

	parser.next();
	String namespace = parser.getNamespace("adlcp");
	String version = null;
	if( namespace != null )
	{
		if( namespace.equals("http://www.adlnet.org/xsd/adlcp_rootv1p2") )
		{
			version = "1.2";
		}
		else if( namespace.equals("http://www.adlnet.org/xsd/adlcp_v1p3") )
		{
			version = "1.3";
		}
		else if( alwaysReturnDefaultVersion )
		{
			version = "1.2";
		}
	}
	return version;
}
 
开发者ID:equella,项目名称:Equella,代码行数:28,代码来源:IMSUtilities.java

示例7: gatherValuesForTagName

import org.xmlpull.mxp1.MXParser; //导入依赖的package包/类
private static void gatherValuesForTagName(String tagName, Reader xml, StringBuilder gatherer, int maxSize)
	throws XmlPullParserException, IOException
{
	XmlPullParser parser = new MXParser();
	parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, false);
	parser.setInput(xml);

	int event = parser.getEventType();
	while( event != XmlPullParser.END_DOCUMENT )
	{
		if( event == XmlPullParser.START_TAG && parser.getName().equals(tagName) )
		{
			while( parser.next() == XmlPullParser.TEXT )
			{
				String s = parser.getText();
				if( s != null )
				{
					// Removal all tabs, newlines, returns, etc.. and trim
					// white space
					s = s.replaceAll("\\cM?\r?\r\n\t", "").trim();
					if( s.length() > 0 )
					{
						gatherer.append(s);
						gatherer.append(' ');
					}
				}
			}

			if( gatherer.length() >= maxSize )
			{
				return;
			}
		}
		event = parser.next();
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:37,代码来源:AbstractOffice2007Extracter.java

示例8: build

import org.xmlpull.mxp1.MXParser; //导入依赖的package包/类
/**
 * @deprecated As of 1.4, use {@link XppDom#build(XmlPullParser)} instead
 */
@Deprecated
public static Xpp3Dom build(final Reader reader) throws Exception {
    final XmlPullParser parser = new MXParser();
    parser.setInput(reader);
    try {
        return (Xpp3Dom)XppDom.build(parser);
    } finally {
        reader.close();
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:Xpp3DomBuilder.java

示例9: openReader

import org.xmlpull.mxp1.MXParser; //导入依赖的package包/类
private static XppReader openReader(final String text, final boolean checkForContent) throws PyDebuggerException {
  final XppReader reader = new XppReader(new StringReader(text), new MXParser(), new NoNameCoder());
  if (checkForContent && !reader.hasMoreChildren()) {
    throw new PyDebuggerException("Empty frame: " + text);
  }
  return reader;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:ProtocolParser.java

示例10: resetParser

import org.xmlpull.mxp1.MXParser; //导入依赖的package包/类
/**
 * Resets the parser using the latest connection's reader. Reseting the parser is necessary
 * when the plain connection has been secured or when a new opening stream element is going
 * to be sent by the server.
 */
private void resetParser() {
    try {
        parser = new MXParser();
        parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
        parser.setInput(connection.reader);
    }
    catch (XmlPullParserException xppe) {
        xppe.printStackTrace();
    }
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:16,代码来源:PacketReader.java

示例11: testDecoratesReaderAndTracksPath

import org.xmlpull.mxp1.MXParser; //导入依赖的package包/类
public void testDecoratesReaderAndTracksPath() {
    Reader input = new StringReader("" +
            "<a>" +
            "  <b><c/></b>" +
            "  <b/>" +
            "  <d/>" +
            "</a>");
    HierarchicalStreamReader reader = new XppReader(input, new MXParser());
    PathTracker pathTracker = new PathTracker();

    reader = new PathTrackingReader(reader, pathTracker);
    assertEquals(new Path("/a"), pathTracker.getPath());

    reader.moveDown();
    assertEquals(new Path("/a/b"), pathTracker.getPath());

    reader.moveDown();
    assertEquals(new Path("/a/b/c"), pathTracker.getPath());

    reader.moveUp();
    assertEquals(new Path("/a/b"), pathTracker.getPath());

    reader.moveUp();
    reader.moveDown();
    assertEquals(new Path("/a/b[2]"), pathTracker.getPath());

    reader.moveUp();
    reader.moveDown();
    assertEquals(new Path("/a/d"), pathTracker.getPath());

    reader.moveUp();
    assertEquals(new Path("/a"), pathTracker.getPath());
}
 
开发者ID:x-stream,项目名称:xstream,代码行数:34,代码来源:PathTrackingReaderTest.java

示例12: UserDAOImple

import org.xmlpull.mxp1.MXParser; //导入依赖的package包/类
@SuppressWarnings("static-access")
public UserDAOImple(){
    this.map = new HashMap<Long, UserDO>();
    this.xpp = new MXParser();
    this.xsl = new MXSerializer();
    this.maxId = Long.MIN_VALUE;
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:8,代码来源:UserDAOImple.java

示例13: UserDAOImple

import org.xmlpull.mxp1.MXParser; //导入依赖的package包/类
@SuppressWarnings("static-access")
public UserDAOImple() {
    this.map = new HashMap<Long, UserDO>();
    this.xpp = new MXParser();
    this.xsl = new MXSerializer();
    this.maxId = Long.MIN_VALUE;
}
 
开发者ID:alibaba,项目名称:cobar,代码行数:8,代码来源:UserDAOImple.java

示例14: getTranscript

import org.xmlpull.mxp1.MXParser; //导入依赖的package包/类
/**
 * Reads in the transcript file using the Xml Pull Parser.
 *
 * @param transcriptFile the transcript file to read.
 * @return the ChatTranscript.
 */
public static ChatTranscript getTranscript(File transcriptFile) {
    final ChatTranscript transcript = new ChatTranscript();
    if (!transcriptFile.exists()) {
        return transcript;
    }

    try {
        final MXParser parser = new MXParser();
        parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
        BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(transcriptFile), "UTF-8"));
        parser.setInput(in);
        boolean done = false;
        while (!done) {
            int eventType = parser.next();
            if (eventType == XmlPullParser.START_TAG && "message".equals(parser.getName())) {
                transcript.addHistoryMessage(getHistoryMessage(parser));
            }
            else if (eventType == XmlPullParser.END_TAG && "transcript".equals(parser.getName())) {
                done = true;
            }
        }
    }
    catch (Exception e) {
        e.printStackTrace();
    }
  

    return transcript;
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:36,代码来源:ChatTranscripts.java

示例15: loadPreviousHistory

import org.xmlpull.mxp1.MXParser; //导入依赖的package包/类
/**
 * Loads the previous history.
 */
private void loadPreviousHistory() {
    if (!conFile.exists()) {
        return;
    }

    // Otherwise load it.
    try {
        final MXParser parser = new MXParser();
        parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
        BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(conFile), "UTF-8"));
        parser.setInput(in);
        boolean done = false;
        while (!done) {
            int eventType = parser.next();
            if (eventType == XmlPullParser.START_TAG && "user".equals(parser.getName())) {
                String jid = StringUtils.parseBareAddress(parser.nextText());
                historyList.add(jid);
            }
            else if (eventType == XmlPullParser.END_TAG && "conversations".equals(parser.getName())) {
                done = true;
            }
        }
    }
    catch (Exception e) {
        Log.error(e);
    }
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:31,代码来源:ConversationHistoryPlugin.java


注:本文中的org.xmlpull.mxp1.MXParser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。