private List<AnnotationAttribute> readAnnotationAttribute(final XMLStreamReader reader) { List<AnnotationAttribute> annotationAttributes = new ArrayList<AnnotationAttribute>(); for (int i = 0; i < reader.getAttributeCount(); i++) { String attributeNamespace = reader.getAttributeNamespace(i); if (attributeNamespace != null && !isDefaultNamespace(attributeNamespace) && !mandatoryNamespaces.containsValue(attributeNamespace) && !edmNamespaces.contains(attributeNamespace)) { annotationAttributes.add(new AnnotationAttribute().setName(reader.getAttributeLocalName(i)). setPrefix(reader.getAttributePrefix(i)).setNamespace(attributeNamespace).setText( reader.getAttributeValue(i))); } } if (annotationAttributes.isEmpty()) { return null; } return annotationAttributes; }
private static void writeAnnotationAttributes(final Collection<AnnotationAttribute> annotationAttributes, final Map<String, String> predefinedNamespaces, ArrayList<String> setNamespaces, final XMLStreamWriter xmlStreamWriter) throws XMLStreamException { if (annotationAttributes != null) { if (setNamespaces == null) { setNamespaces = new ArrayList<String>(); } for (AnnotationAttribute annotationAttribute : annotationAttributes) { if (annotationAttribute.getNamespace() != null) { xmlStreamWriter.writeAttribute(annotationAttribute.getPrefix(), annotationAttribute.getNamespace(), annotationAttribute.getName(), annotationAttribute.getText()); if (setNamespaces.contains(annotationAttribute.getNamespace()) == false && predefinedNamespaces.containsValue(annotationAttribute.getNamespace()) == false) { xmlStreamWriter.writeNamespace(annotationAttribute.getPrefix(), annotationAttribute.getNamespace()); setNamespaces.add(annotationAttribute.getNamespace()); } } else { xmlStreamWriter.writeAttribute(annotationAttribute.getName(), annotationAttribute.getText()); } } } }
private VocabAnnotationElement generateAnnotationElement(HashMap<Integer, EdmxReference> edmxRefMap) { VocabAnnotationElement vocabEle = new VocabAnnotationElement(); List<AnnotationElement> annoElements = new ArrayList<AnnotationElement>(); for (int i = 0; i < edmxRefMap.size(); i++) { EdmxReference edmxRef = edmxRefMap.get(i + 1); List<AnnotationAttribute> childAttributes = new ArrayList<AnnotationAttribute>(); childAttributes.add(new AnnotationAttribute().setName("Alias").setText(edmxRef.getAlias())); childAttributes.add(new AnnotationAttribute().setName("Namespace").setText(edmxRef.getNamespace())); List<AnnotationAttribute> referenceAttributes = new ArrayList<AnnotationAttribute>(); List<AnnotationElement> childElements = new ArrayList<AnnotationElement>(); childElements.add(new AnnotationElement().setName("edmx:Include").setAttributes(childAttributes)); if (edmxRef.getNamespaceUri() != null) referenceAttributes .add(new AnnotationAttribute().setName("xmlns:edmx").setText(edmxRef.getNamespaceUri())); referenceAttributes.add(new AnnotationAttribute().setName("Uri").setText(edmxRef.getUri())); annoElements.add(new AnnotationElement().setName("edmx:Reference").setPrefix("edmx") .setAttributes(referenceAttributes).setChildElements(childElements)); } vocabEle.setAnnotationElements(annoElements); return vocabEle; }
private List<AnnotationAttribute> readAnnotationAttribute(final XMLStreamReader reader) { List<AnnotationAttribute> annotationAttributes = new ArrayList<AnnotationAttribute>(); for (int i = 0; i < reader.getAttributeCount(); i++) { String attributeNamespace = reader.getAttributeNamespace(i); if (attributeNamespace != null && !isDefaultNamespace(attributeNamespace) && !mandatoryNamespaces.containsValue(attributeNamespace) && !edmNamespaces.contains(attributeNamespace)) { annotationAttributes.add(new AnnotationAttribute().setName(reader.getAttributeLocalName(i)). setPrefix(reader.getAttributePrefix(i)).setNamespace(attributeNamespace).setText( reader.getAttributeValue(i))); } } if (annotationAttributes.isEmpty()) { return null; } return annotationAttributes; }
private static void writeAnnotationAttributes(final Collection<AnnotationAttribute> annotationAttributes, final Map<String, String> predefinedNamespaces, ArrayList<String> setNamespaces, final XMLStreamWriter xmlStreamWriter) throws XMLStreamException { if (annotationAttributes != null) { if (setNamespaces == null) { setNamespaces = new ArrayList<String>(); } for (AnnotationAttribute annotationAttribute : annotationAttributes) { if (annotationAttribute.getNamespace() != null) { xmlStreamWriter.writeAttribute(annotationAttribute.getPrefix(), annotationAttribute.getNamespace(), annotationAttribute.getName(), annotationAttribute.getText()); if (setNamespaces.contains(annotationAttribute.getNamespace()) == false && predefinedNamespaces.containsValue(annotationAttribute.getNamespace()) == false) { xmlStreamWriter.writeNamespace(annotationAttribute.getPrefix(), annotationAttribute.getNamespace()); setNamespaces.add(annotationAttribute.getNamespace()); } } else { xmlStreamWriter.writeAttribute(annotationAttribute.getName(), annotationAttribute.getText()); } } } }
private List<AnnotationAttribute> readAnnotationAttribute(final XMLStreamReader reader) { List<AnnotationAttribute> annotationAttributes = new ArrayList<AnnotationAttribute>(); for (int i = 0; i < reader.getAttributeCount(); i++) { String attributeNamespace = reader.getAttributeNamespace(i); if (attributeNamespace != null && !isDefaultNamespace(attributeNamespace) && !mandatoryNamespaces.containsValue(attributeNamespace) && !edmNamespaces.contains(attributeNamespace)) { annotationAttributes.add(new AnnotationAttribute().setName(reader.getAttributeLocalName(i)). setPrefix(reader.getAttributePrefix(i)).setNamespace(attributeNamespace).setText( reader.getAttributeValue(i))); } } if (annotationAttributes.isEmpty()) { return null; } return annotationAttributes; }
private static void writeAnnotationAttributes(final Collection<AnnotationAttribute> annotationAttributes, final Map<String, String> predefinedNamespaces, ArrayList<String> setNamespaces, final XMLStreamWriter xmlStreamWriter) throws XMLStreamException { if (annotationAttributes != null) { if (setNamespaces == null) { setNamespaces = new ArrayList<String>(); } for (AnnotationAttribute annotationAttribute : annotationAttributes) { if (annotationAttribute.getNamespace() != null) { xmlStreamWriter.writeAttribute(annotationAttribute.getPrefix(), annotationAttribute.getNamespace(), annotationAttribute.getName(), annotationAttribute.getText()); if (setNamespaces.contains(annotationAttribute.getNamespace()) == false && predefinedNamespaces.containsValue(annotationAttribute.getNamespace()) == false) { xmlStreamWriter.writeNamespace(annotationAttribute.getPrefix(), annotationAttribute.getNamespace()); setNamespaces.add(annotationAttribute.getNamespace()); } } else { xmlStreamWriter.writeAttribute(annotationAttribute.getName(), annotationAttribute.getText()); } } } }
AnnotationAttribute annotationAttribute = new AnnotationAttribute(); annotationAttribute.setText(reader.getAttributeValue(i)); annotationAttribute.setName(reader.getAttributeLocalName(i)); annotationAttribute.setPrefix(reader.getAttributePrefix(i)); String namespace = reader.getAttributeNamespace(i); if (namespace != null && !isDefaultNamespace(namespace)) { annotationAttribute.setNamespace(namespace);
AnnotationAttribute annotationAttribute = new AnnotationAttribute(); annotationAttribute.setText(reader.getAttributeValue(i)); annotationAttribute.setName(reader.getAttributeLocalName(i)); annotationAttribute.setPrefix(reader.getAttributePrefix(i)); String namespace = reader.getAttributeNamespace(i); if (namespace != null && !isDefaultNamespace(namespace)) { annotationAttribute.setNamespace(namespace);
AnnotationAttribute annotationAttribute = new AnnotationAttribute(); annotationAttribute.setText(reader.getAttributeValue(i)); annotationAttribute.setName(reader.getAttributeLocalName(i)); annotationAttribute.setPrefix(reader.getAttributePrefix(i)); String namespace = reader.getAttributeNamespace(i); if (namespace != null && !isDefaultNamespace(namespace)) { annotationAttribute.setNamespace(namespace);