List of usage examples for javax.xml.stream XMLStreamConstants START_ELEMENT
int START_ELEMENT
To view the source code for javax.xml.stream XMLStreamConstants START_ELEMENT.
Click Source Link
From source file:org.slc.sli.modeling.xmi.reader.XmiReader.java
protected static final Multiplicity readMultiplicity(final XMLStreamReader reader) throws XMLStreamException { assertName(XmiElementName.MULTIPLICITY, reader); final Identifier id = getId(reader); Range range = null;//from w ww .j a v a2 s . co m while (reader.hasNext()) { reader.next(); switch (reader.getEventType()) { case XMLStreamConstants.START_ELEMENT: { if (match(XmiElementName.MULTIPLICITY_DOT_RANGE, reader)) { range = readMultiplicityDotRange(reader); } else { throw new AssertionError(reader.getLocalName()); // skipElement(reader); } break; } case XMLStreamConstants.END_ELEMENT: { assertName(XmiElementName.MULTIPLICITY, reader); return new Multiplicity(id, EMPTY_TAGGED_VALUE_LIST, range); } case XMLStreamConstants.CHARACTERS: { // Ignore. break; } default: { throw new AssertionError(reader.getEventType()); } } } throw new AssertionError(); }
From source file:org.slc.sli.modeling.xmi.reader.XmiReader.java
protected static final Range readMultiplicityDotRange(final XMLStreamReader reader) throws XMLStreamException { assertName(XmiElementName.MULTIPLICITY_DOT_RANGE, reader); Range range = null;/* w w w. j a va 2 s . c om*/ while (reader.hasNext()) { reader.next(); switch (reader.getEventType()) { case XMLStreamConstants.START_ELEMENT: { if (match(XmiElementName.MULTIPLICITY_RANGE, reader)) { range = assertNotNull(readMultiplicityRange(reader)); } else { throw new AssertionError(reader.getLocalName()); // skipElement(reader); } break; } case XMLStreamConstants.END_ELEMENT: { assertName(XmiElementName.MULTIPLICITY_DOT_RANGE, reader); return assertNotNull(range); } case XMLStreamConstants.CHARACTERS: { // Ignore. break; } default: { throw new AssertionError(reader.getEventType()); } } } throw new AssertionError(); }
From source file:org.slc.sli.modeling.xmi.reader.XmiReader.java
protected static final Range readMultiplicityRange(final XMLStreamReader reader) throws XMLStreamException { assertName(XmiElementName.MULTIPLICITY_RANGE, reader); final Identifier id = getId(reader); final Occurs lowerBound = getOccurs(reader, XmiAttributeName.LOWER); final Occurs upperBound = getOccurs(reader, XmiAttributeName.UPPER); while (reader.hasNext()) { reader.next();/*from w w w . ja v a 2s . co m*/ switch (reader.getEventType()) { case XMLStreamConstants.START_ELEMENT: { skipElement(reader, false); break; } case XMLStreamConstants.END_ELEMENT: { assertName(XmiElementName.MULTIPLICITY_RANGE, reader); return new Range(id, lowerBound, upperBound, EMPTY_TAGGED_VALUE_LIST); } case XMLStreamConstants.CHARACTERS: { // Ignore. break; } default: { throw new AssertionError(reader.getEventType()); } } } throw new AssertionError(); }
From source file:org.slc.sli.modeling.xmi.reader.XmiReader.java
/** * The UML:Namespace.ownedElement is simply a list of model elements that can belong in a * name-space./* ww w . j ava 2 s . c o m*/ * * It has no identity of its own and is only present in the serialization format. */ protected static final List<NamespaceOwnedElement> readNamespaceOwnedElement(final XMLStreamReader reader) throws XMLStreamException { assertName(XmiElementName.NAMESPACE_DOT_OWNED_ELEMENT, reader); final List<NamespaceOwnedElement> ownedElements = new LinkedList<NamespaceOwnedElement>(); while (reader.hasNext()) { reader.next(); switch (reader.getEventType()) { case XMLStreamConstants.START_ELEMENT: { if (match(XmiElementName.CLASS, reader)) { ownedElements.add(assertNotNull(readClassType(reader.getName(), reader))); } else if (match(XmiElementName.ASSOCIATION_CLASS, reader)) { ownedElements.add(assertNotNull(readClassType(reader.getName(), reader))); } else if (match(XmiElementName.ASSOCIATION, reader)) { ownedElements.add(assertNotNull(readClassType(reader.getName(), reader))); } else if (match(XmiElementName.DATA_TYPE, reader)) { ownedElements.add(assertNotNull(readDataType(reader))); } else if (match(XmiElementName.ENUMERATION, reader)) { ownedElements.add(assertNotNull(readEnumeration(reader))); } else if (match(XmiElementName.TAG_DEFINITION, reader)) { ownedElements.add(assertNotNull(readTagDefinition(reader))); } else if (match(XmiElementName.GENERALIZATION, reader)) { ownedElements.add(assertNotNull(readGeneralization(reader))); } else if (match(XmiElementName.COMMENT, reader)) { skipElement(reader, false); } else if (match(XmiElementName.PACKAGE, reader)) { ownedElements.add(assertNotNull(readPackage(reader))); } else { throw new AssertionError(reader.getName()); // skipElement(reader); } break; } case XMLStreamConstants.END_ELEMENT: { assertName(XmiElementName.NAMESPACE_DOT_OWNED_ELEMENT, reader); return Collections.unmodifiableList(ownedElements); } case XMLStreamConstants.CHARACTERS: { // Ignore. break; } default: { throw new AssertionError(reader.getEventType()); } } } throw new AssertionError(); }
From source file:org.slc.sli.modeling.xmi.reader.XmiReader.java
protected static final UmlPackage readPackage(final XMLStreamReader reader) throws XMLStreamException { assertName(XmiElementName.PACKAGE, reader); final List<TaggedValue> taggedValues = new LinkedList<TaggedValue>(); final Identifier id = getId(reader); final String name = assertNotNull(getName(reader, null, XmiAttributeName.NAME)); List<NamespaceOwnedElement> ownedElements = EMPTY_NAMESPACE_OWNED_ELEMENTS; while (reader.hasNext()) { reader.next();//from w w w .j av a 2 s .c o m switch (reader.getEventType()) { case XMLStreamConstants.START_ELEMENT: { if (match(XmiElementName.NAMESPACE_DOT_OWNED_ELEMENT, reader)) { ownedElements = readNamespaceOwnedElement(reader); } else if (match(XmiElementName.MODEL_ELEMENT_DOT_TAGGED_VALUE, reader)) { taggedValues.addAll(readTaggedValueGroup(reader)); } else { throw new AssertionError(reader.getLocalName()); // skipElement(reader); } break; } case XMLStreamConstants.END_ELEMENT: { assertName(XmiElementName.PACKAGE, reader); return new UmlPackage(name, id, taggedValues, ownedElements); } case XMLStreamConstants.CHARACTERS: { // Ignore. break; } default: { throw new AssertionError(reader.getEventType()); } } } throw new AssertionError(); }
From source file:org.slc.sli.modeling.xmi.reader.XmiReader.java
protected static final Multiplicity readStructuralFeatureDotMultiplicity(final XMLStreamReader reader) throws XMLStreamException { assertName(XmiElementName.STRUCTURAL_FEATURE_DOT_MULTIPLICITY, reader); Multiplicity multiplicity = null;//from w w w . j av a 2s . c o m while (reader.hasNext()) { reader.next(); switch (reader.getEventType()) { case XMLStreamConstants.START_ELEMENT: { if (match(XmiElementName.MULTIPLICITY, reader)) { multiplicity = assertNotNull(readMultiplicity(reader)); } else { throw new AssertionError(reader.getLocalName()); // skipElement(reader); } break; } case XMLStreamConstants.END_ELEMENT: { assertName(XmiElementName.STRUCTURAL_FEATURE_DOT_MULTIPLICITY, reader); return assertNotNull(multiplicity); } case XMLStreamConstants.CHARACTERS: { // Ignore. break; } default: { throw new AssertionError(reader.getEventType()); } } } throw new AssertionError(); }
From source file:org.slc.sli.modeling.xmi.reader.XmiReader.java
protected static final TagDefinition readTagDefinition(final XMLStreamReader reader) throws XMLStreamException { assertName(XmiElementName.TAG_DEFINITION, reader); final List<TaggedValue> taggedValues = new LinkedList<TaggedValue>(); final Identifier id = getId(reader); final String name = assertNotNull(getName(reader, null, XmiAttributeName.NAME)); Multiplicity multiplicity = null;/*from ww w . ja va 2 s. c om*/ while (reader.hasNext()) { reader.next(); switch (reader.getEventType()) { case XMLStreamConstants.START_ELEMENT: { if (match(XmiElementName.TAG_DEFINITION_DOT_MULTIPLICITY, reader)) { multiplicity = assertNotNull(readTagDefinitionMultiplicity(reader)); } else if (match(XmiElementName.MODEL_ELEMENT_DOT_TAGGED_VALUE, reader)) { skipElement(reader, false); } else { skipElement(reader, true); } break; } case XMLStreamConstants.END_ELEMENT: { assertName(XmiElementName.TAG_DEFINITION, reader); return new TagDefinition(id, taggedValues, name, multiplicity); } case XMLStreamConstants.CHARACTERS: { // Ignore. break; } default: { throw new AssertionError(reader.getEventType()); } } } throw new AssertionError(); }
From source file:org.slc.sli.modeling.xmi.reader.XmiReader.java
protected static final Multiplicity readTagDefinitionMultiplicity(final XMLStreamReader reader) throws XMLStreamException { assertName(XmiElementName.TAG_DEFINITION_DOT_MULTIPLICITY, reader); Multiplicity multiplicity = null;/* w w w .j a va 2s . c o m*/ while (reader.hasNext()) { reader.next(); switch (reader.getEventType()) { case XMLStreamConstants.START_ELEMENT: { if (match(XmiElementName.MULTIPLICITY, reader)) { multiplicity = assertNotNull(readMultiplicity(reader)); } else { throw new AssertionError(reader.getLocalName()); // skipElement(reader); } break; } case XMLStreamConstants.END_ELEMENT: { assertName(XmiElementName.TAG_DEFINITION_DOT_MULTIPLICITY, reader); return assertNotNull(multiplicity); } case XMLStreamConstants.CHARACTERS: { // Ignore. break; } default: { throw new AssertionError(reader.getEventType()); } } } throw new AssertionError(); }
From source file:org.slc.sli.modeling.xmi.reader.XmiReader.java
protected static final TaggedValue readTaggedValue(final XMLStreamReader reader) throws XMLStreamException { assertName(XmiElementName.TAGGED_VALUE, reader); final Identifier id = getId(reader); String dataValue = ""; Identifier tagDefinition = null;/*from www. j a v a2 s .c o m*/ while (reader.hasNext()) { reader.next(); switch (reader.getEventType()) { case XMLStreamConstants.START_ELEMENT: { if (match(XmiElementName.TAGGED_VALUE_DOT_DATA_VALUE, reader)) { dataValue = assertNotNull(readTaggedValueData(reader)); } else if (match(XmiElementName.TAGGED_VALUE_DOT_TYPE, reader)) { tagDefinition = assertNotNull(readTaggedValueType(reader)); } else { throw new AssertionError(reader.getLocalName()); } break; } case XMLStreamConstants.END_ELEMENT: { assertName(XmiElementName.TAGGED_VALUE, reader); return new TaggedValue(id, EMPTY_TAGGED_VALUE_LIST, dataValue, tagDefinition); } case XMLStreamConstants.CHARACTERS: { // Ignore. break; } default: { throw new AssertionError(reader.getEventType()); } } } throw new AssertionError(); }
From source file:org.slc.sli.modeling.xmi.reader.XmiReader.java
protected static final String readTaggedValueData(final XMLStreamReader reader) throws XMLStreamException { assertName(XmiElementName.TAGGED_VALUE_DOT_DATA_VALUE, reader); final StringBuilder sb = new StringBuilder(); while (reader.hasNext()) { reader.next();/*from w ww .ja v a2 s .com*/ switch (reader.getEventType()) { case XMLStreamConstants.START_ELEMENT: { throw new AssertionError(reader.getLocalName()); } case XMLStreamConstants.END_ELEMENT: { assertName(XmiElementName.TAGGED_VALUE_DOT_DATA_VALUE, reader); return collapseWhitespace(sb.toString()); } case XMLStreamConstants.CHARACTERS: { sb.append(reader.getText()); break; } default: { throw new AssertionError(reader.getEventType()); } } } throw new AssertionError(); }