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


Java StaxDriver类代码示例

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


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

示例1: DriverEndToEndTestSuite

import com.thoughtworks.xstream.io.xml.StaxDriver; //导入依赖的package包/类
public DriverEndToEndTestSuite() {
    super(DriverEndToEndTestSuite.class.getName());
    addDriverTest(new BEAStaxDriver());
    addDriverTest(new BinaryStreamDriver());
    addDriverTest(new Dom4JDriver());
    addDriverTest(new DomDriver());
    addDriverTest(new JDomDriver());
    addDriverTest(new JDom2Driver());
    addDriverTest(new KXml2DomDriver());
    addDriverTest(new KXml2Driver());
    addDriverTest(new StaxDriver());
    addDriverTest(new StandardStaxDriver());
    addDriverTest(new WstxDriver());
    addDriverTest(new XomDriver());
    addDriverTest(new Xpp3DomDriver());
    addDriverTest(new Xpp3Driver());
    addDriverTest(new XppDomDriver());
    addDriverTest(new XppDriver());
    addDriverTest(new JettisonMappedXmlDriver());
}
 
开发者ID:x-stream,项目名称:xstream,代码行数:21,代码来源:DriverEndToEndTestSuite.java

示例2: parse

import com.thoughtworks.xstream.io.xml.StaxDriver; //导入依赖的package包/类
@Override
public Suite parse(InputStream suiteInputStream) throws Exception
{
    XStream xStream = new XStream(new StaxDriver());
    xStream.addPermission(NoTypePermission.NONE);
    xStream.allowTypesByWildcard(new String[]{
            "com.surenpi.autotest.suite.runner.**"
    });

    xStream.aliasSystemAttribute(null, "class");

    xStream.alias("suite", Suite.class);
    xStream.aliasField("pageConfig", Suite.class, "xmlConfPath");
    xStream.useAttributeFor(Suite.class, "xmlConfPath");
    xStream.aliasField("pages", Suite.class, "pageList");
    xStream.useAttributeFor(Suite.class, "pagePackage");
    xStream.useAttributeFor(Suite.class, "rows");
    xStream.useAttributeFor(Suite.class, "afterSleep");

    xStream.alias("page", SuitePage.class);
    xStream.aliasField("class", SuitePage.class, "pageCls");
    xStream.useAttributeFor(SuitePage.class, "pageCls");
    xStream.aliasField("actions", SuitePage.class, "actionList");
    xStream.useAttributeFor(SuitePage.class, "repeat");

    xStream.alias("action", SuiteAction.class);
    xStream.useAttributeFor(SuiteAction.class, "field");
    xStream.useAttributeFor(SuiteAction.class, "name");

    Object obj = xStream.fromXML(suiteInputStream);

    return (Suite) obj;
}
 
开发者ID:LinuxSuRen,项目名称:phoenix.webui.suite.runner,代码行数:34,代码来源:XStreamSuiteParser.java

示例3: openStream

import com.thoughtworks.xstream.io.xml.StaxDriver; //导入依赖的package包/类
private XStream openStream() {
    final File folder = new File(networkStateFilePath);

    // Create the path for serialization.
    if (!folder.exists()) {
        logger.debug("Creating ZigBee persistence folder {}", networkStateFilePath);
        folder.mkdirs();
    }

    XStream stream = new XStream(new StaxDriver());
    stream.setClassLoader(ZigBeeNetworkStateSerializerImpl.class.getClassLoader());

    stream.alias("ZigBeeNode", ZigBeeNodeDao.class);
    stream.alias("ZigBeeEndpoint", ZigBeeEndpointDao.class);
    stream.alias("MacCapabilitiesType", MacCapabilitiesType.class);
    stream.alias("ServerCapabilitiesType", ServerCapabilitiesType.class);
    stream.alias("PowerSourceType", PowerSourceType.class);
    stream.alias("FrequencyBandType", FrequencyBandType.class);
    return stream;
}
 
开发者ID:openhab,项目名称:org.openhab.binding.zigbee,代码行数:21,代码来源:ZigBeeNetworkStateSerializerImpl.java

示例4: serialize

import com.thoughtworks.xstream.io.xml.StaxDriver; //导入依赖的package包/类
public static void serialize(final String name, final Object ast) {
    if (name == null || name.length() == 0) return;

    XStream xstream = new XStream(new StaxDriver());
    FileWriter astFileWriter = null;
    try {
        File astFile = astFile(name);
        if (astFile == null) {
            System.out.println("File-name for writing " + name + " AST could not be determined!");
            return;
        }
        astFileWriter = new FileWriter(astFile, false);
        xstream.toXML(ast, astFileWriter);
        System.out.println("Written AST to " + name + ".xml");

    } catch (Exception e) {
        System.out.println("Couldn't write to " + name + ".xml");
        e.printStackTrace();
    } finally {
        DefaultGroovyMethods.closeQuietly(astFileWriter);
    }
}
 
