本文整理匯總了Java中org.opensaml.xml.util.XMLConstants類的典型用法代碼示例。如果您正苦於以下問題:Java XMLConstants類的具體用法?Java XMLConstants怎麽用?Java XMLConstants使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
XMLConstants類屬於org.opensaml.xml.util包,在下文中一共展示了XMLConstants類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: constructStringRepresentation
import org.opensaml.xml.util.XMLConstants; //導入依賴的package包/類
/** Constructs an XML namespace declaration string representing this namespace. */
protected void constructStringRepresentation() {
StringBuffer stringRep = new StringBuffer();
stringRep.append(XMLConstants.XMLNS_PREFIX);
if (namespacePrefix != null) {
stringRep.append(":");
stringRep.append(namespacePrefix);
}
stringRep.append("=\"");
if (namespaceURI != null) {
stringRep.append(namespaceURI);
}
stringRep.append("\"");
nsStr = stringRep.toString();
}
示例2: getHMACOutputLengthValue
import org.opensaml.xml.util.XMLConstants; //導入依賴的package包/類
/**
* Find and return the integer value contained within the HMACOutputLength element, if present.
*
* @param signatureMethodElement the ds:SignatureMethod element
* @return the HMAC output length value, or null if not present
*/
private Integer getHMACOutputLengthValue(Element signatureMethodElement) {
if (signatureMethodElement == null) {
return null;
}
// Should be at most one element
List<Element> children = XMLHelper.getChildElementsByTagNameNS(signatureMethodElement, XMLConstants.XMLSIG_NS,
"HMACOutputLength");
if (!children.isEmpty()) {
Element hmacElement = children.get(0);
String value = DatatypeHelper.safeTrimOrNullString(hmacElement.getTextContent());
if (value != null) {
return new Integer(value);
}
}
return null;
}
示例3: isSigned
import org.opensaml.xml.util.XMLConstants; //導入依賴的package包/類
/** {@inheritDoc} */
public boolean isSigned() {
Element domElement = getDOM();
if (domElement == null) {
return false;
}
Element childElement = XMLHelper.getFirstChildElement(domElement);
while (childElement != null) {
if (XMLHelper.isElementNamed(childElement, XMLConstants.XMLSIG_NS, Signature.DEFAULT_ELEMENT_LOCAL_NAME)) {
return true;
}
childElement = XMLHelper.getNextSiblingElement(childElement);
}
return false;
}
示例4: XMLConfigurator
import org.opensaml.xml.util.XMLConstants; //導入依賴的package包/類
/**
* Constructor.
*
* @param retainXML whether to retain the XML configuration elements within the {@link Configuration}.
*
* @throws ConfigurationException thrown if the validation schema for configuration files can not be created
*
* @deprecated this method will be removed once {@link Configuration} no longer has the option to store the XML configuration fragements
*/
public XMLConfigurator(boolean retainXML) throws ConfigurationException {
retainXMLConfiguration = retainXML;
parserPool = new BasicParserPool();
SchemaFactory factory = SchemaFactory.newInstance(javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI);
Source schemaSource = new StreamSource(XMLConfigurator.class
.getResourceAsStream(XMLConstants.XMLTOOLING_SCHEMA_LOCATION));
try {
configurationSchema = factory.newSchema(schemaSource);
parserPool.setIgnoreComments(true);
parserPool.setIgnoreElementContentWhitespace(true);
parserPool.setSchema(configurationSchema);
} catch (SAXException e) {
throw new ConfigurationException("Unable to read XMLTooling configuration schema", e);
}
}
示例5: unmarshallSchemaInstanceAttributes
import org.opensaml.xml.util.XMLConstants; //導入依賴的package包/類
/**
* Unmarshalls the XSI type, schemaLocation, and noNamespaceSchemaLocation attributes.
*
* @param xmlObject the xmlObject to recieve the namespace decleration
* @param attribute the namespace decleration attribute
*/
protected void unmarshallSchemaInstanceAttributes(XMLObject xmlObject, Attr attribute) {
QName attribName = XMLHelper.getNodeQName(attribute);
if (XMLConstants.XSI_TYPE_ATTRIB_NAME.equals(attribName)) {
log.trace("Saw XMLObject {} with an xsi:type of: {}", xmlObject.getElementQName(), attribute.getValue());
} else if (XMLConstants.XSI_SCHEMA_LOCATION_ATTRIB_NAME.equals(attribName)) {
log.trace("Saw XMLObject {} with an xsi:schemaLocation of: {}", xmlObject.getElementQName(),
attribute.getValue());
xmlObject.setSchemaLocation(attribute.getValue());
} else if (XMLConstants.XSI_NO_NAMESPACE_SCHEMA_LOCATION_ATTRIB_NAME.equals(attribName)) {
log.trace("Saw XMLObject {} with an xsi:noNamespaceSchemaLocation of: {}", xmlObject.getElementQName(),
attribute.getValue());
xmlObject.setNoNamespaceSchemaLocation(attribute.getValue());
} else if (XMLConstants.XSI_NIL_ATTRIB_NAME.equals(attribName)) {
log.trace("Saw XMLObject {} with an xsi:nil of: {}", xmlObject.getElementQName(),
attribute.getValue());
xmlObject.setNil(XSBooleanValue.valueOf(attribute.getValue()));
}
}
示例6: setNil
import org.opensaml.xml.util.XMLConstants; //導入依賴的package包/類
/** {@inheritDoc} */
public void setNil(Boolean newNil) {
if (newNil != null) {
nil = prepareForAssignment(nil, new XSBooleanValue(newNil, false));
} else {
nil = prepareForAssignment(nil, null);
}
manageQualifiedAttributeNamespace(XMLConstants.XSI_NIL_ATTRIB_NAME, nil != null);
}
示例7: validateChildrenNamespaces
import org.opensaml.xml.util.XMLConstants; //導入依賴的package包/類
/**
* Validate that all children are either ones defined within the XML Signature schema,
* or are from another namespace.
*
* @param xmlObject the object to validate
* @throws ValidationException thrown if the object is invalid
*/
protected void validateChildrenNamespaces(PGPData xmlObject) throws ValidationException {
// Validate that any unknown children are from another namespace.
for (XMLObject child : xmlObject.getUnknownXMLObjects()) {
QName childName = child.getElementQName();
if (! getValidDSChildNames().contains(childName)
&& XMLConstants.XMLSIG_NS.equals(childName.getNamespaceURI())) {
throw new ValidationException("PGPData contains an illegal child extension element: " + childName);
}
}
}
示例8: validateChildrenNamespaces
import org.opensaml.xml.util.XMLConstants; //導入依賴的package包/類
/**
* Validate that all children are either ones defined within the XML Signature schema,
* or are from another namespace.
*
* @param xmlObject the object to validate
* @throws ValidationException thrown if the object is invalid
*/
protected void validateChildrenNamespaces(KeyInfoType xmlObject) throws ValidationException {
// Validate that any children are either the ones from the dsig schema,
// or are from another namespace.
for (XMLObject child : xmlObject.getXMLObjects()) {
QName childName = child.getElementQName();
if (! getValidDSChildNames().contains(childName)
&& XMLConstants.XMLSIG_NS.equals(childName.getNamespaceURI())) {
throw new ValidationException("KeyInfoType contains an illegal child extension element: " + childName);
}
}
}
示例9: validateChildrenNamespaces
import org.opensaml.xml.util.XMLConstants; //導入依賴的package包/類
/**
* Validate that all children are either ones defined within the XML Signature schema,
* or are from another namespace.
*
* @param xmlObject the object to validate
* @throws ValidationException thrown if the object is invalid
*/
protected void validateChildrenNamespaces(SPKIData xmlObject) throws ValidationException {
// Validate that any children are either the ones from the dsig schema,
// or are from another namespace.
for (XMLObject child : xmlObject.getXMLObjects()) {
QName childName = child.getElementQName();
if (! SPKISexp.DEFAULT_ELEMENT_NAME.equals(childName)
&& XMLConstants.XMLSIG_NS.equals(childName.getNamespaceURI())) {
throw new ValidationException("PGPData contains an illegal child extension element: " + childName);
}
}
}
示例10: validateExtensionChildNamespace
import org.opensaml.xml.util.XMLConstants; //導入依賴的package包/類
/**
* Validate that the extension child, if present, is from another namespace.
*
* @param xmlObject the object to validate
* @throws ValidationException thrown if the object is invalid
*/
protected void validateExtensionChildNamespace(KeyValue xmlObject) throws ValidationException {
// Validate that the unknown child is not from the dsig namespace
// or are from another namespace.
XMLObject unknownChild = xmlObject.getUnknownXMLObject();
if (unknownChild == null) {
return;
}
QName childName = unknownChild.getElementQName();
if (XMLConstants.XMLSIG_NS.equals(childName.getNamespaceURI())) {
throw new ValidationException("KeyValue contains an illegal child extension element: " + childName);
}
}
示例11: validateChildrenNamespaces
import org.opensaml.xml.util.XMLConstants; //導入依賴的package包/類
/**
* Validate that all children are either ones defined within the XML Signature schema,
* or are from another namespace.
*
* @param xmlObject the object to validate
* @throws ValidationException thrown if the object is invalid
*/
protected void validateChildrenNamespaces(X509Data xmlObject) throws ValidationException {
// Validate that any children are either the ones from the dsig schema,
// or are from another namespace.
for (XMLObject child : xmlObject.getXMLObjects()) {
QName childName = child.getElementQName();
if (! getValidDSChildNames().contains(childName)
&& XMLConstants.XMLSIG_NS.equals(childName.getNamespaceURI())) {
throw new ValidationException("X509Data contains an illegal child extension element: " + childName);
}
}
}
示例12: load
import org.opensaml.xml.util.XMLConstants; //導入依賴的package包/類
/**
* Loads a configuration after it's been schema validated.
*
* @param configurationRoot root of the configuration
*
* @throws ConfigurationException thrown if there is a problem processing the configuration
*/
protected void load(Element configurationRoot) throws ConfigurationException {
// Initialize object providers
NodeList objectProviders = configurationRoot.getElementsByTagNameNS(XMLConstants.XMLTOOLING_CONFIG_NS,
"ObjectProviders");
if (objectProviders.getLength() > 0) {
log.debug("Preparing to load ObjectProviders");
initializeObjectProviders((Element) objectProviders.item(0));
log.debug("ObjectProviders load complete");
}
// Initialize validator suites
NodeList validatorSuitesNodes = configurationRoot.getElementsByTagNameNS(XMLConstants.XMLTOOLING_CONFIG_NS,
"ValidatorSuites");
if (validatorSuitesNodes.getLength() > 0) {
log.debug("Preparing to load ValidatorSuites");
initializeValidatorSuites((Element) validatorSuitesNodes.item(0));
log.debug("ValidatorSuites load complete");
}
// Initialize ID attributes
NodeList idAttributesNodes = configurationRoot.getElementsByTagNameNS(XMLConstants.XMLTOOLING_CONFIG_NS,
"IDAttributes");
if (idAttributesNodes.getLength() > 0) {
log.debug("Preparing to load IDAttributes");
initializeIDAttributes((Element) idAttributesNodes.item(0));
log.debug("IDAttributes load complete");
}
}
示例13: validateChildrenNamespaces
import org.opensaml.xml.util.XMLConstants; //導入依賴的package包/類
/**
* Validate that all children are from another namespace.
*
* @param xmlObject the object to validate
* @throws ValidationException thrown if the object is invalid
*/
protected void validateChildrenNamespaces(ReferenceType xmlObject) throws ValidationException {
// Validate that any children are from another namespace.
for (XMLObject child : xmlObject.getUnknownXMLObjects()) {
QName childName = child.getElementQName();
if (XMLConstants.XMLENC_NS.equals(childName.getNamespaceURI())) {
throw new ValidationException("ReferenceType contains an illegal child extension element: " + childName);
}
}
}
示例14: validateChildrenNamespaces
import org.opensaml.xml.util.XMLConstants; //導入依賴的package包/類
/**
* Validate that all children are from another namespace.
*
* @param xmlObject the object to validate
* @throws ValidationException thrown if the object is invalid
*/
protected void validateChildrenNamespaces(EncryptionProperty xmlObject) throws ValidationException {
// Validate that any children are from another namespace.
for (XMLObject child : xmlObject.getUnknownXMLObjects()) {
QName childName = child.getElementQName();
if (XMLConstants.XMLENC_NS.equals(childName.getNamespaceURI())) {
throw new ValidationException("EncryptionProperty contains an illegal child extension element: " + childName);
}
}
}
示例15: validateAttributeNamespaces
import org.opensaml.xml.util.XMLConstants; //導入依賴的package包/類
/**
* Validate that any wildcard attributes are from the
* XML namespace <code>http://www.w3.org/XML/1998/namespace</code>.
*
* @param xmlObject the object to validate
* @throws ValidationException thrown if the object is invalid
*/
protected void validateAttributeNamespaces(EncryptionProperty xmlObject) throws ValidationException {
// Validate that any extension attribute are from the XML namespace
for (QName attribName : xmlObject.getUnknownAttributes().keySet()) {
if (! XMLConstants.XML_NS.equals(attribName.getNamespaceURI())) {
throw new ValidationException("EncryptionProperty contains an illegal extension attribute: " + attribName);
}
}
}