public AttrBuffer( XMLStreamReader rd, int attrIndex ) { prefix = rd.getAttributePrefix( attrIndex ); namespace = rd.getAttributeNamespace( attrIndex ); localName = rd.getAttributeLocalName( attrIndex ); value = rd.getAttributeValue( attrIndex ); }
private Attributes getAttributes() { AttributesImpl attributes = new AttributesImpl(); for (int i = 0; i < this.reader.getAttributeCount(); i++) { String namespace = this.reader.getAttributeNamespace(i); if (namespace == null || !hasNamespacesFeature()) { namespace = ""; } String type = this.reader.getAttributeType(i); if (type == null) { type = "CDATA"; } attributes.addAttribute(namespace, this.reader.getAttributeLocalName(i), toQualifiedName(this.reader.getAttributeName(i)), type, this.reader.getAttributeValue(i)); } if (hasNamespacePrefixesFeature()) { for (int i = 0; i < this.reader.getNamespaceCount(); i++) { String prefix = this.reader.getNamespacePrefix(i); String namespaceUri = this.reader.getNamespaceURI(i); String qName; if (StringUtils.hasLength(prefix)) { qName = "xmlns:" + prefix; } else { qName = "xmlns"; } attributes.addAttribute("", "", qName, "CDATA", namespaceUri); } } return attributes; }
private String findFirstAttributeValue(XMLStreamReader reader, String name) { for (int i = 0; i < reader.getAttributeCount(); i++) { String n = reader.getAttributeLocalName(i); if (name.equals(n)) { return reader.getAttributeValue(i); } } return ""; }
public static void readPackages(XMLStreamReader reader, FeaturePackConfig.Builder builder) throws XMLStreamException, ProvisioningDescriptionException { final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { if(reader.getAttributeLocalName(i).equals(INHERIT)) { builder.setInheritPackages(Boolean.parseBoolean(reader.getAttributeValue(i))); } else { throw ParsingUtils.unexpectedContent(reader); while (reader.hasNext()) { switch (reader.nextTag()) { case XMLStreamConstants.END_ELEMENT: { final String localName = reader.getLocalName(); if (EXCLUDE.equals(localName)) { builder.excludePackage(parseName(reader));
@Override public String invalidAttribute(XMLStreamReader reader, int index) { Location location = reader.getLocation(); return this.tr("Invalid value for <{2} {3}=\"{4}\"/> found at [{0}:{1}]", location.getLineNumber(), location.getColumnNumber(), reader.getLocalName(), reader.getAttributeLocalName(index), reader.getAttributeValue(index)); }
@Override public String unexpectedAttribute(XMLStreamReader reader, int index) { Location location = reader.getLocation(); return this.tr("Unexpected <{2} {3}=\"...\"/> attribute found at [{0}:{1}]", location.getLineNumber(), location.getColumnNumber(), reader.getLocalName(), reader.getAttributeLocalName(index)); }
private void parseCredential(final XMLStreamReader streamReader, CredentialParseFunction function) throws RealmUnavailableException, XMLStreamException { final int attributeCount = streamReader.getAttributeCount(); String name = null; String algorithm = null; String format = null; for (int i = 0; i < attributeCount; i ++) { String namespace = streamReader.getAttributeNamespace(i); if (namespace != null && !namespace.equals("")) { throw ElytronMessages.log.fileSystemRealmInvalidContent(path, streamReader.getLocation().getLineNumber(), name); } final String localName = streamReader.getAttributeLocalName(i); if ("name".equals(localName)) { name = streamReader.getAttributeValue(i); } else if ("algorithm".equals(localName)) { algorithm = streamReader.getAttributeValue(i); } else if ("format".equals(localName)) { format = streamReader.getAttributeValue(i); } else { throw ElytronMessages.log.fileSystemRealmInvalidContent(path, streamReader.getLocation().getLineNumber(), name); } } final String text = streamReader.getElementText().trim(); function.parseCredential(algorithm, format, text); }
private void parseClusteredLocksElement(XMLStreamReader reader, ClusteredLockManagerConfigurationBuilder builder) throws XMLStreamException { for (int i = 0; i < reader.getAttributeCount(); i++) { ParseUtils.requireNoNamespaceAttribute(reader, i); String value = reader.getAttributeValue(i); Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case NUM_OWNERS: builder.numOwner(Integer.parseInt(value)); break; case RELIABILITY: builder.reliability(Reliability.valueOf(value)); break; default: throw ParseUtils.unexpectedAttribute(reader, i); } } while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT)) { Element element = Element.forName(reader.getLocalName()); switch (element) { case CLUSTERED_LOCK: parseClusteredLock(reader, builder.addClusteredLock()); break; default: throw ParseUtils.unexpectedElement(reader); } } }
/*package*/ void fillAttributes(XMLStreamReader in) { for( int i=in.getAttributeCount()-1; i>=0; i-- ) { String n = in.getAttributeLocalName(i); if(model.attributes.containsKey(n)) { if(attributes==null) attributes = new HashMap<String, String>(); attributes.put(n,in.getAttributeValue(i)); } } if(attributes==null) attributes = Collections.emptyMap(); }
private void copyAttribute(int i) throws XMLStreamException { writer.writeAttribute( reader.getAttributePrefix(i), reader.getAttributeNamespace(i), reader.getAttributeLocalName(i), reader.getAttributeValue(i)); }
private void parseAttribute(final XMLStreamReader streamReader, final Attributes attributes) throws XMLStreamException, RealmUnavailableException { String name = null; String value = null; final int attributeCount = streamReader.getAttributeCount(); for (int i = 0; i < attributeCount; i++) { String namespace = streamReader.getAttributeNamespace(i); if (namespace != null && !namespace.equals("")) { throw ElytronMessages.log.fileSystemRealmInvalidContent(path, streamReader.getLocation().getLineNumber(), this.name); } if ("name".equals(streamReader.getAttributeLocalName(i))) { name = streamReader.getAttributeValue(i); } else if ("value".equals(streamReader.getAttributeLocalName(i))) { value = streamReader.getAttributeValue(i); } else { throw ElytronMessages.log.fileSystemRealmInvalidContent(path, streamReader.getLocation().getLineNumber(), this.name); } } if (name == null) { throw ElytronMessages.log.fileSystemRealmMissingAttribute("name", path, streamReader.getLocation().getLineNumber(), this.name); } if (value == null) { throw ElytronMessages.log.fileSystemRealmMissingAttribute("value", path, streamReader.getLocation().getLineNumber(), this.name); } attributes.addLast(name, value); if (streamReader.nextTag() != END_ELEMENT) { throw ElytronMessages.log.fileSystemRealmInvalidContent(path, streamReader.getLocation().getLineNumber(), this.name); } }
final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final String value = reader.getAttributeValue(i); if (attributeHasNamespace(reader, i)) { continue; final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case ID: { while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { final Element element = Element.forName(reader.getLocalName()); switch (element) { case WELCOME_FILE:
private String findFirstAttributeValue(XMLStreamReader reader, String name) { for (int i = 0; i < reader.getAttributeCount(); i++) { String n = reader.getAttributeLocalName(i); if (name.equals(n)) { return reader.getAttributeValue(i); } } return ""; }
private Attributes getAttributes() { AttributesImpl attributes = new AttributesImpl(); for (int i = 0; i < this.reader.getAttributeCount(); i++) { String namespace = this.reader.getAttributeNamespace(i); if (namespace == null || !hasNamespacesFeature()) { namespace = ""; } String type = this.reader.getAttributeType(i); if (type == null) { type = "CDATA"; } attributes.addAttribute(namespace, this.reader.getAttributeLocalName(i), toQualifiedName(this.reader.getAttributeName(i)), type, this.reader.getAttributeValue(i)); } if (hasNamespacePrefixesFeature()) { for (int i = 0; i < this.reader.getNamespaceCount(); i++) { String prefix = this.reader.getNamespacePrefix(i); String namespaceUri = this.reader.getNamespaceURI(i); String qName; if (StringUtils.hasLength(prefix)) { qName = "xmlns:" + prefix; } else { qName = "xmlns"; } attributes.addAttribute("", "", qName, "CDATA", namespaceUri); } } return attributes; }
final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final String value = reader.getAttributeValue(i); if (attributeHasNamespace(reader, i)) { continue; final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case ID: { while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { final Element element = Element.forName(reader.getLocalName()); switch (element) { case LOCALE_ENCODING_MAPPING:
private void processMessageQueues(ArrayList<String> queues) { for (int i = 0; i < reader.getAttributeCount(); i++) { if (XmlDataConstants.QUEUE_NAME.equals(reader.getAttributeLocalName(i))) { String queueName = reader.getAttributeValue(i); String translation = checkPrefix(queueName); queues.add(translation); } } }
XMLStreamWriter writer = factory.createXMLStreamWriter(stringWriter); while ( reader.hasNext() ) { int event = reader.next(); if (reader.getLocalName().equals("ins")) else if (reader.getLocalName().equals("del")) if (memory.equals(reader.getLocalName())) writer.writeStartElement(reader.getPrefix(), reader.getLocalName(), reader.getNamespaceURI()); for (int i=0; i<reader.getAttributeCount() ; i++ ) { if (reader.getAttributeNamespace(i)==null) { reader.getAttributeLocalName(i), reader.getAttributeValue(i) ); } else { writer.writeAttribute( reader.getAttributePrefix(i), reader.getAttributeNamespace(i), reader.getAttributeLocalName(i), reader.getAttributeValue(i));
final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final String value = reader.getAttributeValue(i); if (attributeHasNamespace(reader, i)) { continue; final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case ID: { while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { final Element element = Element.forName(reader.getLocalName()); switch (element) { case TYPE:
public static String getContentID(XMLStreamReader parser) { if (parser.getAttributeCount() > 0 && parser.getAttributeLocalName(0).equals("href")) { return getContentIDFromHref(parser.getAttributeValue(0)); } else { throw new OMException( "Href attribute not found in XOP:Include element"); } }
public static ExtensionElement parseExtensionElement(XMLStreamReader xtr) throws Exception { ExtensionElement extensionElement = new ExtensionElement(); extensionElement.setName(xtr.getLocalName()); if (StringUtils.isNotEmpty(xtr.getNamespaceURI())) { extensionElement.setNamespace(xtr.getNamespaceURI()); for (int i = 0; i < xtr.getAttributeCount(); i++) { ExtensionAttribute extensionAttribute = new ExtensionAttribute(); extensionAttribute.setName(xtr.getAttributeLocalName(i)); extensionAttribute.setValue(xtr.getAttributeValue(i)); if (StringUtils.isNotEmpty(xtr.getAttributeNamespace(i))) { extensionAttribute.setNamespace(xtr.getAttributeNamespace(i)); while (!readyWithExtensionElement && xtr.hasNext()) { xtr.next(); if (xtr.isCharacters() || XMLStreamReader.CDATA == xtr.getEventType()) { if (StringUtils.isNotEmpty(xtr.getText().trim())) { ExtensionElement childExtensionElement = parseExtensionElement(xtr); extensionElement.addChildElement(childExtensionElement); } else if (xtr.isEndElement() && extensionElement.getName().equalsIgnoreCase(xtr.getLocalName())) { readyWithExtensionElement = true;