本文整理汇总了Java中org.jboss.staxmapper.XMLExtendedStreamReader.getElementText方法的典型用法代码示例。如果您正苦于以下问题:Java XMLExtendedStreamReader.getElementText方法的具体用法?Java XMLExtendedStreamReader.getElementText怎么用?Java XMLExtendedStreamReader.getElementText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.staxmapper.XMLExtendedStreamReader
的用法示例。
在下文中一共展示了XMLExtendedStreamReader.getElementText方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parsePropertiesElement
import org.jboss.staxmapper.XMLExtendedStreamReader; //导入方法依赖的package包/类
ModelNode parsePropertiesElement(String identifier, XMLExtendedStreamReader reader) throws XMLStreamException {
// Handle attributes
requireNoAttributes(reader);
ModelNode properties = new ModelNode();
StringBuffer configModel = new StringBuffer();
// Handle elements
while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
if (reader.getNamespaceURI().equals(SwitchYardExtension.NAMESPACE)) {
final Element element = Element.forName(reader.getLocalName());
String name = reader.getLocalName();
String value = reader.getElementText();
if (properties.has(name)) {
throw ExtensionMessages.MESSAGES.alreadyDeclared(element.getLocalName(), reader.getLocation().toString());
}
ModelNode property = new ModelNode();
property.set(value);
properties.get(name).set(property);
configModel.append(element.toString());
}
}
return properties;
}
示例2: parseUser
import org.jboss.staxmapper.XMLExtendedStreamReader; //导入方法依赖的package包/类
private void parseUser(final XMLExtendedStreamReader reader,
final ModelNode usersAddress, final List<ModelNode> list) throws XMLStreamException {
requireSingleAttribute(reader, Attribute.USERNAME.getLocalName());
// After double checking the name of the only attribute we can retrieve it.
final String userName = reader.getAttributeValue(0);
final ModelNode userAddress = usersAddress.clone().add(USER, userName);
ModelNode user = Util.getEmptyOperation(ADD, userAddress);
list.add(user);
String password = null;
while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
requireNamespace(reader, namespace);
final Element element = Element.forName(reader.getLocalName());
switch (element) {
case PASSWORD: {
password = reader.getElementText();
UserResourceDefinition.PASSWORD.parseAndSetParameter(password, user, reader);
break;
}
default: {
throw unexpectedElement(reader);
}
}
}
if (password == null) {
throw missingRequiredElement(reader, EnumSet.of(Element.PASSWORD));
}
}
示例3: parseUser
import org.jboss.staxmapper.XMLExtendedStreamReader; //导入方法依赖的package包/类
private void parseUser(final XMLExtendedStreamReader reader,
final ModelNode usersAddress, final List<ModelNode> list) throws XMLStreamException {
requireSingleAttribute(reader, Attribute.USERNAME.getLocalName());
// After double checking the name of the only attribute we can retrieve it.
final String userName = reader.getAttributeValue(0);
final ModelNode userAddress = usersAddress.clone().add(USER, userName);
ModelNode user = Util.getEmptyOperation(ADD, userAddress);
list.add(user);
boolean hasPassword = false;
while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
requireNamespace(reader, namespace);
final Element element = Element.forName(reader.getLocalName());
switch (element) {
case PASSWORD: {
String password = reader.getElementText();
UserResourceDefinition.PASSWORD.parseAndSetParameter(password, user, reader);
hasPassword = true;
break;
}
case CREDENTIAL_REFERENCE: {
UserResourceDefinition.CREDENTIAL_REFERENCE.getParser().parseElement(UserResourceDefinition.CREDENTIAL_REFERENCE, reader, user);
hasPassword = true;
break;
}
default: {
throw unexpectedElement(reader);
}
}
}
if (!hasPassword) {
throw missingRequiredElement(reader, EnumSet.of(Element.PASSWORD));
}
}
示例4: readElement
import org.jboss.staxmapper.XMLExtendedStreamReader; //导入方法依赖的package包/类
@Override
public void readElement(final XMLExtendedStreamReader reader, final ParseResult result) throws XMLStreamException {
// xsd:sequence
boolean deploymentVisited = false;
while (reader.hasNext()) {
switch (reader.nextTag()) {
case XMLStreamConstants.END_ELEMENT: {
return;
}
case XMLStreamConstants.START_ELEMENT: {
final Element element = Element.of(reader.getName());
switch (element) {
case EAR_SUBDEPLOYMENTS_ISOLATED:
// TODO: This element should only be allowed for jboss-deployment-structure.xml
// of an .ear and *not* for a .war. Should we throw an error for this based on the deployment
// unit type?
String value = reader.getElementText();
if (value == null || value.isEmpty()) {
result.setEarSubDeploymentsIsolated(true);
} else {
result.setEarSubDeploymentsIsolated(Boolean.valueOf(value));
}
break;
case DEPLOYMENT:
if (deploymentVisited) {
throw unexpectedContent(reader);
}
deploymentVisited = true;
parseDeployment(reader, result);
break;
case SUB_DEPLOYMENT:
parseSubDeployment(reader, result);
break;
case MODULE:
parseModule(reader, result);
break;
default:
throw unexpectedContent(reader);
}
break;
}
default: {
throw unexpectedContent(reader);
}
}
}
throw endOfDocument(reader.getLocation());
}
示例5: readElement
import org.jboss.staxmapper.XMLExtendedStreamReader; //导入方法依赖的package包/类
@Override
public void readElement(final XMLExtendedStreamReader reader, final ParseResult result) throws XMLStreamException {
// xsd:sequence
boolean deploymentVisited = false;
while (reader.hasNext()) {
switch (reader.nextTag()) {
case XMLStreamConstants.END_ELEMENT: {
return;
}
case XMLStreamConstants.START_ELEMENT: {
final Element element = Element.of(reader.getName());
switch (element) {
case EAR_SUBDEPLOYMENTS_ISOLATED:
// TODO: This element should only be allowed for jboss-deployment-structure.xml
// of an .ear and *not* for a .war. Should we throw an error for this based on the deployment
// unit type?
final String value = reader.getElementText();
if (value == null || value.isEmpty()) {
result.setEarSubDeploymentsIsolated(true);
} else {
result.setEarSubDeploymentsIsolated(Boolean.valueOf(value));
}
break;
case EAR_EXCLUSIONS_CASCADED_TO_SUBDEPLOYMENTS:
final String cascaded = reader.getElementText();
if (cascaded == null || cascaded.isEmpty()) {
result.setEarExclusionsCascadedToSubDeployments(false);
} else {
result.setEarExclusionsCascadedToSubDeployments(Boolean.valueOf(cascaded));
}
break;
case DEPLOYMENT:
if (deploymentVisited) {
throw unexpectedContent(reader);
}
deploymentVisited = true;
parseDeployment(reader, result);
break;
case SUB_DEPLOYMENT:
parseSubDeployment(reader, result);
break;
case MODULE:
parseModule(reader, result);
break;
default:
throw unexpectedContent(reader);
}
break;
}
default: {
throw unexpectedContent(reader);
}
}
}
throw endOfDocument(reader.getLocation());
}
示例6: readElement
import org.jboss.staxmapper.XMLExtendedStreamReader; //导入方法依赖的package包/类
@Override
public void readElement(final XMLExtendedStreamReader reader, final ParseResult result) throws XMLStreamException {
// xsd:sequence
boolean deploymentVisited = false;
while (reader.hasNext()) {
switch (reader.nextTag()) {
case XMLStreamConstants.END_ELEMENT: {
return;
}
case XMLStreamConstants.START_ELEMENT: {
final Element element = Element.of(reader.getName());
switch (element) {
case EAR_SUBDEPLOYMENTS_ISOLATED:
// TODO: This element should only be allowed for jboss-deployment-structure.xml
// of an .ear and *not* for a .war. Should we throw an error for this based on the deployment
// unit type?
final String value = reader.getElementText();
if (value == null || value.isEmpty()) {
result.setEarSubDeploymentsIsolated(true);
} else {
result.setEarSubDeploymentsIsolated(Boolean.valueOf(value));
}
break;
case DEPLOYMENT:
if (deploymentVisited) {
throw unexpectedContent(reader);
}
deploymentVisited = true;
parseDeployment(reader, result);
break;
case SUB_DEPLOYMENT:
parseSubDeployment(reader, result);
break;
case MODULE:
parseModule(reader, result);
break;
default:
throw unexpectedContent(reader);
}
break;
}
default: {
throw unexpectedContent(reader);
}
}
}
throw endOfDocument(reader.getLocation());
}