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; }
public int getIndex(String uri, String localName) { for (int i = 0; i < pp.getAttributeCount(); i++) { if (pp.getAttributeNamespace(i).equals(uri) && pp.getAttributeName(i).equals(localName)) { return i; } } return -1; }
public int getIndex(String qName) { for (int i = 0; i < pp.getAttributeCount(); i++) { if (pp.getAttributeName(i).equals(qName)) { return i; } } return -1; }
private static void parseTransformer(final XMLStreamReader reader, final List<String> transformerClassNames) throws XMLStreamException { String className = null; final Set<Attribute> required = EnumSet.of(Attribute.CLASS); final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final Attribute attribute = Attribute.of(reader.getAttributeName(i)); required.remove(attribute); switch (attribute) { case CLASS: className = reader.getAttributeValue(i); break; default: throw unexpectedContent(reader); } } if (!required.isEmpty()) { throw missingAttributes(reader.getLocation(), required); } transformerClassNames.add(className); // consume remainder of element parseNoContent(reader); }
public static Map<QName,String> getAttributes(XMLStreamReader reader) { Map<QName,String> map = new HashMap<QName,String>(); for (int i = 0; i < reader.getAttributeCount(); i++) map.put(reader.getAttributeName(i), reader.getAttributeValue(i)); return map; }
loc = r.getLocation(); } else { loc = mLastLocation; loc = mLastLocation = r.getLocation(); int attrCount = r.getAttributeCount(); if (attrCount < 1) { attrs = null; attrs = new LinkedHashMap(); for (int i = 0; i < attrCount; ++i) { QName aname = r.getAttributeName(i); attrs.put(aname, new AttributeEventImpl(loc, aname, r.getAttributeValue(i), r.isAttributeSpecified(i)));
private static void parsePathName(final XMLStreamReader reader, final Set<String> set) throws XMLStreamException { String name = null; final Set<Attribute> required = EnumSet.of(Attribute.NAME); final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final Attribute attribute = Attribute.of(reader.getAttributeName(i)); required.remove(attribute); switch (attribute) { case NAME: name = reader.getAttributeValue(i); break; default: throw unexpectedContent(reader); } } if (!required.isEmpty()) { throw missingAttributes(reader.getLocation(), required); } set.add(name); // consume remainder of element parseNoContent(reader); }
private Map<String, String> parseAttributes() { int num = parser.getAttributeCount(); Map<String, String> map = new HashMap<String, String>(); for (int i = 0; i < num; i++) { map.put(parser.getAttributeName(i).getLocalPart(), parser.getAttributeValue(i)); } return map; }
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 Element readElement() { QName name = streamReader.getName(); Element element = new Element(toName(name), streamReader.getLocation().getLineNumber()); for (int i = 0; i < streamReader.getNamespaceCount(); i++) { element.namespace(new Namespace(streamReader.getNamespaceURI(i), streamReader.getNamespacePrefix(i))); } for (int i = 0; i < streamReader.getAttributeCount(); i++) { element.attr(toName(streamReader.getAttributeName(i)), streamReader.getAttributeValue(i)); } return element; }
public String getType(String qName) { for (int i = 0; i < pp.getAttributeCount(); i++) { if (pp.getAttributeName(i).equals(qName)) { return pp.getAttributeType(i); } } return null; }
public String getType(String uri, String localName) { for (int i = 0; i < pp.getAttributeCount(); i++) { if (pp.getAttributeNamespace(i).equals(uri) && pp.getAttributeName(i).equals(localName)) { return pp.getAttributeType(i); } } return null; }
private static void parseTransformer(final XMLStreamReader reader, final List<String> transformerClassNames) throws XMLStreamException { String className = null; final Set<Attribute> required = EnumSet.of(Attribute.CLASS); final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final Attribute attribute = Attribute.of(reader.getAttributeName(i)); required.remove(attribute); switch (attribute) { case CLASS: className = reader.getAttributeValue(i); break; default: throw unexpectedContent(reader); } } if (!required.isEmpty()) { throw missingAttributes(reader.getLocation(), required); } transformerClassNames.add(className); // consume remainder of element parseNoContent(reader); }
private Map<String, String> parseAttributes() { int num = parser.getAttributeCount(); Map<String, String> map = new HashMap<String, String>(); for (int i = 0; i < num; i++) { map.put(parser.getAttributeName(i).getLocalPart(), parser.getAttributeValue(i)); } return map; }
Attributes attributes(XMLStreamReader xml) { AttributesImpl atts = new AttributesImpl(); for (int i = 0; i < xml.getAttributeCount(); i++) { atts.addAttribute( xml.getAttributeNamespace(i), xml.getAttributeLocalName(i), qname(xml.getAttributeName(i)), xml.getAttributeType(i), xml.getAttributeValue(i)); } return atts; }
public boolean hasFieldPath() { for (int i = 0; i < reader.getAttributeCount(); i++) { if (reader.getAttributeName(i).toString().equals("fieldpath")) { return true; } } return false; }
private static void parsePathName(final XMLStreamReader reader, final Set<String> set) throws XMLStreamException { String name = null; final Set<Attribute> required = EnumSet.of(Attribute.NAME); final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final Attribute attribute = Attribute.of(reader.getAttributeName(i)); required.remove(attribute); switch (attribute) { case NAME: name = reader.getAttributeValue(i); break; default: throw unexpectedContent(reader); } } if (!required.isEmpty()) { throw missingAttributes(reader.getLocation(), required); } set.add(name); // consume remainder of element parseNoContent(reader); }
private Map<String, String> parseAttributes() { int num = parser.getAttributeCount(); Map<String, String> map = new HashMap<String, String>(); for (int i = 0; i < num; i++) { map.put(parser.getAttributeName(i).getLocalPart(), parser.getAttributeValue(i)); } return map; }
private Attributes getAttributes() { AttributesImpl attributes = new AttributesImpl(); for (int i = 0; i < reader.getAttributeCount(); i++) { String namespace = reader.getAttributeNamespace(i); if (namespace == null || !hasNamespacesFeature()) { namespace = ""; } String type = reader.getAttributeType(i); if (type == null) { type = "CDATA"; } attributes.addAttribute(namespace, reader.getAttributeLocalName(i), toQualifiedName(reader.getAttributeName(i)), type, reader.getAttributeValue(i)); } if (hasNamespacePrefixesFeature()) { for (int i = 0; i < reader.getNamespaceCount(); i++) { String prefix = reader.getNamespacePrefix(i); String namespaceUri = reader.getNamespaceURI(i); String qName; if (StringUtils.hasLength(prefix)) { qName = "xmlns:" + prefix; } else { qName = "xmlns"; } attributes.addAttribute("", "", qName, "CDATA", namespaceUri); } } return attributes; }
private boolean hasValueType(XMLStreamReader reader){ for(int i=0;i<reader.getAttributeCount();i++){ QName name = reader.getAttributeName(i); if(name != null && "ValueType".equals(name.getLocalPart())){ return true; } } return false; } }