Example usage for javax.xml.stream XMLStreamReader getAttributeValue

List of usage examples for javax.xml.stream XMLStreamReader getAttributeValue

Introduction

In this page you can find the example usage for javax.xml.stream XMLStreamReader getAttributeValue.

Prototype

public String getAttributeValue(String namespaceURI, String localName);

Source Link

Document

Returns the normalized attribute value of the attribute with the namespace and localName If the namespaceURI is null the namespace is not checked for equality

Usage

From source file:org.slc.sli.modeling.wadl.reader.WadlReader.java

private static final ParamStyle getParamStyle(final XMLStreamReader reader, final WadlAttributeName name) {
    return WadlSyntax.decodeParamStyle(reader.getAttributeValue(GLOBAL_NAMESPACE, name.getLocalName()));
}

From source file:org.slc.sli.modeling.wadl.reader.WadlReader.java

private static final QName getQNameAttribute(final WadlAttributeName name, final QName defaultValue,
        final XMLStreamReader reader) {
    final String value = reader.getAttributeValue(GLOBAL_NAMESPACE, name.getLocalName());
    if (value != null) {
        return toQName(value, reader);
    } else {/*from  w ww .  ja  v a  2 s  . c o  m*/
        return defaultValue;
    }
}

From source file:org.slc.sli.modeling.wadl.reader.WadlReader.java

private static final String getQueryType(final XMLStreamReader reader, final String defaultName) {
    final String name = reader.getAttributeValue(GLOBAL_NAMESPACE, WadlAttributeName.QUERY_TYPE.getLocalName());
    if (name != null) {
        return name;
    } else {//from  w w  w  . java 2 s. co  m
        return defaultName;
    }
}

From source file:org.slc.sli.modeling.wadl.reader.WadlReader.java

private static final String getStringAttribute(final WadlAttributeName name, final String defaultValue,
        final XMLStreamReader reader) {
    final String value = reader.getAttributeValue(GLOBAL_NAMESPACE, name.getLocalName());
    if (value != null) {
        return value;
    } else {/*from  w w w. java 2s . c om*/
        return defaultValue;
    }
}

From source file:org.slc.sli.modeling.wadl.reader.WadlReader.java

private static final List<String> getStringListType(final WadlAttributeName name,
        final XMLStreamReader reader) {
    final String value = reader.getAttributeValue(GLOBAL_NAMESPACE, name.getLocalName());
    if (value != null) {
        final String delims = "[ ]+";
        final String[] tokens = value.split(delims);
        final List<String> strings = new ArrayList<String>(tokens.length);
        for (int i = 0; i < tokens.length; i++) {
            strings.add(tokens[i]);/*from  ww  w.  j av a 2  s.c  o m*/
        }
        return strings;
    } else {
        return Collections.emptyList();
    }
}

From source file:org.slc.sli.modeling.wadl.reader.WadlReader.java

private static final String getTitle(final XMLStreamReader reader, final String defaultName) {
    final String name = reader.getAttributeValue(GLOBAL_NAMESPACE, WadlAttributeName.TITLE.getLocalName());
    if (name != null) {
        return name;
    } else {//  w  ww . j  a v a2  s  . c  o  m
        return defaultName;
    }
}

From source file:org.slc.sli.modeling.xmi.reader.XmiReader.java

protected static final boolean getBoolean(final XmiAttributeName name, final boolean defaultValue,
        final XMLStreamReader reader) {
    final String value = reader.getAttributeValue(GLOBAL_NAMESPACE, name.getLocalName());
    if (value != null) {
        return Boolean.valueOf(value);
    } else {/*from  w  ww.j  a va2 s  .c om*/
        return defaultValue;
    }
}

From source file:org.slc.sli.modeling.xmi.reader.XmiReader.java

protected static final Identifier getId(final XMLStreamReader reader) {
    return Identifier
            .fromString(reader.getAttributeValue(GLOBAL_NAMESPACE, XmiAttributeName.ID.getLocalName()));
}

From source file:org.slc.sli.modeling.xmi.reader.XmiReader.java

protected static final Identifier getIdRef(final XMLStreamReader reader) throws XmiMissingAttributeException {
    final String value = reader.getAttributeValue(GLOBAL_NAMESPACE, XmiAttributeName.IDREF.getLocalName());
    if (value != null) {
        return Identifier.fromString(value);
    } else {/*ww w . j  a va2 s  .  c o  m*/
        throw new XmiMissingAttributeException(XmiAttributeName.IDREF.getLocalName());
    }
}

From source file:org.slc.sli.modeling.xmi.reader.XmiReader.java

protected static final String getName(final XMLStreamReader reader, final String defaultName,
        final XmiAttributeName attr) {
    final String name = reader.getAttributeValue(GLOBAL_NAMESPACE, attr.getLocalName());
    if (name != null) {
        return name;
    } else {//from   ww w.j  ava2 s .  c o m
        return defaultName;
    }
}