List of usage examples for javax.xml.stream XMLStreamReader getLocalName
public String getLocalName();
From source file:org.slc.sli.modeling.xmi.reader.XmiReader.java
protected static final Generalization readGeneralization(final XMLStreamReader reader) throws XMLStreamException { assertName(XmiElementName.GENERALIZATION, reader); final Identifier id = getId(reader); final String name = getName(reader, DEFAULT_EMPTY_NAME, XmiAttributeName.NAME); final List<TaggedValue> taggedValues = new LinkedList<TaggedValue>(); Identifier child = null;/*www. j a v a 2 s . c o m*/ Identifier parent = null; while (reader.hasNext()) { reader.next(); switch (reader.getEventType()) { case XMLStreamConstants.START_ELEMENT: { if (match(XmiElementName.MODEL_ELEMENT_DOT_TAGGED_VALUE, reader)) { taggedValues.addAll(readTaggedValueGroup(reader)); break; } else if (match(XmiElementName.GENERALIZATION_DOT_CHILD, reader)) { child = assertNotNull(readIdentifierWrapper(XmiElementName.GENERALIZATION_DOT_CHILD, reader)); break; } else if (match(XmiElementName.GENERALIZATION_DOT_PARENT, reader)) { parent = assertNotNull(readIdentifierWrapper(XmiElementName.GENERALIZATION_DOT_PARENT, reader)); break; } else { throw new AssertionError(reader.getLocalName()); } // skipElement(reader); // break; } case XMLStreamConstants.END_ELEMENT: { assertName(XmiElementName.GENERALIZATION, reader); return new Generalization(name, id, taggedValues, child, parent); } 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 Identifier readIdentifier(final XMLStreamReader reader) throws XMLStreamException { final XmiElementName name = assertNotNull(XmiElementName.getElementName(reader.getLocalName())); final Identifier id = getIdRef(reader); while (reader.hasNext()) { reader.next();/*from ww w .j a v a2 s. c o m*/ switch (reader.getEventType()) { case XMLStreamConstants.START_ELEMENT: { skipElement(reader, false); break; } case XMLStreamConstants.END_ELEMENT: { assertName(name, reader); return id; } 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 Model readModel(final XMLStreamReader reader) throws XMLStreamException { assertName(XmiElementName.MODEL, reader); final Identifier id = getId(reader); final String name = getName(reader, null, XmiAttributeName.NAME); List<TaggedValue> taggedValues = EMPTY_TAGGED_VALUE_LIST; List<NamespaceOwnedElement> ownedElements = EMPTY_NAMESPACE_OWNED_ELEMENTS; while (reader.hasNext()) { reader.next();//from w ww. j a v a 2 s . c o m switch (reader.getEventType()) { case XMLStreamConstants.START_ELEMENT: { if (match(XmiElementName.MODEL_ELEMENT_DOT_TAGGED_VALUE, reader)) { taggedValues = readTaggedValueGroup(reader); } else if (match(XmiElementName.NAMESPACE_DOT_OWNED_ELEMENT, reader)) { ownedElements = readNamespaceOwnedElement(reader); } else { throw new AssertionError(reader.getLocalName()); } break; } case XMLStreamConstants.END_ELEMENT: { assertName(XmiElementName.MODEL, reader); return new Model(id, name, 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 readMultiplicity(final XMLStreamReader reader) throws XMLStreamException { assertName(XmiElementName.MULTIPLICITY, reader); final Identifier id = getId(reader); Range range = null;// w w w .ja 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 ww . j av a 2 s. c o m 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 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 2s .co 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;//w w w . ja va2 s . 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 Multiplicity readTagDefinitionMultiplicity(final XMLStreamReader reader) throws XMLStreamException { assertName(XmiElementName.TAG_DEFINITION_DOT_MULTIPLICITY, reader); Multiplicity multiplicity = null;//from ww w .j a v 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.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 ww w.j a v a 2 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 ww w .jav a 2 s . c om*/ 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(); }