插件开发工具库,推荐依赖该工具库。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

38 lines
1.3 KiB

package com.fanruan.api.xml;
import com.fr.base.Parameter;
import com.fr.base.TableData;
import com.fr.plugin.db.json.core.JSONTableData;
import com.fr.stable.ParameterProvider;
import com.fr.stable.bridge.StableFactory;
import com.fr.stable.xml.StableXMLUtils;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLUtils;
import com.fr.stable.xml.XMLableReader;
import com.fr.third.javax.xml.stream.XMLStreamException;
import org.junit.Assert;
import org.junit.Test;
import static org.junit.Assert.*;
public class XmlKitTest {
@Test
public void readParameter() {
try {
XMLableReader xml = XMLableReader.createXMLableReader("<!-- Edited by XMLSpy® -->\n" +
"<note>\n" +
"<Parameter>Tove</Parameter>\n" +
"<from>Jani</from>\n" +
"<heading>Reminder</heading>\n" +
"<body>Don't forget me this weekend!</body>\n" +
"</note>");
Parameter parameter = new Parameter("test", 1);
StableFactory.registerXMLDescription("Parameter",parameter);
Parameter p = (Parameter)XmlKit.readParameter(xml);
Assert.assertTrue(p.getName().equals("test"));
} catch (XMLStreamException e) {
e.printStackTrace();
}
}
}