当前位置: 首页>>代码示例>>Java>>正文


Java XmlException类代码示例

本文整理汇总了Java中org.kuali.rice.core.api.util.xml.XmlException的典型用法代码示例。如果您正苦于以下问题:Java XmlException类的具体用法?Java XmlException怎么用?Java XmlException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


XmlException类属于org.kuali.rice.core.api.util.xml包,在下文中一共展示了XmlException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findNodeOnXPath

import org.kuali.rice.core.api.util.xml.XmlException; //导入依赖的package包/类
private RoutePathContext findNodeOnXPath( String nodeName, RoutePathContext context,  Node routePathNode ) throws XPathExpressionException, XmlException {
    Node currentNode;

    while (context.nodeQName.length() > 1) {
        context.nodeXPath = context.nodeXPath.substring(0,context.nodeXPath.lastIndexOf("//"));
        context.nodeQName = context.nodeQName.substring(0,context.nodeQName.lastIndexOf(":", context.nodeQName.lastIndexOf(":")-1)+1);
        if (StringUtils.isBlank( context.nodeQName)) {
            context.nodeQName = ":";
        }

        try {
             currentNode = (Node) getXPath().evaluate(context.nodeXPath + "//" + "*[@name = '" + nodeName +"']" , routePathNode, XPathConstants.NODE);
        } catch (XPathExpressionException xpee) {
             LOG.error("Error obtaining routePath for routeNode", xpee);
             throw xpee;
        }

        if (currentNode != null) {
             return  context;
        }
    }

    return context;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:25,代码来源:DocumentTypeXmlParser.java

示例2: parseValidApplicationStatusesHelper

import org.kuali.rice.core.api.util.xml.XmlException; //导入依赖的package包/类
/**
 * Parses the validApplicationStatuses in the doc type (if there are any) and (<b>SIDE EFFECT</b>) adds the
 * results to the given documentType.
 *
 * @param documentType the documentType being built
 * @param documentTypeNode the DOM {@link Node} for the xml representation of the document type
 * @param xpath the XPath object to use for searching within the documentTypeNode
 * @throws XPathExpressionException
 */
private void parseValidApplicationStatusesHelper(DocumentType documentType, Node documentTypeNode, XPath xpath)
        throws XPathExpressionException {
    /*
    * The following code does not need to apply the isOverwrite mode logic because it already checks to see if each node
    * is available on the ingested XML. If the node is ingested then it doesn't matter if we're in overwrite mode or not
    * the ingested code should save.
    */
    NodeList appDocStatusList = (NodeList) xpath.evaluate("./" + APP_DOC_STATUSES, documentTypeNode,
            XPathConstants.NODESET);
    if (appDocStatusList.getLength() > 1) {
        // more than one <validDocumentStatuses> tag is invalid
        throw new XmlException("More than one " + APP_DOC_STATUSES + " node is present in a document type node");

    } else if (appDocStatusList.getLength() > 0) {

        // if there is exactly one <validDocumentStatuses> tag then parse it and use the values
        parseCategoriesAndStatusesHelper(documentType, appDocStatusList);
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:29,代码来源:DocumentTypeXmlParser.java

示例3: updateRuleTemplateDefaultOptions

import org.kuali.rice.core.api.util.xml.XmlException; //导入依赖的package包/类
/**
 * Updates the rule template default options.  Updates any existing options, removes any omitted ones.
 * @param ruleTemplateElement the rule template XML element
 * @param updatedRuleTemplate the RuleTemplate being updated
 * @throws XmlException
 */
/*
 <element name="description" type="c:LongStringType"/>
 <element name="fromDate" type="c:ShortStringType" minOccurs="0"/>
 <element name="toDate" type="c:ShortStringType" minOccurs="0"/>
 <element name="forceAction" type="boolean"/>
 <element name="active" type="boolean"/>
 <element name="defaultActionRequested" type="c:ShortStringType"/>
 <element name="supportsComplete" type="boolean" default="true"/>
 <element name="supportsApprove" type="boolean" default="true"/>
 <element name="supportsAcknowledge" type="boolean" default="true"/>
 <element name="supportsFYI" type="boolean" default="true"/>
*/
protected void updateRuleTemplateDefaultOptions(Element ruleTemplateElement, RuleTemplateBo updatedRuleTemplate) throws XmlException {
    Element defaultsElement = ruleTemplateElement.getChild(RULE_DEFAULTS, RULE_TEMPLATE_NAMESPACE);

    // update the rule defaults; this yields whether or not this is a delegation rule template
    boolean isDelegation = updateRuleDefaults(defaultsElement, updatedRuleTemplate);

    // update the rule template options
    updateRuleTemplateOptions(defaultsElement, updatedRuleTemplate, isDelegation);

}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:29,代码来源:RuleTemplateXmlParser.java

示例4: parseRuleDelegation

import org.kuali.rice.core.api.util.xml.XmlException; //导入依赖的package包/类
private RuleDelegationBo parseRuleDelegation(Element element) throws XmlException {
	RuleDelegationBo ruleDelegation = new RuleDelegationBo();
	Element parentResponsibilityElement = element.getChild(PARENT_RESPONSIBILITY, element.getNamespace());
	if (parentResponsibilityElement == null) {
		throw new XmlException("parent responsibility was not defined");
	}
	String parentResponsibilityId = parseParentResponsibilityId(parentResponsibilityElement);
	String delegationType = element.getChildText(DELEGATION_TYPE, element.getNamespace());
    if (delegationType == null || DelegationType.parseCode(delegationType) == null) {
        throw new XmlException("Invalid delegation type specified for delegate rule '" + delegationType + "'");
    }
    
    ruleDelegation.setResponsibilityId(parentResponsibilityId);
    ruleDelegation.setDelegationType(DelegationType.fromCode(delegationType));
    
    Element ruleElement = element.getChild(RULE, element.getNamespace());
    RuleBaseValues rule = parseRule(ruleElement);
    rule.setDelegateRule(true);
    ruleDelegation.setDelegationRule(rule);
	
	return ruleDelegation;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:23,代码来源:RuleXmlParser.java

示例5: parseParentResponsibilityId

import org.kuali.rice.core.api.util.xml.XmlException; //导入依赖的package包/类
private String parseParentResponsibilityId(Element element) throws XmlException {
	String responsibilityId = element.getChildText(RESPONSIBILITY_ID, element.getNamespace());
	if (!StringUtils.isBlank(responsibilityId)) {
		return responsibilityId;
	}
	String parentRuleName = element.getChildText(PARENT_RULE_NAME, element.getNamespace());
	if (StringUtils.isBlank(parentRuleName)) {
		throw new XmlException("One of responsibilityId or parentRuleName needs to be defined");
	}
	RuleBaseValues parentRule = KEWServiceLocator.getRuleService().getRuleByName(parentRuleName);
	if (parentRule == null) {
		throw new XmlException("Could find the parent rule with name '" + parentRuleName + "'");
	}
	RuleResponsibilityBo ruleResponsibilityNameAndType = CommonXmlParser.parseResponsibilityNameAndType(element);
	if (ruleResponsibilityNameAndType == null) {
		throw new XmlException("Could not locate a valid responsibility declaration for the parent responsibility.");
	}
	String parentResponsibilityId = KEWServiceLocator.getRuleService().findResponsibilityIdForRule(parentRuleName, 
			ruleResponsibilityNameAndType.getRuleResponsibilityName(),
			ruleResponsibilityNameAndType.getRuleResponsibilityType());
	if (parentResponsibilityId == null) {
		throw new XmlException("Failed to locate parent responsibility for rule with name '" + parentRuleName + "' and responsibility " + ruleResponsibilityNameAndType);
	}
	return parentResponsibilityId;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:26,代码来源:RuleXmlParser.java

示例6: parseResponsibilities

import org.kuali.rice.core.api.util.xml.XmlException; //导入依赖的package包/类
private List<RuleResponsibilityBo> parseResponsibilities(Element element, RuleBaseValues rule) throws XmlException {
    if (element == null) {
        return new ArrayList<RuleResponsibilityBo>(0);
    }
    List<RuleResponsibilityBo> existingResponsibilities = rule.getRuleResponsibilities();
    List<RuleResponsibilityBo> responsibilities = new ArrayList<RuleResponsibilityBo>();
    List<Element> responsibilityElements = (List<Element>)element.getChildren(RESPONSIBILITY, element.getNamespace());
    for (Element responsibilityElement : responsibilityElements) {
        RuleResponsibilityBo responsibility = parseResponsibility(responsibilityElement, rule);
        reconcileWithExistingResponsibility(responsibility, existingResponsibilities);
        responsibilities.add(responsibility);
    }
    if (responsibilities.size() == 0) {
        throw new XmlException("Rule responsibility list must have at least one responsibility.");
    }
    return responsibilities;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:18,代码来源:RuleXmlParser.java

示例7: validateContent

import org.kuali.rice.core.api.util.xml.XmlException; //导入依赖的package包/类
/**
 * This method validates the content of a notification message by matching up the namespace of the expected content type
 * to the actual namespace that is passed in as part of the XML message.
 *
 * This is possibly redundant because we are using qualified XPath expressions to obtain content under the correct namespace.
 *
 * @param notification
 * @param contentType
 * @param contentElement
 * @param content
 * @throws IOException
 * @throws XmlException
 */
private void validateContent(NotificationBo notification, String contentType, Element contentElement, String content) throws IOException, XmlException {
    // this debugging relies on a DOM 3 API that is only available with Xerces 2.7.1+ (TypeInfo)
    // commented out for now
    /*LOG.debug(contentElement.getSchemaTypeInfo());
    LOG.debug(contentElement.getSchemaTypeInfo().getTypeName());
    LOG.debug(contentElement.getSchemaTypeInfo().getTypeNamespace());
    LOG.debug(contentElement.getNamespaceURI());
    LOG.debug(contentElement.getLocalName());
    LOG.debug(contentElement.getNodeName());*/

    String contentTypeTitleCase = Character.toTitleCase(contentType.charAt(0)) + contentType.substring(1);
    String expectedNamespaceURI = CONTENT_TYPE_NAMESPACE_PREFIX + contentTypeTitleCase;
    String actualNamespaceURI = contentElement.getNamespaceURI();
    if (!actualNamespaceURI.equals(expectedNamespaceURI)) {
        throw new XmlException("Namespace URI of 'content' node, '" + actualNamespaceURI + "', does not match expected namespace URI, '" + expectedNamespaceURI + "', for content type '" + contentType + "'");
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:31,代码来源:NotificationMessageContentServiceImpl.java

示例8: testSendNotificationAsXml_invalidInput

import org.kuali.rice.core.api.util.xml.XmlException; //导入依赖的package包/类
@Test
public void testSendNotificationAsXml_invalidInput() throws IOException {
    SendNotificationService sendNotificationService = (SendNotificationService) GlobalResourceLoader.getService(new QName(
            KenApiConstants.Namespaces.KEN_NAMESPACE_2_0, "sendNotificationService"));

    final String notificationMessageAsXml = IOUtils.toString(getClass().getResourceAsStream("invalid_input.xml"));

    try {
        sendNotificationService.invoke(notificationMessageAsXml);
        fail("XmlException not thrown");
    } catch (XmlException ixe) {
        // expected
    } catch (WorkflowRuntimeException wre) {
        // expected
    } catch (Exception e) {
        fail("Wrong exception thrown, expected XmlException: " + e);
    }

}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:20,代码来源:SendNotificationServiceImplTest.java

示例9: testSendNotificationAsXml_invalidInput

import org.kuali.rice.core.api.util.xml.XmlException; //导入依赖的package包/类
@Test
public void testSendNotificationAsXml_invalidInput() throws IOException {
    NotificationService nSvc = services.getNotificationService();

    final String notificationMessageAsXml = IOUtils.toString(getClass().getResourceAsStream("invalid_input.xml"));

    try {
        nSvc.sendNotification(notificationMessageAsXml);
        fail("XmlException not thrown");
    } catch (IOException ioe) {
        fail("Wrong exception thrown, expected XmlException: " + ioe);
    } catch (XmlException ixe) {
        // expected
    } catch (Exception e) {
        fail("Wrong exception thrown, expected XmlException: " + e);
    }

}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:19,代码来源:NotificationServiceImplTest.java

示例10: exportStyle

import org.kuali.rice.core.api.util.xml.XmlException; //导入依赖的package包/类
private void exportStyle(Element parentEl, StyleBo style) {
       if (style == null) {
           LOG.error("Attempted to export style which was not found");
           return;
       }

       Element styleWrapperEl = renderer.renderElement(parentEl, STYLE_STYLE);
       renderer.renderAttribute(styleWrapperEl, "name", style.getName());

       try {
           Element styleEl = XmlHelper.buildJDocument(new StringReader(style.getXmlContent())).getRootElement();
           styleWrapperEl.addContent(styleEl.detach());
	} catch (XmlException e) {
		throw new RuntimeException("Error building JDom document for style", e);
	}
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:17,代码来源:StyleXmlExporter.java

示例11: parseStyle

import org.kuali.rice.core.api.util.xml.XmlException; //导入依赖的package包/类
/**
 * Parses an EDocLiteStyle
 *
 * @param e
 *            element to parse
 * @return an EDocLiteStyle
 */
private static Style.Builder parseStyle(Element e) {
    String name = e.getAttribute("name");
    if (name == null || name.length() == 0) {
        throw generateMissingAttribException(XmlConstants.STYLE_STYLE, "name");
    }
    Style.Builder style = Style.Builder.create(name);
    Element stylesheet = null;
    NodeList children = e.getChildNodes();
    for (int i = 0; i < children.getLength(); i++) {
        Node child = children.item(i);
        if (child.getNodeType() == Node.ELEMENT_NODE && "xsl:stylesheet".equals(child.getNodeName())) {
            stylesheet = (Element) child;
            break;
        }
    }
    if (stylesheet == null) {
        throw generateMissingChildException(XmlConstants.STYLE_STYLE, "xsl:stylesheet");
    }
    try {
        style.setXmlContent(XmlJotter.jotNode(stylesheet, true));
    } catch (XmlException te) {
        throw generateSerializationException(XmlConstants.STYLE_STYLE, te);
    }
    return style;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:33,代码来源:StyleXmlParserImpl.java

示例12: loadPluginConfig

import org.kuali.rice.core.api.util.xml.XmlException; //导入依赖的package包/类
protected PluginConfig loadPluginConfig(URL url) {
    PluginConfigParser parser = new PluginConfigParser();
    try {
        PluginConfig pluginConfig  = parser.parse(url, parentConfig);
        pluginConfig.parseConfig();
        return pluginConfig;
    } catch (FileNotFoundException e) {
        throw new PluginException(getLogPrefix() + " Could not locate the plugin config file at path " + url, e);
    } catch (IOException ioe) {
        throw new PluginException(getLogPrefix() + " Could not read the plugin config file", ioe);
    } catch (XmlException ixe) {
        throw new PluginException(getLogPrefix() + " Could not parse the plugin config file", ixe);
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:15,代码来源:BasePluginLoader.java

示例13: parse

import org.kuali.rice.core.api.util.xml.XmlException; //导入依赖的package包/类
public PluginConfig parse(URL url, Config parentConfig) throws IOException, XmlException {
	SAXBuilder builder = new SAXBuilder(false);
	try {
           // NOTE: need to be wary of whether streams are closed properly
           // by builder
		Document doc = builder.build(url);
		Element root = doc.getRootElement();
		PluginConfig pluginConfig = new PluginConfig(url, parentConfig);
		parseResourceLoader(root, pluginConfig);
		parseListeners(root, pluginConfig);
		return pluginConfig;
	} catch (JDOMException e) {
	    throw new PluginException("Error when parsing the plugin config file.", e);
	}
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:16,代码来源:PluginConfigParser.java

示例14: parseResourceLoader

import org.kuali.rice.core.api.util.xml.XmlException; //导入依赖的package包/类
public void parseResourceLoader(Element element, PluginConfig pluginConfig) throws XmlException {
	List loaderElements = element.getChildren(RESOURCE_LOADER_TAG);
	if (loaderElements.size() > 1) {
		throw new XmlException("Only one <resourceLoader> tag may be defined.");
	} else if (!loaderElements.isEmpty()) {
		Element loaderElement = (Element)loaderElements.get(0);
		String attributeClass = loaderElement.getAttributeValue(CLASS_ATTRIBUTE);
		if (StringUtils.isEmpty(attributeClass)) {
			throw new XmlException("<resourceLoader> element must define a 'class' attribute.");
		}
		pluginConfig.setResourceLoaderClassname(attributeClass);
	}
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:14,代码来源:PluginConfigParser.java

示例15: parseListenerProperties

import org.kuali.rice.core.api.util.xml.XmlException; //导入依赖的package包/类
private String parseListenerProperties(Element element) throws XmlException {
	String listenerClass = element.getChildText(LISTENER_CLASS_TAG);
	if (org.apache.commons.lang.StringUtils.isEmpty(listenerClass)) {
		throw new XmlException("Listener Class tag must have a class property defined");
	}
	return listenerClass;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:8,代码来源:PluginConfigParser.java


注:本文中的org.kuali.rice.core.api.util.xml.XmlException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。