开发者ID:apache,项目名称:groovy,代码行数:23,代码来源:XStreamUtils.java

示例5: EncodingTestSuite

import com.thoughtworks.xstream.io.xml.StaxDriver; //导入依赖的package包/类
public EncodingTestSuite() {
    super(EncodingTestSuite.class.getName());
    addDriverTest(new Dom4JDriver());
    addDriverTest(new DomDriver());
    addDriverTest(new JDomDriver());
    addDriverTest(new JDom2Driver());
    addDriverTest(new StaxDriver());
    if (!SystemUtils.IS_OS_WINDOWS) { // see comment below for Windows
        addDriverTest(new StandardStaxDriver());
        addDriverTest(new BEAStaxDriver());
        addDriverTest(new WstxDriver());
    }
    addDriverTest(new KXml2DomDriver());
    addDriverTest(new KXml2Driver());
    addDriverTest(new XppDomDriver());
    addDriverTest(new XppDriver());
    addDriverTest(new XomDriver());
}
 
开发者ID:x-stream,项目名称:xstream,代码行数:19,代码来源:EncodingTestSuite.java

示例6: main

import com.thoughtworks.xstream.io.xml.StaxDriver; //导入依赖的package包/类
/**
 * @param args
 */
public static void main(String[] args) {
	// TODO Auto-generated method stub
	// XStream xstream = new XStream();
	// XStream xstream = new XStream(new DomDriver());
	XStream xstream = new XStream(new StaxDriver());
	TermQuery tq = new TermQuery(new Term("foo", "bar"));
	GraphQuery gq = new GraphQuery(tq, "edgeid", "nodeid", null);
	
	
	GraphQuery gq2 = new GraphQuery(gq, "edgeid2", "nodeid2", null);
	
	xstream.alias("graphQuery", GraphQuery.class);
	xstream.alias("termQuery", TermQuery.class);
	
	String xml = xstream.toXML(gq2);
	// xml = xml.replaceAll(">", ">\n");
	System.out.println(xml);
	
	gq = (GraphQuery) xstream.fromXML(xml);
	
	System.out.println(gq.toString());
}
 
开发者ID:kwatters,项目名称:solrgraph,代码行数:26,代码来源:TestSerialize.java

示例7: createXStream1

