@Override public void writeAttribute(String prefix, String namespaceURI, String localName, String value) throws XMLStreamException { this.eventWriter.add(this.eventFactory.createAttribute(prefix, namespaceURI, localName, value)); }
@Override public void writeAttribute(String localName, String value) throws XMLStreamException { this.eventWriter.add(this.eventFactory.createAttribute(localName, value)); }
@Override public void writeAttribute(String namespaceURI, String localName, String value) throws XMLStreamException { this.eventWriter.add(this.eventFactory.createAttribute(new QName(namespaceURI, localName), value)); }
private List<Attribute> getAttributes(Attributes attributes) { int attrLength = attributes.getLength(); List<Attribute> result = new ArrayList<>(attrLength); for (int i = 0; i < attrLength; i++) { QName attrName = toQName(attributes.getURI(i), attributes.getQName(i)); if (!isNamespaceDeclaration(attrName)) { result.add(this.eventFactory.createAttribute(attrName, attributes.getValue(i))); } } return result; }
@Override public void writeAttribute(String prefix, String namespaceURI, String localName, String value) throws XMLStreamException { this.eventWriter.add(this.eventFactory.createAttribute(prefix, namespaceURI, localName, value)); }
@Override public void writeAttribute(String localName, String value) throws XMLStreamException { this.eventWriter.add(this.eventFactory.createAttribute(localName, value)); }
@Override public void writeAttribute(String namespaceURI, String localName, String value) throws XMLStreamException { this.eventWriter.add(this.eventFactory.createAttribute(new QName(namespaceURI, localName), value)); }
private List<Attribute> getAttributes(Attributes attributes) { int attrLength = attributes.getLength(); List<Attribute> result = new ArrayList<>(attrLength); for (int i = 0; i < attrLength; i++) { QName attrName = toQName(attributes.getURI(i), attributes.getQName(i)); if (!isNamespaceDeclaration(attrName)) { result.add(this.eventFactory.createAttribute(attrName, attributes.getValue(i))); } } return result; }
private List<Attribute> updateElementAttributes(StartElement startElement) { // adjust the version attribute List<Attribute> newElementAttributeList = new ArrayList<Attribute>(); Iterator<?> existingAttributesIterator = startElement.getAttributes(); while ( existingAttributesIterator.hasNext() ) { Attribute attribute = (Attribute) existingAttributesIterator.next(); if ( VERSION_ATTRIBUTE_NAME.equals( attribute.getName().getLocalPart() ) ) { if ( !DEFAULT_VERSION.equals( attribute.getName().getPrefix() ) ) { newElementAttributeList.add( xmlEventFactory.createAttribute( attribute.getName(), DEFAULT_VERSION ) ); } } else { newElementAttributeList.add( attribute ); } } return newElementAttributeList; } }
public void attribute(int prefix, String localName, String value) throws IOException, XMLStreamException { Attribute att; if(prefix==-1) att = ef.createAttribute(localName,value); else att = ef.createAttribute( nsContext.getPrefix(prefix), nsContext.getNamespaceURI(prefix), localName, value); out.add(att); }
private Attribute mapAttribute(StartElement startElement, Attribute originalAttribute) { // Here we look to see if this attribute is the JPA version attribute, and if so do 2 things: // 1) validate its version attribute is valid // 2) update its version attribute to the default version if not already // // NOTE : atm this is a very simple check using just the attribute's local name // rather than checking its qualified name. It is possibly (though unlikely) // that this could match on "other" version attributes in the same element if ( ROOT_ELEMENT_NAME.equals( startElement.getName().getLocalPart() ) ) { if ( VERSION_ATTRIBUTE_NAME.equals( originalAttribute.getName().getLocalPart() ) ) { final String specifiedVersion = originalAttribute.getValue(); if ( !LocalXsdResolver.isValidJpaVersion( specifiedVersion ) ) { throw new BadVersionException( specifiedVersion ); } return xmlEventFactory.createAttribute( VERSION_ATTRIBUTE_NAME, LocalXsdResolver.latestJpaVerison() ); } } return originalAttribute; }
writer.add(factory.createAttribute(key, entry.getValue()));
private List<Attribute> getAttributes(Attributes attributes) { List<Attribute> list = new ArrayList<Attribute>(); for (int i = 0; i < attributes.getLength(); i++) { QName name = toQName(attributes.getURI(i), attributes.getQName(i)); if (!("xmlns".equals(name.getLocalPart()) || "xmlns".equals(name.getPrefix()))) { list.add(eventFactory.createAttribute(name, attributes.getValue(i))); } } return list; }
public void writeAttribute(String prefix, String namespaceURI, String localName, String value) throws XMLStreamException { eventWriter.add(eventFactory.createAttribute(prefix, namespaceURI, localName, value)); }
public void writeAttribute(String localName, String value) throws XMLStreamException { eventWriter.add(eventFactory.createAttribute(localName, value)); }
public void writeAttribute(String namespaceURI, String localName, String value) throws XMLStreamException { eventWriter.add(eventFactory.createAttribute(new QName(namespaceURI, localName), value)); }
public void attribute(int prefix, String localName, String value) throws IOException, XMLStreamException { Attribute att; if(prefix==-1) att = ef.createAttribute(localName,value); else att = ef.createAttribute( nsContext.getPrefix(prefix), nsContext.getNamespaceURI(prefix), localName, value); out.add(att); }
public javax.xml.stream.events.Attribute next() { Attribute attr = iter.next(); QName attrName = createQName(attr.getQName()); String value = attr.getValue(); return factory.createAttribute(attrName, value); }
@Override public javax.xml.stream.events.Attribute next() { final Attribute att = source.next(); final Namespace ns = att.getNamespace(); if (ns == Namespace.NO_NAMESPACE) { return fac.createAttribute(att.getName(), att.getValue()); } return fac.createAttribute(ns.getPrefix(), ns.getURI(), att.getName(), att.getValue()); }
/** * Constructs a STAX {@link javax.xml.stream.events.Attribute}event from a * DOM4J {@link Attribute}. * * @param attr * The {@link Attribute}from which to construct the event. * * @return The newly constructed {@link javax.xml.stream.events.Attribute} * event. */ public javax.xml.stream.events.Attribute createAttribute(Attribute attr) { QName attrName = createQName(attr.getQName()); String value = attr.getValue(); return factory.createAttribute(attrName, value); }