本文整理汇总了Java中javax.xml.bind.PropertyException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyException.printStackTrace方法的具体用法?Java PropertyException.printStackTrace怎么用?Java PropertyException.printStackTrace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.xml.bind.PropertyException
的用法示例。
在下文中一共展示了PropertyException.printStackTrace方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: marshallData
import javax.xml.bind.PropertyException; //导入方法依赖的package包/类
public static void marshallData(IndoorFeaturesType ifs) throws JAXBException {
File file = new File("indoorExample.xml");
JAXBContext jaxbContext = JAXBContext.newInstance(IndoorFeaturesType.class);
Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
try {
jaxbMarshaller.setProperty("com.sun.xml.bind.namespacePrefixMapper", new IndoorGMLNamespaceMapper());
} catch (PropertyException e) {
// In case another JAXB implementation is used
e.printStackTrace();
}
// output pretty printed
jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
jaxbMarshaller.marshal(ifs, file);
jaxbMarshaller.marshal(ifs, System.out);
}
示例2: marshallData
import javax.xml.bind.PropertyException; //导入方法依赖的package包/类
public static void marshallData(FeatureCollectionType ifs) throws JAXBException {
File file = new File("gmltest.gml");
JAXBContext jaxbContext = JAXBContext.newInstance(FeatureCollectionType.class, CustomPointFeatureMember.class, CustomLineFeatureMember.class);
Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
try {
jaxbMarshaller.setProperty("com.sun.xml.bind.namespacePrefixMapper", new GMLNamespaceMapper());
} catch (PropertyException e) {
// In case another JAXB implementation is used
e.printStackTrace();
}
// output pretty printed
jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
net.opengis.gml.v_3_2_1.ObjectFactory gmlObjfact = new net.opengis.gml.v_3_2_1.ObjectFactory();
JAXBElement<?> elem = gmlObjfact.createFeatureCollection(ifs);
jaxbMarshaller.marshal(elem, file);
jaxbMarshaller.marshal(elem, System.out);
}
示例3: decorate
import javax.xml.bind.PropertyException; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
public Marshaller decorate(Marshaller target, Pretty annotation,Class type, Annotation[] annotations, MediaType mediaType) {
try {
target.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
} catch (PropertyException e) {
e.printStackTrace();
}
return target;
}