本文整理汇总了Java中org.odata4j.stax2.XMLEventReader2.hasNext方法的典型用法代码示例。如果您正苦于以下问题:Java XMLEventReader2.hasNext方法的具体用法?Java XMLEventReader2.hasNext怎么用?Java XMLEventReader2.hasNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.odata4j.stax2.XMLEventReader2
的用法示例。
在下文中一共展示了XMLEventReader2.hasNext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseEdmAssociationSet
import org.odata4j.stax2.XMLEventReader2; //导入方法依赖的package包/类
/**
* parseEdmAssociationSet.
* @param reader reader
* @param associationSetElement associationSetElement
* @return EdmAssociationSet.Builder
*/
private EdmAssociationSet.Builder parseEdmAssociationSet(
XMLEventReader2 reader, StartElement2 associationSetElement) {
String name = associationSetElement.getAttributeByName("Name").getValue();
String associationName = associationSetElement.getAttributeByName("Association").getValue();
List<EdmAssociationSetEnd.Builder> ends = new ArrayList<EdmAssociationSetEnd.Builder>();
while (reader.hasNext()) {
XMLEvent2 event = reader.nextEvent();
if (isStartElement(event, EDM2006_END, EDM2007_END, EDM2008_END, EDM2009_END)) {
ends.add(EdmAssociationSetEnd.newBuilder()
.setRoleName(event.asStartElement().getAttributeByName("Role").getValue())
.setEntitySetName(event.asStartElement().getAttributeByName("EntitySet").getValue()));
}
if (isEndElement(event, associationSetElement.getName())) {
return EdmAssociationSet.newBuilder().setName(name)
.setAssociationName(associationName).setEnds(ends.get(0), ends.get(1));
}
}
throw new UnsupportedOperationException();
}
示例2: parseEdmAssociation
import org.odata4j.stax2.XMLEventReader2; //导入方法依赖的package包/类
/**
* parseEdmAssociation.
* @param reader reader
* @param schemaNamespace schemaNamespace
* @param schemaAlias schemaAlias
* @param associationElement associationElement
* @return EdmAssociation.Builder
*/
private EdmAssociation.Builder parseEdmAssociation(
XMLEventReader2 reader, String schemaNamespace, String schemaAlias, StartElement2 associationElement) {
String name = associationElement.getAttributeByName("Name").getValue();
List<EdmAssociationEnd.Builder> ends = new ArrayList<EdmAssociationEnd.Builder>();
while (reader.hasNext()) {
XMLEvent2 event = reader.nextEvent();
if (isStartElement(event, EDM2006_END, EDM2007_END, EDM2008_END, EDM2009_END)) {
ends.add(EdmAssociationEnd.newBuilder()
.setRole(event.asStartElement().getAttributeByName("Role").getValue())
.setTypeName(event.asStartElement().getAttributeByName("Type").getValue())
.setMultiplicity(EdmMultiplicity.fromSymbolString(
event.asStartElement().getAttributeByName("Multiplicity").getValue())));
}
if (isEndElement(event, associationElement.getName())) {
return EdmAssociation.newBuilder().setNamespace(schemaNamespace).
setAlias(schemaAlias).setName(name).setEnds(ends.get(0), ends.get(1));
}
}
throw new UnsupportedOperationException();
}
示例3: parseCollection
import org.odata4j.stax2.XMLEventReader2; //导入方法依赖的package包/类
private static AtomCollectionInfo parseCollection(String baseUrl, XMLEventReader2 reader, StartElement2 startElement) {
String href = getAttributeValueIfExists(startElement, "href");
String url = urlCombine(baseUrl, href);
String title = null;
String accept = null;
while (reader.hasNext()) {
XMLEvent2 event = reader.nextEvent();
if (event.isEndElement() && event.asEndElement().getName().equals(startElement.getName())) {
return new AtomCollectionInfo(href, url, title, accept);
} else if (isStartElement(event, ATOM_TITLE)) {
title = reader.getElementText();
} else if (isStartElement(event, APP_ACCEPT)) {
accept = reader.getElementText();
}
}
return new AtomCollectionInfo(href, url, title, accept);
}
示例4: parseFeed
import org.odata4j.stax2.XMLEventReader2; //导入方法依赖的package包/类
AtomFeed parseFeed(XMLEventReader2 reader, EdmEntitySet entitySet) {
AtomFeed feed = new AtomFeed();
List<AtomEntry> rt = new ArrayList<AtomEntry>();
while (reader.hasNext()) {
XMLEvent2 event = reader.nextEvent();
if (isStartElement(event, ATOM_ENTRY)) {
rt.add(parseEntry(reader, event.asStartElement(), entitySet));
} else if (isStartElement(event, ATOM_LINK)) {
if ("next".equals(event.asStartElement().getAttributeByName(new QName2("rel")).getValue())) {
feed.next = event.asStartElement().getAttributeByName(new QName2("href")).getValue();
}
} else if (isEndElement(event, ATOM_FEED)) {
// return from a sub feed, if we went down the hierarchy
break;
}
}
feed.entries = Enumerable.create(rt).cast(Entry.class);
return feed;
}
示例5: innerText
import org.odata4j.stax2.XMLEventReader2; //导入方法依赖的package包/类
private static String innerText(XMLEventReader2 reader, StartElement2 element) {
StringWriter sw = new StringWriter();
XMLEventWriter2 writer = XMLFactoryProvider2.getInstance().newXMLOutputFactory2().createXMLEventWriter(sw);
while (reader.hasNext()) {
XMLEvent2 event = reader.nextEvent();
if (event.isEndElement() && event.asEndElement().getName().equals(element.getName())) {
return sw.toString();
} else {
writer.add(event);
}
}
throw new RuntimeException();
}
示例6: parseEdmEntitySet
import org.odata4j.stax2.XMLEventReader2; //导入方法依赖的package包/类
private EdmEntitySet.Builder parseEdmEntitySet(XMLEventReader2 reader, String schemaNamespace, StartElement2 entitySetStartElement) {
List<EdmAnnotation<?>> annotElements = new ArrayList<EdmAnnotation<?>>();
String name = entitySetStartElement.getAttributeByName("Name").getValue();
String entityTypeName = getAttributeValueIfExists(entitySetStartElement, "EntityType");
while (reader.hasNext()) {
XMLEvent2 event = reader.nextEvent();
if (event.isStartElement()) {
EdmAnnotation<?> anElement = getAnnotationElements(event, reader);
if (anElement != null) {
annotElements.add(anElement);
}
}
if (isEndElement(event, entitySetStartElement.getName())) {
return EdmEntitySet.newBuilder()
.setName(name)
.setEntityTypeName(entityTypeName)
.setAnnotations(getAnnotations(entitySetStartElement))
.setAnnotationElements(annotElements);
}
}
throw new UnsupportedOperationException();
}
示例7: parseEdmComplexType
import org.odata4j.stax2.XMLEventReader2; //导入方法依赖的package包/类
/**
* parseEdmComplexType.
* @param reader reader
* @param schemaNamespace schemaNamespace
* @param complexTypeElement complexTypeElement
* @return EdmComplexType.Builder
*/
private EdmComplexType.Builder parseEdmComplexType(
XMLEventReader2 reader, String schemaNamespace, StartElement2 complexTypeElement) {
String name = complexTypeElement.getAttributeByName("Name").getValue();
String isAbstractS = getAttributeValueIfExists(complexTypeElement, "Abstract");
List<EdmProperty.Builder> edmProperties = new ArrayList<EdmProperty.Builder>();
while (reader.hasNext()) {
XMLEvent2 event = reader.nextEvent();
if (isStartElement(event, EDM2006_PROPERTY, EDM2007_PROPERTY, EDM2008_PROPERTY, EDM2009_PROPERTY)) {
edmProperties.add(parseEdmProperty(event));
}
if (isEndElement(event, complexTypeElement.getName())) {
EdmComplexType.Builder complexType = EdmComplexType.newBuilder()
.setNamespace(schemaNamespace).setName(name).addProperties(edmProperties);
if (isAbstractS != null) {
complexType.setIsAbstract("true".equals(isAbstractS));
}
return complexType;
}
}
throw new UnsupportedOperationException();
}
示例8: parseWorkspaces
import org.odata4j.stax2.XMLEventReader2; //导入方法依赖的package包/类
public static Iterable<AtomWorkspaceInfo> parseWorkspaces(XMLEventReader2 reader) {
List<AtomWorkspaceInfo> workspaces = new ArrayList<AtomWorkspaceInfo>();
String baseUrl = null;
while (reader.hasNext()) {
XMLEvent2 event = reader.nextEvent();
if (isStartElement(event, APP_SERVICE)) {
baseUrl = event.asStartElement().getAttributeByName(XML_BASE).getValue();
} else if (isStartElement(event, APP_WORKSPACE)) {
workspaces.add(parseWorkspace(baseUrl, reader, event.asStartElement()));
} else if (isEndElement(event, APP_SERVICE)) {
return workspaces;
}
}
throw new IllegalStateException("Closing service tag not found");
}
示例9: parseWorkspace
import org.odata4j.stax2.XMLEventReader2; //导入方法依赖的package包/类
private static AtomWorkspaceInfo parseWorkspace(String baseUrl, XMLEventReader2 reader, StartElement2 startElement) {
String title = null;
List<AtomCollectionInfo> collections = new ArrayList<AtomCollectionInfo>();
while (reader.hasNext()) {
XMLEvent2 event = reader.nextEvent();
if (isStartElement(event, ATOM_TITLE)) {
title = reader.getElementText();
} else if (event.isEndElement() && event.asEndElement().getName().equals(startElement.getName())) {
return new AtomWorkspaceInfo(title, collections);
} else if (isStartElement(event, APP_COLLECTION)) {
collections.add(parseCollection(baseUrl, reader, event.asStartElement()));
}
}
return new AtomWorkspaceInfo(title, collections);
}
示例10: parseEdmNavigationProperty
import org.odata4j.stax2.XMLEventReader2; //导入方法依赖的package包/类
private EdmNavigationProperty.Builder parseEdmNavigationProperty(XMLEventReader2 reader, XMLEvent2 event) {
List<EdmAnnotation<?>> annotElements = new ArrayList<EdmAnnotation<?>>();
StartElement2 navPropStartElement = event.asStartElement();
String associationName = navPropStartElement.getAttributeByName("Name").getValue();
String relationshipName = navPropStartElement.getAttributeByName("Relationship").getValue();
String fromRoleName = navPropStartElement.getAttributeByName("FromRole").getValue();
String toRoleName = navPropStartElement.getAttributeByName("ToRole").getValue();
Attribute2 containsTargetAttr = navPropStartElement.getAttributeByName("ContainsTarget");
boolean containsTarget = false;
if (containsTargetAttr != null) {
containsTarget = Boolean.parseBoolean(containsTargetAttr.getValue());
}
while (reader.hasNext()) {
event = reader.nextEvent();
if (event.isStartElement()) {
EdmAnnotation<?> anElement = getAnnotationElements(event, reader);
if (anElement != null) {
annotElements.add(anElement);
}
}
if (isEndElement(event, navPropStartElement.getName())) {
return EdmNavigationProperty.newBuilder(associationName)
.setRelationshipName(relationshipName)
.setFromToName(fromRoleName, toRoleName)
.setAnnotations(getAnnotations(navPropStartElement))
.setAnnotationElements(annotElements)
.setContainsTarget(containsTarget);
}
}
throw new UnsupportedOperationException();
}
示例11: getAnnotationElements
import org.odata4j.stax2.XMLEventReader2; //导入方法依赖的package包/类
protected EdmAnnotation<?> getAnnotationElements(XMLEvent2 event, XMLEventReader2 reader) {
StartElement2 annotationStartElement = event.asStartElement();
QName2 q = annotationStartElement.getName();
String value = null;
EdmAnnotationElement<?> element = null;
List<EdmAnnotation<?>> list = new ArrayList<EdmAnnotation<?>>();
if (!Enumerable.create(namespaces).contains(q.getNamespaceUri())) {
// a user extension
while (reader.hasNext()) {
event = reader.nextEvent();
if (event.isStartElement()) {
EdmAnnotation<?> childElement = getAnnotationElements(event, reader);
if (childElement != null) {
list.add(childElement);
}
}
else if (event.isCharacters()) {
value = event.asCharacters().getData().trim();
}
else if (event.isEndElement()) {
if (value != null) {
element = EdmAnnotation.element(q.getNamespaceUri(), q.getPrefix(), q.getLocalPart(), String.class, value);
} else {
element = EdmAnnotation.element(q.getNamespaceUri(), q.getPrefix(), q.getLocalPart(), String.class, "");
}
element.setAnnotationElements(list);
element.setAnnotations(getAnnotations(annotationStartElement));
return element;
}
}
}
return null;
}
示例12: parseLinks
import org.odata4j.stax2.XMLEventReader2; //导入方法依赖的package包/类
public static Iterable<SingleLink> parseLinks(XMLEventReader2 reader) {
List<SingleLink> rt = new ArrayList<SingleLink>();
while (reader.hasNext()) {
XMLEvent2 event = reader.nextEvent();
if (isStartElement(event, URI)) {
rt.add(SingleLinks.create(reader.getElementText()));
}
}
return rt;
}
示例13: parseEdmFunctionParameter
import org.odata4j.stax2.XMLEventReader2; //导入方法依赖的package包/类
private EdmFunctionParameter.Builder parseEdmFunctionParameter(XMLEventReader2 reader, StartElement2 paramStartElement) {
List<EdmAnnotation<?>> annotElements = new ArrayList<EdmAnnotation<?>>();
Attribute2 modeAttribute = paramStartElement.getAttributeByName("Mode");
String nullableS = getAttributeValueIfExists(paramStartElement, "Nullable");
String maxLength = getAttributeValueIfExists(paramStartElement, "MaxLength");
String precision = getAttributeValueIfExists(paramStartElement, "Precision");
String scale = getAttributeValueIfExists(paramStartElement, "Scale");
while (reader.hasNext()) {
XMLEvent2 event = reader.nextEvent();
if (event.isStartElement()) {
EdmAnnotation<?> anElement = getAnnotationElements(event, reader);
if (anElement != null) {
annotElements.add(anElement);
}
}
if (isEndElement(event, paramStartElement.getName())) {
return EdmFunctionParameter.newBuilder()
.setName(paramStartElement.getAttributeByName("Name").getValue())
.setType(EdmType.newDeferredBuilder(paramStartElement.getAttributeByName("Type").getValue(), dataServices))
.setMode(modeAttribute != null ? Mode.valueOf(modeAttribute.getValue()) : null)
.setNullable(nullableS == null ? null : "true".equalsIgnoreCase(nullableS))
.setMaxLength(maxLength == null ? null : maxLength.equals("Max") ? Integer.MAX_VALUE : Integer.parseInt(maxLength))
.setPrecision(precision == null ? null : Integer.parseInt(precision))
.setScale(scale == null ? null : Integer.parseInt(scale))
.setAnnotations(getAnnotations(paramStartElement))
.setAnnotationElements(annotElements);
}
}
throw new UnsupportedOperationException();
}
示例14: parseEdmAssociationSet
import org.odata4j.stax2.XMLEventReader2; //导入方法依赖的package包/类
private EdmAssociationSet.Builder parseEdmAssociationSet(XMLEventReader2 reader, String schemaNamespace, StartElement2 associationSetElement) {
String name = associationSetElement.getAttributeByName("Name").getValue();
String associationName = associationSetElement.getAttributeByName("Association").getValue();
List<EdmAssociationSetEnd.Builder> ends = new ArrayList<EdmAssociationSetEnd.Builder>();
List<EdmAnnotation<?>> annotElements = new ArrayList<EdmAnnotation<?>>();
while (reader.hasNext()) {
XMLEvent2 event = reader.nextEvent();
if (event.isStartElement()) {
if (isElement(event, EDM2006_END, EDM2007_END, EDM2008_1_END, EDM2008_9_END, EDM2009_8_END, EDM2009_11_END)) {
StartElement2 endStartElement = event.asStartElement();
EdmAssociationSetEnd.Builder assocSetEnd = parseEdmAssociationSetEnd(reader, endStartElement);
ends.add(assocSetEnd);
}
else {
EdmAnnotation<?> anElement = getAnnotationElements(event, reader);
if (anElement != null) {
annotElements.add(anElement);
}
}
}
if (isEndElement(event, associationSetElement.getName())) {
return EdmAssociationSet.newBuilder().setName(name).setAssociationName(associationName)
.setEnds(ends.get(0), ends.get(1))
.setAnnotations(getAnnotations(associationSetElement))
.setAnnotationElements(annotElements);
}
}
throw new UnsupportedOperationException();
}
示例15: parseEdmComplexType
import org.odata4j.stax2.XMLEventReader2; //导入方法依赖的package包/类
private EdmComplexType.Builder parseEdmComplexType(XMLEventReader2 reader, String schemaNamespace, StartElement2 complexTypeElement) {
String name = complexTypeElement.getAttributeByName("Name").getValue();
String isAbstractS = getAttributeValueIfExists(complexTypeElement, "Abstract");
String baseType = getAttributeValueIfExists(complexTypeElement, "BaseType");
List<EdmProperty.Builder> edmProperties = new ArrayList<EdmProperty.Builder>();
List<EdmAnnotation<?>> annotElements = new ArrayList<EdmAnnotation<?>>();
while (reader.hasNext()) {
XMLEvent2 event = reader.nextEvent();
if (event.isStartElement()) {
if (isElement(event, EDM2006_PROPERTY, EDM2007_PROPERTY, EDM2008_1_PROPERTY, EDM2008_9_PROPERTY, EDM2009_8_PROPERTY, EDM2009_11_PROPERTY)) {
edmProperties.add(parseEdmProperty(reader, event));
} else {
EdmAnnotation<?> anElement = getAnnotationElements(event, reader);
if (anElement != null) {
annotElements.add(anElement);
}
}
}
if (isEndElement(event, complexTypeElement.getName())) {
EdmComplexType.Builder complexType = EdmComplexType.newBuilder()
.setNamespace(schemaNamespace)
.setName(name)
.setBaseType(baseType)
.addProperties(edmProperties)
.setAnnotations(getAnnotations(complexTypeElement))
.setAnnotationElements(annotElements);
if (isAbstractS != null)
complexType.setIsAbstract("true".equals(isAbstractS));
return complexType;
}
}
throw new UnsupportedOperationException();
}