本文整理汇总了Java中org.apache.xmlbeans.XmlException类的典型用法代码示例。如果您正苦于以下问题:Java XmlException类的具体用法?Java XmlException怎么用?Java XmlException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XmlException类属于org.apache.xmlbeans包,在下文中一共展示了XmlException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: microsoftExcelDocumentToString
import org.apache.xmlbeans.XmlException; //导入依赖的package包/类
private static String microsoftExcelDocumentToString(InputStream inputStream) throws IOException, OpenXML4JException, XmlException {
StringBuilder sb = new StringBuilder();
try (InputStream excelStream = new BufferedInputStream(inputStream)) {
if (POIFSFileSystem.hasPOIFSHeader(excelStream)) { // Before 2007 format files
POIFSFileSystem excelFS = new POIFSFileSystem(excelStream);
ExcelExtractor excelExtractor = new ExcelExtractor(excelFS);
sb.append(excelExtractor.getText());
excelExtractor.close();
} else { // New format
XSSFWorkbook workBook = new XSSFWorkbook(excelStream);
int numberOfSheets = workBook.getNumberOfSheets();
for (int i = 0; i < numberOfSheets; i++) {
XSSFSheet sheet = workBook.getSheetAt(0);
Iterator<Row> rowIterator = sheet.rowIterator();
while (rowIterator.hasNext()) {
XSSFRow row = (XSSFRow) rowIterator.next();
Iterator<Cell> cellIterator = row.cellIterator();
while (cellIterator.hasNext()) {
XSSFCell cell = (XSSFCell) cellIterator.next();
sb.append(cell.toString());
sb.append(" ");
}
sb.append("\n");
}
sb.append("\n");
}
}
}
return sb.toString();
}
示例2: main
import org.apache.xmlbeans.XmlException; //导入依赖的package包/类
public static void main(String[] args) throws XmlException {
/* process all WSDLs in v5
CURRENT_SERVICE_VERSION = MSPServiceOperationKey.SUPPORTED_VERSION_5;
List<String> wsdls = MultiSpeakOperationsExtractor.getListOfWSDLs();
for (int i=39; i<40; i++) {
System.out.println((i+1) + " - " + wsdls.get(i));
MSParser parser = new MSParser(wsdls.get(i));
}
*/
//* process all WSDLs in v3
CURRENT_SERVICE_VERSION = MSPServiceOperationKey.SUPPORTED_VERSION_3;
List<String> wsdls = MultiSpeakOperationsExtractor.getListOfWSDLs3();
for (int i=0; i<wsdls.size(); i++) {
//if (wsdls.get(i).contains("PP_Server")) {
//if (i == 22) {//7 EA; 10 FA; 11- GIS; 14-MDM; 16-OA; 21-SGV; 22 staking
System.out.println((i+1) + " - " + wsdls.get(i));
MSParser parser = new MSParser(wsdls.get(i));
//}
//}
}
//MSParser parser = new MSParser("file:///C:/Users/pning/Documents/NRECA/reading and research/v5/MultiSpeakV503RCEndpoints-WSDLfiles/EndPoints/AM_Server/AM_Server.wsdl");
// "file:///C:/Users/cpassarello/Documents/Projects/DOE/essense/essence-frontend/MultiSpeak-V503RC_Endpoints-WSDLs/EndPoints/AM_Server/AM_Server.wsdl");
System.exit(0);
}
示例3: convertXmlBeansException
import org.apache.xmlbeans.XmlException; //导入依赖的package包/类
/**
* Convert the given XMLBeans exception to an appropriate exception from the
* {@code org.springframework.oxm} hierarchy.
* <p>A boolean flag is used to indicate whether this exception occurs during marshalling or
* unmarshalling, since XMLBeans itself does not make this distinction in its exception hierarchy.
* @param ex XMLBeans Exception that occured
* @param marshalling indicates whether the exception occurs during marshalling ({@code true}),
* or unmarshalling ({@code false})
* @return the corresponding {@code XmlMappingException}
*/
protected XmlMappingException convertXmlBeansException(Exception ex, boolean marshalling) {
if (ex instanceof XMLStreamValidationException) {
return new ValidationFailureException("XMLBeans validation exception", ex);
}
else if (ex instanceof XmlException || ex instanceof SAXException) {
if (marshalling) {
return new MarshallingFailureException("XMLBeans marshalling exception", ex);
}
else {
return new UnmarshallingFailureException("XMLBeans unmarshalling exception", ex);
}
}
else {
// fallback
return new UncategorizedMappingException("Unknown XMLBeans exception", ex);
}
}
示例4: validateDoc
import org.apache.xmlbeans.XmlException; //导入依赖的package包/类
public ArrayList validateDoc(HsfoHbpsDataDocument doc) throws IOException,
XmlException
{
if (logger.isDebugEnabled())
logger.debug("<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "\n"
+ PrettyPrinter.indent(doc.xmlText()));
ArrayList messageArray = new ArrayList();
XmlOptions option = new XmlOptions();
ArrayList validationErrors = new ArrayList();
option.setErrorListener(validationErrors);
if (doc.validate(option) == false)
{
String sb = printErrors(validationErrors);
messageArray.add(sb);
return messageArray;
} else
return messageArray;
}
示例5: copy
import org.apache.xmlbeans.XmlException; //导入依赖的package包/类
/**
* Copy.
*
* @param userContent
* UserContent EObject
* @param outputParagraphBeforeUserDocContent
* Output Paragraph Before User Doc Dest content (User Code dest is writen by {@link M2DocEvaluator} )
* @return last paragraph created by copy
* @throws InvalidFormatException
* InvalidFormatException
* @throws XmlException
* XmlException
* @throws IOException
* if the copy fails
*/
public XWPFParagraph copy(UserContent userContent, XWPFParagraph outputParagraphBeforeUserDocContent)
throws InvalidFormatException, XmlException, IOException {
// Test if run before userContent is in same XWPFParagraph than first run of userContent
final XWPFParagraph previousInputParagraph = (XWPFParagraph) userContent.getRuns()
.get(userContent.getRuns().size() - 1).getParent();
XWPFParagraph currentInputParagraph = previousInputParagraph;
final List<Statement> statements = userContent.getBody().getStatements();
XWPFParagraph currentOutputParagraph = copyStatements(outputParagraphBeforeUserDocContent,
currentInputParagraph, previousInputParagraph, statements);
// test if the last statement last run is different from the closing run
if (!userContent.getClosingRuns().isEmpty() && !statements.isEmpty()) {
final Statement lastStatment = statements.get(statements.size() - 1);
if (!lastStatment.getRuns().isEmpty()) {
needNewParagraph = lastStatment.getRuns().get(lastStatment.getRuns().size() - 1)
.getParent() != userContent.getClosingRuns().get(0).getParent();
}
}
return currentOutputParagraph;
}
示例6: getXmlWithOuputId
import org.apache.xmlbeans.XmlException; //导入依赖的package包/类
/**
* Get Xml With Ouput picture Id.
*
* @param inputPicuteIdToOutputmap
* the picture ID mapping
* @param xmlText
* xmlText
* @return Xml With Ouput picture Id
* @throws XmlException
* XmlException
*/
private XmlToken getXmlWithOuputId(Map<String, String> inputPicuteIdToOutputmap, String xmlText)
throws XmlException {
String outputXmlStr = xmlText;
for (Map.Entry<String, String> entry : inputPicuteIdToOutputmap.entrySet()) {
String inputID = entry.getKey();
String outputID = entry.getValue();
outputXmlStr = outputXmlStr.replaceAll("<a:blip r:embed=\"" + inputID + "\"",
"<a:blip r:embed=NEW\"" + outputID + "\"");
}
// Clean build string
outputXmlStr = outputXmlStr.replaceAll("<a:blip r:embed=NEW", "<a:blip r:embed=");
XmlToken outputXmlObject = null;
outputXmlObject = XmlToken.Factory.parse(outputXmlStr);
return outputXmlObject;
}
示例7: AttributeValidatorImpl
import org.apache.xmlbeans.XmlException; //导入依赖的package包/类
public AttributeValidatorImpl(CHECKLISTSETDocument ChecklistSetDocument) throws XmlException {
super("checklist");
if (ChecklistSetDocument.getCHECKLISTSET() != null) {
final ChecklistType[] checklistArray = ChecklistSetDocument.getCHECKLISTSET().getCHECKLISTArray();
if (checklistArray != null && checklistArray.length > 0) {
this.checklistType = checklistArray[0];
} else {
throw new XmlException("No checklist element found in checklist_set");
}
} else {
throw new XmlException("No checklist_set found");
}
final ChecklistType.DESCRIPTOR.FIELDGROUP[] fieldgroupArray = checklistType.getDESCRIPTOR().getFIELDGROUPArray();
if (fieldgroupArray != null) {
for (ChecklistType.DESCRIPTOR.FIELDGROUP fieldGroup : fieldgroupArray) {
final ChecklistType.DESCRIPTOR.FIELDGROUP.FIELD[] fieldArray = fieldGroup.getFIELDArray();
if (fieldArray != null) {
for (ChecklistType.DESCRIPTOR.FIELDGROUP.FIELD field : fieldArray) {
final ChecklistType.DESCRIPTOR.FIELDGROUP.FIELD.FIELDTYPE fieldtype = field.getFIELDTYPE();
}
}
}
}
}
示例8: getFileListeners
import org.apache.xmlbeans.XmlException; //导入依赖的package包/类
private Map<String, Properties> getFileListeners() throws XmlException, IOException, PropertyException {
Map<String, Properties> fileListeners = new HashMap<String, Properties>();
Properties fileListenerProperties = PropertyManager.getInstance().getProperties(PropertyNames.MDW_LISTENER_FILE);
for (String pn : fileListenerProperties.stringPropertyNames()) {
String[] pnParsed = pn.split("\\.");
if (pnParsed.length==5) {
String name = pnParsed[3];
String attrname = pnParsed[4];
Properties procspec = fileListeners.get(name);
if (procspec==null) {
procspec = new Properties();
fileListeners.put(name, procspec);
}
String value = fileListenerProperties.getProperty(pn);
procspec.put(attrname, value);
}
}
return fileListeners;
}
示例9: getTaskStatusAllowableActions
import org.apache.xmlbeans.XmlException; //导入依赖的package包/类
public static Map<String,List<TaskAction>> getTaskStatusAllowableActions() throws IOException, XmlException {
if (taskStatusAllowableActions == null) {
taskStatusAllowableActions = new HashMap<String,List<TaskAction>>();
for (TaskActionStatus taskActionStatus : getTaskActions().getTaskDetailActions().getTaskStatusList()) {
String status = taskActionStatus.getStatus();
List<TaskAction> taskActions = new ArrayList<TaskAction>();
taskStatusAllowableActions.put(status, taskActions);
for (AllowableAction allowableAction: taskActionStatus.getAllowableActionList()) {
TaskAction taskAction = convertToJsonable(allowableAction);
if (!taskActions.contains(taskAction))
taskActions.add(taskAction);
}
}
}
return taskStatusAllowableActions;
}
示例10: getAllScheduledEvents
import org.apache.xmlbeans.XmlException; //导入依赖的package包/类
private Map<String, Properties> getAllScheduledEvents() throws IOException, XmlException, PropertyException {
Map<String, Properties> timerTasks = new HashMap<String, Properties>();
Properties timerTasksProperties = PropertyManager.getInstance().getProperties(PropertyNames.MDW_TIMER_TASK);
for (String pn : timerTasksProperties.stringPropertyNames()) {
String[] pnParsed = pn.split("\\.");
if (pnParsed.length==5) {
String name = pnParsed[3];
String attrname = pnParsed[4];
Properties procspec = timerTasks.get(name);
if (procspec==null) {
procspec = new Properties();
timerTasks.put(name, procspec);
}
String value = timerTasksProperties.getProperty(pn);
procspec.put(attrname, value);
}
}
return timerTasks;
}
示例11: getProcessExecutionPlan
import org.apache.xmlbeans.XmlException; //导入依赖的package包/类
protected ProcessExecutionPlanDocument getProcessExecutionPlan()
throws ActivityException, XmlException {
String plan_varname = getAttributeValue(EXECUTION_PLAN_VARIABLE);
Object binding = this.getParameterValue(plan_varname);
if (binding==null || ! (binding instanceof DocumentReference))
throw new ActivityException("InvokeHeterogenenousProcess: "
+ "control variable is not bound to a process plan");
DocumentReference docref = (DocumentReference)binding;
binding = super.getDocumentForUpdate(docref, getParameterType(plan_varname));
if (binding instanceof ProcessExecutionPlanDocument) {
return (ProcessExecutionPlanDocument)binding;
} else if (binding instanceof XmlObject) {
return (ProcessExecutionPlanDocument)((XmlObject)binding).changeType(ProcessExecutionPlanDocument.type);
} else {
Variable docVar = getProcessDefinition().getVariable(plan_varname);
XmlDocumentTranslator docRefTrans = (XmlDocumentTranslator)VariableTranslator.getTranslator(getPackage(), docVar.getType());
Document doc = docRefTrans.toDomDocument(binding);
return ProcessExecutionPlanDocument.Factory.parse(doc, Compatibility.namespaceOptions());
}
}
示例12: loadPackage
import org.apache.xmlbeans.XmlException; //导入依赖的package包/类
public Package loadPackage(PackageDir pkgDir, boolean deep) throws IOException, XmlException, JSONException, DataAccessException {
Package packageVO = new Package();
packageVO.setName(pkgDir.getPackageName());
packageVO.setVersion(Package.parseVersion(pkgDir.getPackageVersion()));
packageVO.setSchemaVersion(Package.parseVersion(pkgDir.getSchemaVersion()));
packageVO.setId(versionControl.getId(pkgDir.getLogicalDir()));
packageVO.setSchemaVersion(DataAccess.currentSchemaVersion);
String pkgJson = new String(read(pkgDir.getMetaFile()));
Package jsonPkg = new Package(new JsonObject(pkgJson));
packageVO.setGroup(jsonPkg.getGroup());
packageVO.setAttributes(jsonPkg.getAttributes());
packageVO.setMetaContent(pkgJson);
packageVO.setProcesses(loadProcesses(pkgDir, deep));
packageVO.setAssets(loadAssets(pkgDir, deep));
packageVO.setImplementors(loadActivityImplementors(pkgDir));
packageVO.setExternalEvents(loadExternalEventHandlers(pkgDir));
packageVO.setTaskTemplates(loadTaskTemplates(pkgDir));
packageVO.setArchived(pkgDir.isArchive());
return packageVO;
}
示例13: save
import org.apache.xmlbeans.XmlException; //导入依赖的package包/类
public long save(Package packageVO, PackageDir pkgDir, boolean deep) throws IOException, XmlException, JSONException, DataAccessException {
File mdwDir = new File(pkgDir + "/.mdw");
if (!mdwDir.exists()) {
if (!mdwDir.mkdirs())
throw new IOException("Unable to create metadata directory under: " + pkgDir);
}
String pkgContent = packageVO.getJson(false).toString(2);
write(pkgContent.getBytes(), pkgDir.getMetaFile());
packageVO.setId(versionControl.getId(pkgDir.getLogicalDir()));
if (deep) {
saveActivityImplementors(packageVO, pkgDir);
saveExternalEventHandlers(packageVO, pkgDir);
saveAssets(packageVO, pkgDir);
saveTaskTemplates(packageVO, pkgDir);
saveProcesses(packageVO, pkgDir); // also saves v0 task templates
}
return packageVO.getPackageId();
}
示例14: loadProcess
import org.apache.xmlbeans.XmlException; //导入依赖的package包/类
public Process loadProcess(PackageDir pkgDir, AssetFile assetFile, boolean deep) throws IOException, XmlException, JSONException, DataAccessException {
Process process;
if (deep) {
String content = new String(read(assetFile));
process = new Process(new JsonObject(content));
}
else {
process = new Process();
}
process.setId(assetFile.getId());
int lastDot = assetFile.getName().lastIndexOf('.');
process.setName(assetFile.getName().substring(0, lastDot));
process.setLanguage(Asset.PROCESS);
process.setRawFile(assetFile);
process.setVersion(assetFile.getRevision().getVersion());
process.setModifyDate(assetFile.getRevision().getModDate());
process.setModifyingUser(assetFile.getRevision().getModUser());
process.setRevisionComment(assetFile.getRevision().getComment());
process.setPackageName(pkgDir.getPackageName());
return process;
}
示例15: loadAsset
import org.apache.xmlbeans.XmlException; //导入依赖的package包/类
public Asset loadAsset(PackageDir pkgDir, AssetFile assetFile, boolean deep) throws IOException, XmlException {
Asset asset = new Asset();
asset.setId(assetFile.getId());
asset.setPackageName(pkgDir.getPackageName());
asset.setName(assetFile.getName());
asset.setLanguage(Asset.getFormat(assetFile.getName()));
asset.setVersion(assetFile.getRevision().getVersion());
asset.setLoadDate(new Date());
asset.setModifyDate(assetFile.getRevision().getModDate());
asset.setRevisionComment(assetFile.getRevision().getComment());
asset.setRawFile(assetFile);
if (deep) {
asset.setRaw(true);
// do not load jar assets into memory
if (!Asset.excludedFromMemoryCache(assetFile.getName()))
asset.setRawContent(read(assetFile));
}
return asset;
}