import com.thoughtworks.xstream.io.xml.StaxDriver; //导入依赖的package包/类
private static XStream createXStream1(boolean ignoreMissingMembers, StaxDriver staxDriver,
        Class... annotatedClassesToProcess) {
    XStream xstream = new ResilientXStream(ignoreMissingMembers, staxDriver);
    xstream.registerConverter(new RepoPathConverter());
    xstream.registerConverter(new PropertiesConverter());
    xstream.registerConverter(new ChecksumsInfoConverter());
    xstream.registerConverter(new UserGroupInfoConverter());
    for (Class annotatedClass : annotatedClassesToProcess) {
        xstream.processAnnotations(annotatedClass);
    }
    xstream.alias("repoPath", RepoPath.class, RepoPathImpl.class);

    // clear out existing permissions and set own ones
    xstream.addPermission(NoTypePermission.NONE);
    // allow some basics
    xstream.addPermission(NullPermission.NULL);
    xstream.addPermission(PrimitiveTypePermission.PRIMITIVES);
    xstream.addPermission(ArrayTypePermission.ARRAYS);
    xstream.allowTypeHierarchy(Collection.class);
    xstream.allowTypeHierarchy(String.class);
    // allow any type from the same package
    xstream.allowTypesByWildcard(new String[]{"org.artifactory.**", "org.jfrog.**"});

    return xstream;
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:26,代码来源:XStreamFactory.java

示例8: read

import com.thoughtworks.xstream.io.xml.StaxDriver; //导入依赖的package包/类
/**
 * Reads an Object from the given Reader.
 * KNOWN LIMITATION: This method will thrown an exception
 * "java.io.IOException: com.thoughtworks.xstream.io.StreamException:
 * : input contained no data" when trying to read the SECOND object from
 * an XML InputStream/Reader.  This is because XML files must have a
 * single root node (which would be the FIRST object in the file), and
 * anything after the close of the root node (the SECOND object) is
 * considered invalid or inexistent.  To address the limitation, refer
 * to http://xstream.codehaus.org/objectstream.html
 * 
 * @return Deserialized object (null on exception)
 * @param reader Reader from which to read
 * @throws java.io.IOException
 * if an Object can't be deserialized from the reader (See LIMITATION above)
 */
public static Object read(
    Reader reader)
    throws IOException
{

    XStream xmlStream = new XStream(new StaxDriver());
    Object object = null;
    try
    {
        object = xmlStream.fromXML(reader);
    }
    catch (Exception e)
    {
        throw new IOException(e.toString());
    }

    return object;
}
 
开发者ID:algorithmfoundry,项目名称:Foundry,代码行数:35,代码来源:XStreamSerializationHandler.java

示例9: XStreamSerializer

import com.thoughtworks.xstream.io.xml.StaxDriver; //导入依赖的package包/类
public XStreamSerializer(String name, boolean withSpecialConverter, final XMLInputFactory inf, final XMLOutputFactory outf) throws Exception
{
    super(name);
    if (inf != null && outf != null) {
        xstream = new XStream(new StaxDriver() {
            public XMLInputFactory getInputFactory() {
                return inf;
            }

            public XMLOutputFactory getOutputFactory() {
               return outf;
            }
        });
    } else {
        xstream = new XStream(new XppDriver(){
            public HierarchicalStreamWriter createWriter(Writer out) {
                //return new PrettyPrintWriter(out, xmlFriendlyReplacer());
                return new CompactWriter(out, xmlFriendlyReplacer());
            }
        });

    }
    if (withSpecialConverter) {
        registerConverters();
    }
}
 
开发者ID:ppdai,项目名称:TripSerializer4J,代码行数:27,代码来源:XStreamSerializer.java

示例10: caricaSessioni

import com.thoughtworks.xstream.io.xml.StaxDriver; //导入依赖的package包/类
public static ArrayList<SessioneLavoro> caricaSessioni(int idStudente) {
    XStream xstream = new XStream(new StaxDriver());
    String query = "SELECT * FROM SessioneLavoro WHERE ID_Utente = " + idStudente;
    QueryResult qr;
    ArrayList<SessioneLavoro> sessioni = new ArrayList<>();
    try {
        qr = DBController.getInstance().executeQuery(query);
        while (qr.next()) {
            //System.out.println("**************aAA ");
            UserInfo autore = UserInfo.getUserInfo(idStudente); //preleva dati dell'utente in base all'id
            //preleva il messaggio e lo converte da xml a oggetto Java
            MessaggioIntercettato msg = (MessaggioIntercettato) xstream.fromXML(qr.getString("Messaggio_intercettato"));
            //System.out.println("Area Lavoro: " + msg.getAreaLavoro());
            AlberoIpotesi albero = (AlberoIpotesi) xstream.fromXML(qr.getString("ALBERO_IPOTESI"));
            Soluzione sol = Soluzione.caricaSoluzione(qr.getInt("ID_SOLUZIONE"));
            //System.out.println("**************SOL " + sol.toString());
            SessioneLavoro temp = new SessioneLavoro(qr.getInt("ID"), qr.getString("Nome_Sessione"), autore, albero, msg, sol);
            sessioni.add(temp);
        }
    } catch (Exception ex) {
        log.fatal(ex.getMessage());
    }
    return sessioni;
}
 
开发者ID:sashapodgoreanu,项目名称:CryptoHelper,代码行数:25,代码来源:SessioneLavoro.java

示例11: getXstream

import com.thoughtworks.xstream.io.xml.StaxDriver; //导入依赖的package包/类
protected static XStream getXstream(){
  XStream xstream = new XStream(new StaxDriver());
  
  xstream.setMarshallingStrategy(new ReferenceByIdMarshallingStrategy());
  
  xstream.setClassLoader(Gate.getClassLoader());
  xstream.alias("coref.Config", Config.class);
  xstream.aliasPackage("default", "gate.creole.coref");
  xstream.useAttributeFor(AbstractTagger.class, "annotationType");
  xstream.useAttributeFor(AbstractMatcher.class, "annotationType");
  xstream.useAttributeFor(AbstractMatcher.class, "antecedentType");
  
  xstream.useAttributeFor(gate.creole.coref.taggers.Alias.class, "aliasFile");
  xstream.useAttributeFor(gate.creole.coref.taggers.Alias.class, "encoding");
  
  xstream.useAttributeFor(gate.creole.coref.matchers.Alias.class, "aliasFile");
  xstream.useAttributeFor(gate.creole.coref.matchers.Alias.class, "encoding");
  
  xstream.addImplicitCollection(Collate.class, "subTaggers");
  xstream.addImplicitCollection(CompoundMatcher.class, "subMatchers");
  xstream.addImplicitCollection(FixedTags.class, "tags");
  return xstream;
}
 
开发者ID:Network-of-BioThings,项目名称:GettinCRAFTy,代码行数:24,代码来源:CorefBase.java

示例12: ObjectWrapper

import com.thoughtworks.xstream.io.xml.StaxDriver; //导入依赖的package包/类
/**
 * De-serialises an {@link ObjectWrapper} instance from a string previously 
 * obtained by calling {@link #toString()}.
 * @param xmlSerialisation the XML string representing the saved 
 * {@link ObjectWrapper} instance.
 */
public ObjectWrapper(String xmlSerialisation) {
  XStream xstream = new XStream(new StaxDriver());
  Object other = xstream.fromXML(xmlSerialisation);
  if(other instanceof ObjectWrapper) {
    this.value = ((ObjectWrapper)other).value;
  } else {
    log.error("Value de-serialised from XML is of type \"" + 
        other.getClass().getName() + "\", instead of expected \"" + 
        ObjectWrapper.class.getName() + ". Value was lost.");
    value = null;
  }
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:19,代码来源:ObjectWrapper.java

示例13: openStream

import com.thoughtworks.xstream.io.xml.StaxDriver; //导入依赖的package包/类
private XStream openStream() {
    XStream stream = new XStream(new StaxDriver());
    stream.alias("ZigBeeNode", ZigBeeNodeDao.class);
    stream.alias("ZigBeeDevice", ZigBeeEndpointDao.class);
    stream.alias("MacCapabilitiesType", MacCapabilitiesType.class);
    stream.alias("ServerCapabilitiesType", ServerCapabilitiesType.class);
    stream.alias("PowerSourceType", PowerSourceType.class);
    stream.alias("FrequencyBandType", FrequencyBandType.class);
    return stream;
}
 
开发者ID:zsmartsystems,项目名称:com.zsmartsystems.zigbee,代码行数:11,代码来源:ZigBeeNetworkStateSerializerImpl.java

示例14: getxStream

import com.thoughtworks.xstream.io.xml.StaxDriver; //导入依赖的package包/类
/**
 * Creates a proper configured XStream instance
 *
 * @return the XStream instance
 */
public static XStream getxStream() {
    XStream xStream = new XStream(new StaxDriver());
    xStream.alias("attributes", ElementAttributes.class);
    xStream.alias("visualElement", VisualElement.class);
    xStream.alias("wire", Wire.class);
    xStream.alias("circuit", Circuit.class);
    xStream.alias("intFormat", IntFormat.class);
    xStream.alias("barrelShifterMode", BarrelShifterMode.class);
    xStream.alias("direction", LeftRightFormat.class);
    xStream.alias("rotation", Rotation.class);
    xStream.aliasAttribute(Rotation.class, "rotation", "rotation");
    xStream.alias("language", Language.class);
    xStream.aliasAttribute(Language.class, "name", "name");
    xStream.alias("vector", Vector.class);
    xStream.aliasAttribute(Vector.class, "x", "x");
    xStream.aliasAttribute(Vector.class, "y", "y");
    xStream.alias("value", InValue.class);
    xStream.aliasAttribute(InValue.class, "value", "v");
    xStream.aliasAttribute(InValue.class, "highZ", "z");
    xStream.addImplicitCollection(ElementAttributes.class, "attributes");
    xStream.alias("data", DataField.class);
    xStream.registerConverter(new DataFieldConverter());
    xStream.alias("testData", TestCaseDescription.class);
    xStream.alias("inverterConfig", InverterConfig.class);
    xStream.addImplicitCollection(InverterConfig.class, "inputs");
    xStream.ignoreUnknownElements();
    return xStream;
}
 
开发者ID:hneemann,项目名称:Digital,代码行数:34,代码来源:Circuit.java

示例15: getxStream

import com.thoughtworks.xstream.io.xml.StaxDriver; //导入依赖的package包/类
private static XStream getxStream() {
    XStream xStream = new XStream(new StaxDriver());
    xStream.alias("truthTable", TruthTable.class);
    xStream.alias("variable", Variable.class);
    xStream.aliasAttribute(Variable.class, "identifier", "name");
    xStream.alias("result", Result.class);
    xStream.alias("BoolTable", BoolTableByteArray.class);
    xStream.alias("BoolTableEx", BoolTableExpanded.class);
    return xStream;
}
 
开发者ID:hneemann,项目名称:Digital,代码行数:11,代码来源:TruthTable.java


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