當前位置: 首頁>>代碼示例>>Java>>正文


Java XmlException類代碼示例

本文整理匯總了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();
}
 
開發者ID:polarsys,項目名稱:eplmp,代碼行數:33,代碼來源:IndexerUtils.java

示例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);
}
 
開發者ID:dpinney,項目名稱:essence,代碼行數:27,代碼來源:MSParser.java

示例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);
	}
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:28,代碼來源:XmlBeansMarshaller.java

示例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;
}
 
開發者ID:williamgrosset,項目名稱:OSCAR-ConCert,代碼行數:20,代碼來源:XMLTransferUtil.java

示例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;
}
 
開發者ID:ObeoNetwork,項目名稱:M2Doc,代碼行數:39,代碼來源:UserContentRawCopy.java

示例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;
}
 
開發者ID:ObeoNetwork,項目名稱:M2Doc,代碼行數:28,代碼來源:UserContentRawCopy.java

示例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();
                }
            }
        }
    }
}
 
開發者ID:EMBL-EBI-SUBS-OLD,項目名稱:subs,代碼行數:25,代碼來源:AttributeValidatorImpl.java

示例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;
    }
 
開發者ID:CenturyLinkCloud,項目名稱:mdw,代碼行數:21,代碼來源:FileListenerRegistration.java

示例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;
}
 
開發者ID:CenturyLinkCloud,項目名稱:mdw,代碼行數:17,代碼來源:AllowableTaskActions.java

示例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;
    }
 
開發者ID:CenturyLinkCloud,項目名稱:mdw,代碼行數:21,代碼來源:TimerTaskRegistration.java

示例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());
    }
}
 
開發者ID:CenturyLinkCloud,項目名稱:mdw,代碼行數:21,代碼來源:InvokeHeterogeneousProcessActivity.java

示例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;
}
 
開發者ID:CenturyLinkCloud,項目名稱:mdw,代碼行數:26,代碼來源:LoaderPersisterVcs.java

示例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();
}
 
開發者ID:CenturyLinkCloud,項目名稱:mdw,代碼行數:23,代碼來源:LoaderPersisterVcs.java

示例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;
}
 
開發者ID:CenturyLinkCloud,項目名稱:mdw,代碼行數:24,代碼來源:LoaderPersisterVcs.java

示例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;
}
 
開發者ID:CenturyLinkCloud,項目名稱:mdw,代碼行數:20,代碼來源:LoaderPersisterVcs.java


注:本文中的org.apache.xmlbeans.XmlException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。