本文整理汇总了Java中org.jibx.runtime.IUnmarshallingContext.unmarshalDocument方法的典型用法代码示例。如果您正苦于以下问题:Java IUnmarshallingContext.unmarshalDocument方法的具体用法?Java IUnmarshallingContext.unmarshalDocument怎么用?Java IUnmarshallingContext.unmarshalDocument使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jibx.runtime.IUnmarshallingContext
的用法示例。
在下文中一共展示了IUnmarshallingContext.unmarshalDocument方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toStyle
import org.jibx.runtime.IUnmarshallingContext; //导入方法依赖的package包/类
private SymbolizerTypeInfo toStyle(String sld) throws Exception {
String style = "<StyledLayerDescriptor version=\"1.0.0\"\n" +
" xsi:schemaLocation=\"http://www.opengis.net/sld StyledLayerDescriptor.xsd\" \n" +
" xmlns=\"http://www.opengis.net/sld\" \n" +
" xmlns:ogc=\"http://www.opengis.net/ogc\" \n" +
" xmlns:xlink=\"http://www.w3.org/1999/xlink\" \n" +
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n" +
" <NamedLayer>\n" +
" <Name>test</Name>\n" +
" <UserStyle>\n" +
" <Title>test</Title>\n" +
" <FeatureTypeStyle>\n" +
" <Rule>\n" +
""+sld+" </Rule>\n" +
" </FeatureTypeStyle>\n" +
" </UserStyle>\n" +
" </NamedLayer>\n" +
"</StyledLayerDescriptor>";
IBindingFactory bfact = BindingDirectory.getFactory(StyledLayerDescriptorInfo.class);
IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
Object object = uctx.unmarshalDocument(new StringReader(style), null);
return ((StyledLayerDescriptorInfo) object).getChoiceList().get(0).getNamedLayer().getChoiceList().get(0)
.getUserStyle().getFeatureTypeStyleList().get(0).getRuleList().get(0).getSymbolizerList().get(0);
}
示例2: SimpleRulesData
import org.jibx.runtime.IUnmarshallingContext; //导入方法依赖的package包/类
public SimpleRulesData(String ruleName, int width, int height) throws JiBXException {
this.width = width;
this.height = height;
IBindingFactory bfact = BindingDirectory.getFactory(StyledLayerDescriptorInfo.class);
IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
Object object = uctx.unmarshalDocument(
getClass().getResourceAsStream("/org/geomajas/testdata/sld/simple_rules.sld"), null);
StyledLayerDescriptorInfo sld = (StyledLayerDescriptorInfo) object;
NamedLayerInfo namedLayerInfo = sld.getChoiceList().get(0).getNamedLayer();
UserStyleInfo userStyleInfo = namedLayerInfo.getChoiceList().get(0).getUserStyle();
FeatureTypeStyleInfo featureTypeStyleInfo = userStyleInfo.getFeatureTypeStyleList().get(0);
for (RuleInfo rule : featureTypeStyleInfo.getRuleList()) {
if (ruleName.equals(rule.getName())) {
ruleInfo = rule;
}
}
}
示例3: unmarshalMessage
import org.jibx.runtime.IUnmarshallingContext; //导入方法依赖的package包/类
/**
* Unmarshal this xml Message to an object.
* @param xml
* @param system
* @return
*/
public static Object unmarshalMessage(String xml, String version)
{
String packageName = "org.dslforum." + version;
String bindingName = "binding";
try {
IBindingFactory jc = BindingDirectory.getFactory(bindingName, packageName);
IUnmarshallingContext unmarshaller = jc.createUnmarshallingContext();
Reader inStream = new StringReader(xml);
Object message = unmarshaller.unmarshalDocument( inStream, bindingName);
return message;
} catch (JiBXException e) {
e.printStackTrace();
}
return null;
}
示例4: createSystemInfo
import org.jibx.runtime.IUnmarshallingContext; //导入方法依赖的package包/类
/**
* Create System Info from XML representation
*
* @param xml xml representation of system info
* @return the System Info
*/
public static SystemInfo createSystemInfo(InputStream xml)
{
try
{
IBindingFactory factory = BindingDirectory.getFactory(SystemInfo.class);
IUnmarshallingContext context = factory.createUnmarshallingContext();
Object obj = context.unmarshalDocument(xml, null);
return (SystemInfo)obj;
}
catch(JiBXException e)
{
throw new DictionaryException("Failed to parse System Info", e);
}
}
示例5: createModel
import org.jibx.runtime.IUnmarshallingContext; //导入方法依赖的package包/类
public static M2Model createModel(String bindingName, InputStream xml)
{
try
{
IBindingFactory factory = BindingDirectory.getFactory(bindingName, M2Model.class);
IUnmarshallingContext context = factory.createUnmarshallingContext();
Object obj = context.unmarshalDocument(xml, null);
return (M2Model)obj;
}
catch(JiBXException e)
{
throw new DictionaryException(ERR_PARSE_FAILURE, e);
}
}
示例6: unmarshalInputStream
import org.jibx.runtime.IUnmarshallingContext; //导入方法依赖的package包/类
@Override
protected Object unmarshalInputStream(InputStream inputStream) throws XmlMappingException, IOException {
try {
IUnmarshallingContext unmarshallingContext = createUnmarshallingContext();
return unmarshallingContext.unmarshalDocument(inputStream, encoding);
}
catch (JiBXException ex) {
throw convertJibxException(ex, false);
}
}
示例7: unmarshalReader
import org.jibx.runtime.IUnmarshallingContext; //导入方法依赖的package包/类
@Override
protected Object unmarshalReader(Reader reader) throws XmlMappingException, IOException {
try {
IUnmarshallingContext unmarshallingContext = createUnmarshallingContext();
return unmarshallingContext.unmarshalDocument(reader);
}
catch (JiBXException ex) {
throw convertJibxException(ex, false);
}
}
示例8: unmarshal
import org.jibx.runtime.IUnmarshallingContext; //导入方法依赖的package包/类
public Object unmarshal(Exchange exchange, InputStream stream) throws Exception {
Class<?> unmarshallType = exchange.getIn().getHeader(UNMARSHALL_CLASS, Class.class);
if (unmarshallType == null) {
unmarshallType = getUnmarshallClass();
}
ObjectHelper.notNull(unmarshallType, "unmarshallClass or CamelJibxUnmarshallClass header");
IBindingFactory bindingFactory = createBindingFactory(unmarshallType, bindingName);
IUnmarshallingContext unmarshallingContext = bindingFactory.createUnmarshallingContext();
return unmarshallingContext.unmarshalDocument(stream, null);
}
示例9: parseXML
import org.jibx.runtime.IUnmarshallingContext; //导入方法依赖的package包/类
public void parseXML() throws JiBXException{
IBindingFactory bfact = BindingDirectory.getFactory(DataExport.class);
IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
try {
m_export = (DataExport)uctx.unmarshalDocument (new FileInputStream(outXMLFileFullName), null);
} catch (Exception e) {
e.printStackTrace();
}
}
示例10: decode0
import org.jibx.runtime.IUnmarshallingContext; //导入方法依赖的package包/类
protected Object decode0(ChannelHandlerContext arg0, ByteBuf body)
throws Exception {
factory = BindingDirectory.getFactory(clazz);
String content = body.toString(UTF_8);
if (isPrint)
System.out.println("The body is : " + content);
reader = new StringReader(content);
IUnmarshallingContext uctx = factory.createUnmarshallingContext();
Object result = uctx.unmarshalDocument(reader);
reader.close();
reader = null;
return result;
}
示例11: decode0
import org.jibx.runtime.IUnmarshallingContext; //导入方法依赖的package包/类
protected Object decode0(ChannelHandlerContext arg0, ByteBuf body)
throws Exception {
factory = BindingDirectory.getFactory(clazz);
String content = body.toString(UTF_8);
if (isPrint)
System.out.println("The body is : " + content);
reader = new StringReader(content);
IUnmarshallingContext uctx = factory.createUnmarshallingContext();
Object result = uctx.unmarshalDocument(reader);
reader.close();
reader = null;
return result;
}
示例12: updateMenusFromXml
import org.jibx.runtime.IUnmarshallingContext; //导入方法依赖的package包/类
public MenuStructure updateMenusFromXml(InputStream in) {
// get from resources:
try {
IUnmarshallingContext unmarshaller = XmlBindingTools.getInstance()
.createUnmarshaller();
MenuStructure menus = (MenuStructure) unmarshaller
.unmarshalDocument(in, null);
return menus;
} catch (JiBXException e) {
freemind.main.Resources.getInstance().logException(e);
throw new IllegalArgumentException(
"Menu structure could not be read.");
}
}
示例13: unMarshall
import org.jibx.runtime.IUnmarshallingContext; //导入方法依赖的package包/类
/**
*/
public XmlAction unMarshall(Reader reader) {
try {
// unmarshall:
IUnmarshallingContext u = XmlBindingTools.getInstance()
.createUnmarshaller();
XmlAction doAction = (XmlAction) u.unmarshalDocument(reader, null);
return doAction;
} catch (JiBXException e) {
freemind.main.Resources.getInstance().logException(e);
return null;
}
}
示例14: getProperties
import org.jibx.runtime.IUnmarshallingContext; //导入方法依赖的package包/类
private Properties getProperties(String xmlPluginFile, String pluginLabel)
throws Exception {
Properties properties = new Properties();
IUnmarshallingContext unmarshaller = XmlBindingTools.getInstance()
.createUnmarshaller();
URL pluginURL = ClassLoader.getSystemResource(xmlPluginFile);
assertNotNull("file " + xmlPluginFile + " found", pluginURL);
// unmarshal xml:
Plugin plugin = null;
InputStream in = pluginURL.openStream();
plugin = (Plugin) unmarshaller.unmarshalDocument(in, null);
for (Iterator iter = plugin.getListChoiceList().iterator(); iter
.hasNext();) {
Object p = iter.next();
if (p instanceof PluginAction) {
PluginAction pl = (PluginAction) p;
if (!pluginLabel.equals(pl.getLabel()))
continue;
for (Iterator iterator = pl.getListChoiceList().iterator(); iterator
.hasNext();) {
Object plObject = (Object) iterator.next();
if (plObject instanceof PluginProperty) {
PluginProperty property = (PluginProperty) plObject;
properties.put(property.getName(), property.getValue());
}
}
break;
}
}
return properties;
}
示例15: testSingleStyle
import org.jibx.runtime.IUnmarshallingContext; //导入方法依赖的package包/类
@Test
public void testSingleStyle() throws JiBXException, LayerException {
IBindingFactory bfact = BindingDirectory.getFactory(StyledLayerDescriptorInfo.class);
IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
Object object = uctx.unmarshalDocument(
getClass().getResourceAsStream("/org/geomajas/testdata/sld/single_layer_no_stylename.sld"), null);
StyledLayerDescriptorInfo sld = (StyledLayerDescriptorInfo) object;
NamedStyleInfo info = styleConverterService.convert(sld.getChoiceList().get(0).getNamedLayer().getChoiceList()
.get(0).getUserStyle(), featureInfo);
Assert.assertNotNull(info);
Assert.assertEquals("Some title", info.getName());
}