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:com.cedarsoft.serialization.test.performance.XmlParserPerformance.java

private void benchParse(javolution.xml.stream.XMLInputFactory inputFactory)
        throws XMLStreamException, javolution.xml.stream.XMLStreamException {
    for (int i = 0; i < BIG; i++) {
        javolution.xml.stream.XMLStreamReader parser = inputFactory
                .createXMLStreamReader(new StringReader(CONTENT_SAMPLE));

        assertEquals(XMLStreamReader.START_ELEMENT, parser.nextTag());
        assertEquals("fileType", parser.getLocalName().toString());

        boolean dependent = Boolean.parseBoolean(parser.getAttributeValue(null, "dependent").toString());

        assertEquals(XMLStreamReader.START_ELEMENT, parser.nextTag());
        assertEquals("id", parser.getLocalName().toString());
        assertEquals(XMLStreamReader.CHARACTERS, parser.next());

        String id = parser.getText().toString();

        assertEquals(XMLStreamReader.END_ELEMENT, parser.nextTag());
        assertEquals("id", parser.getLocalName().toString());

        assertEquals(XMLStreamReader.START_ELEMENT, parser.nextTag());
        assertEquals("extension", parser.getLocalName().toString());

        boolean isDefault = Boolean.parseBoolean(parser.getAttributeValue(null, "default").toString());
        String delimiter = parser.getAttributeValue(null, "delimiter").toString();

        assertEquals(XMLStreamReader.CHARACTERS, parser.next());

        String extension = parser.getText().toString();

        assertEquals(XMLStreamReader.END_ELEMENT, parser.nextTag());
        assertEquals("extension", parser.getLocalName().toString());

        assertEquals(XMLStreamReader.END_ELEMENT, parser.nextTag());
        assertEquals("fileType", parser.getLocalName().toString());
        assertEquals(XMLStreamReader.END_DOCUMENT, parser.next());

        parser.close();//from   w  w w.j a v a 2s  .c o  m

        FileType type = new FileType(id, new Extension(delimiter, extension, isDefault), dependent);
        assertNotNull(type);
    }
}

From source file:com.cedarsoft.serialization.test.performance.XmlParserPerformance.java

private void benchParse(XMLInputFactory inputFactory, @Nonnull String contentSample) throws XMLStreamException {
    for (int i = 0; i < BIG; i++) {
        XMLStreamReader parser = inputFactory.createXMLStreamReader(new StringReader(contentSample));

        assertEquals(XMLStreamReader.START_ELEMENT, parser.nextTag());
        assertEquals("fileType", parser.getLocalName());
        assertEquals("fileType", parser.getName().getLocalPart());

        boolean dependent = Boolean.parseBoolean(parser.getAttributeValue(null, "dependent"));

        assertEquals(XMLStreamReader.START_ELEMENT, parser.nextTag());
        assertEquals("id", parser.getName().getLocalPart());
        assertEquals(XMLStreamReader.CHARACTERS, parser.next());

        String id = parser.getText();

        assertEquals(XMLStreamReader.END_ELEMENT, parser.nextTag());

        assertEquals(XMLStreamReader.START_ELEMENT, parser.nextTag());
        assertEquals("extension", parser.getName().getLocalPart());

        boolean isDefault = Boolean.parseBoolean(parser.getAttributeValue(null, "default"));
        String delimiter = parser.getAttributeValue(null, "delimiter");

        assertEquals(XMLStreamReader.CHARACTERS, parser.next());

        String extension = parser.getText();
        assertEquals(XMLStreamReader.END_ELEMENT, parser.nextTag());
        assertEquals("extension", parser.getName().getLocalPart());

        assertEquals(XMLStreamReader.END_ELEMENT, parser.nextTag());
        assertEquals("fileType", parser.getName().getLocalPart());
        assertEquals(XMLStreamReader.END_DOCUMENT, parser.next());

        parser.close();/*from ww  w.  j  a v a 2s  . c  o m*/

        FileType type = new FileType(id, new Extension(delimiter, extension, isDefault), dependent);
        assertNotNull(type);
    }
}

From source file:com.microsoft.windowsazure.storage.table.TableParser.java

/**
 * Reserved for internal use. Reads the properties of an entity from the stream into a map of property names to
 * typed values. Reads the entity data as an AtomPub Entry Resource from the specified {@link XMLStreamReader} into
 * a map of <code>String</code> property names to {@link EntityProperty} data typed values.
 * //  w ww.j  av  a2  s.co  m
 * @param xmlr
 *            The <code>XMLStreamReader</code> to read the data from.
 * @param opContext
 *            An {@link OperationContext} object used to track the execution of the operation.
 * 
 * @return
 *         A <code>java.util.HashMap</code> containing a map of <code>String</code> property names to
 *         {@link EntityProperty} data typed values found in the entity data.
 * @throws XMLStreamException
 *             if an error occurs accessing the stream.
 * @throws ParseException
 *             if an error occurs converting the input to a particular data type.
 */
private static HashMap<String, EntityProperty> readAtomProperties(final XMLStreamReader xmlr,
        final OperationContext opContext) throws XMLStreamException, ParseException {
    int eventType = xmlr.getEventType();
    xmlr.require(XMLStreamConstants.START_ELEMENT, null, ODataConstants.PROPERTIES);
    final HashMap<String, EntityProperty> properties = new HashMap<String, EntityProperty>();

    while (xmlr.hasNext()) {
        eventType = xmlr.next();
        if (eventType == XMLStreamConstants.CHARACTERS) {
            xmlr.getText();
            continue;
        }

        if (eventType == XMLStreamConstants.START_ELEMENT
                && xmlr.getNamespaceURI().equals(ODataConstants.DATA_SERVICES_NS)) {
            final String key = xmlr.getLocalName();
            String val = Constants.EMPTY_STRING;
            String edmType = null;

            if (xmlr.getAttributeCount() > 0) {
                edmType = xmlr.getAttributeValue(ODataConstants.DATA_SERVICES_METADATA_NS, ODataConstants.TYPE);
            }

            // move to chars
            eventType = xmlr.next();

            if (eventType == XMLStreamConstants.CHARACTERS) {
                val = xmlr.getText();

                // end element
                eventType = xmlr.next();
            }

            xmlr.require(XMLStreamConstants.END_ELEMENT, null, key);

            final EntityProperty newProp = new EntityProperty(val, EdmType.parse(edmType));
            properties.put(key, newProp);
        } else if (eventType == XMLStreamConstants.END_ELEMENT && xmlr.getName().toString()
                .equals(ODataConstants.BRACKETED_DATA_SERVICES_METADATA_NS + ODataConstants.PROPERTIES)) {
            // End read properties
            break;
        }
    }

    xmlr.require(XMLStreamConstants.END_ELEMENT, null, ODataConstants.PROPERTIES);
    return properties;
}

From source file:edu.harvard.iq.dvn.ingest.statdataio.impl.plugins.ddi.DDIFileReader.java

private int processVarFormat(XMLStreamReader xmlr, SDIOMetadata smd, String variableName)
        throws XMLStreamException {
    String type = xmlr.getAttributeValue(null, "type");

    if (type == null || type.equals("")) {
        throw new XMLStreamException("no varFormat type supplied for variable " + variableName);
    }//  w  ww  .ja v a 2s. co  m

    String formatCategory = xmlr.getAttributeValue(null, "category");
    String formatSchema = xmlr.getAttributeValue(null, "schema");
    String formatName = xmlr.getAttributeValue(null, "formatname");

    if (formatCategory != null && !formatCategory.equals("")) {
        if (!formatCategory.equals("other") && !formatCategory.equals("date")
                && !formatCategory.equals("time")) {
            throw new XMLStreamException("unsupported varFormat category supplied for variable " + variableName
                    + ". (supported categories are \"date\", \"time\" and \"other\")");
        }
        formatCategoryTable.put(variableName, formatCategory);
    }

    if (formatName != null) {
        if (!formatName.equalsIgnoreCase("DATE") && !formatName.equalsIgnoreCase("DATETIME")) {
            // We will support more special formats in the future, but for now it is
            // just DATE and DATETIME.
            throw new XMLStreamException("unsupported varFormat formatname  supplied for variable "
                    + variableName + ". (supported formatnames are \"DATE\" and \"DATETIME\")");
        }
        printFormatNameTable.put(variableName, formatName);

    }

    // Not doing anything with the Schema attribute for now. The supported
    // DATE and DATETIME formats are both from the SPSS schema; once we
    // start supporting formats from other schemas, we'll have to use
    // this attribute to identify them.

    if (type.equals(VAR_FORMAT_TYPE_NUMERIC)) {
        return 0;
    }

    if (type.equals(VAR_FORMAT_TYPE_CHARACTER)) {
        return 1;
    }

    throw new XMLStreamException("unknown or unsupported varFormat type supplied for variable " + variableName);

}

From source file:com.archivas.clienttools.arcutils.impl.adapter.Hcap2Adapter.java

public ArcMoverFile createArcMoverFileObject(XMLStreamReader xmlr, ArcMoverDirectory caller)
        throws StorageAdapterException {
    ArcMoverFile retVal = null;//ww  w  . ja v  a 2  s  .  c o m
    try {
        ArcMoverDirectory rootDir = ArcMoverDirectory.getDirInstance(this.getProfile(), caller.getPath(), this);

        String fileName = xmlr.getAttributeValue(null, HttpGatewayConstants.FILE_NAME);
        try {
            // HCP sends incorrectly encoded filenames. Not all chars are encoded. Fix it.
            fileName = RFC2396Encoder.fixEncoding(fileName);
        } catch (UnsupportedEncodingException e) {
            throw new StorageAdapterException(e.getMessage(), e);
        }

        String fileTypeStr = xmlr.getAttributeValue(null, HttpGatewayConstants.FILE_TYPE);
        FileType fileType = FileType.FILE;
        if (fileTypeStr.equals(DIRECTORY)) {
            fileType = FileType.DIRECTORY;
        } else if (fileTypeStr.equals(SYMLINK)) {
            fileType = FileType.SYMLINK;
        }

        // The time provided by the cluster is in seconds since epoch. Java uses milliseconds
        // since epoch, so we must multiply by 1000
        String modifyTimeString = xmlr.getAttributeValue(null, HttpGatewayConstants.MD_DEFAULT_PARAM_MTIME);
        String accessTimeString = xmlr.getAttributeValue(null, HttpGatewayConstants.MD_DEFAULT_PARAM_ATIME);
        Date modifyTime = (modifyTimeString == null ? null : new Date(Long.parseLong(modifyTimeString) * 1000));
        Date accessTime = (accessTimeString == null ? null : new Date(Long.parseLong(accessTimeString) * 1000));

        long size = 0;
        int mode = 0;
        Long uid = Long.valueOf(0);
        Long gid = Long.valueOf(0);

        try {
            size = Long.parseLong(xmlr.getAttributeValue(null, HttpGatewayConstants.MD_PARAM_SIZE));
        } catch (NumberFormatException e) {
            // do nothing
        }
        try {
            mode = FileMetadata.covertHCAPToUNIX(
                    Integer.parseInt(xmlr.getAttributeValue(null, HttpGatewayConstants.MD_PARAM_PERMS)),
                    fileType);
        } catch (NumberFormatException e) {
            // do nothing
        }
        try {
            uid = UidGidUtil.validateId(xmlr.getAttributeValue(null, HttpGatewayConstants.MD_PARAM_PERMS_UID));
        } catch (NumberFormatException e) {
            // do nothing
        }
        try {
            gid = UidGidUtil.validateId(xmlr.getAttributeValue(null, HttpGatewayConstants.MD_PARAM_PERMS_GID));
        } catch (NumberFormatException e) {
            // do nothing
        }

        FileMetadata metadata = new FileMetadata(fileType, null, // creation time
                null, // ctime
                modifyTime, accessTime, size, fileName.startsWith("."), // hidden
                null, // file perms
                null, // directory perms
                uid, gid, null, // hcap version
                null, // dpl
                null, // hash scheme
                null, // hash value
                null, // shred
                null, // retention
                null, // retention hold
                null, // search index
                null, // replicated
                null, // acl
                null, // owner
                null); // custom metadata
        if (fileType.equals(FileType.DIRECTORY) && !fileName.equals(DOT)) {
            metadata.setDirMode(mode);
            retVal = ArcMoverDirectory.getDirInstance(rootDir, fileName, metadata, this);
        } else if (fileType.equals(FileType.FILE)) {
            metadata.setFileMode(mode);
            ArcMoverFile moverFile = ArcMoverFile.getFileInstance(getProfile(), rootDir, fileName, metadata);
            retVal = moverFile;
        } else if (FileType.SYMLINK == fileType) {
            retVal = ArcMoverSymlink.getSymlinkInstance(rootDir, fileName, null, this);
        }

    } catch (Exception e) {
        String msg = "Error parsing directory for: " + caller.getPath();
        LOG.log(Level.INFO, msg, e);
        IOException e2 = new IOException(msg);
        e2.initCause(e);
        throw new StorageAdapterException(e2.getMessage(), e2);
    }
    return retVal;
}

From source file:edu.harvard.iq.dvn.ingest.statdataio.impl.plugins.ddi.DDIFileReader.java

private void processCatgry(XMLStreamReader xmlr, Map<String, String> valueLabelPairs,
        List<String> missingValues, String variableName) throws XMLStreamException {

    boolean isMissing = "Y".equals(xmlr.getAttributeValue(null, "missing"));
    // (default is N, so null sets missing to false)

    // STORE -- (TODO NOW)
    //cat.setDataVariable(dv);
    //dv.getCategories().add(cat);
    String varValue = null;//w  w w . j  a  v a 2s . com
    String valueLabel = null;

    for (int event = xmlr.next(); event != XMLStreamConstants.END_DOCUMENT; event = xmlr.next()) {
        if (event == XMLStreamConstants.START_ELEMENT) {
            if (xmlr.getLocalName().equals("labl")) {
                valueLabel = processLabl(xmlr, LEVEL_CATEGORY);
            } else if (xmlr.getLocalName().equals("catValu")) {
                varValue = parseText(xmlr, false);
            } else if (xmlr.getLocalName().equals("catStat")) {
                // category statistics should not be present in the
                // TAB file + DDI card ingest:
                throw new XMLStreamException(
                        "catStat (Category Statistics) section found in a variable section; not supported!");
            }
        } else if (event == XMLStreamConstants.END_ELEMENT) {
            if (xmlr.getLocalName().equals("catgry")) {

                if (varValue != null && !varValue.equals("")) {
                    if (valueLabel != null && !valueLabel.equals("")) {
                        dbgLog.fine("DDI Reader: storing label " + valueLabel + " for value " + varValue);
                        valueLabelPairs.put(varValue, valueLabel);
                    }
                    if (isMissing) {
                        missingValues.add(varValue);
                    }
                }

                return;
            } else if (xmlr.getLocalName().equals("catValu")) {
                // continue;
            } else if (xmlr.getLocalName().equals("labl")) {
                // continue;
            } else {
                throw new XMLStreamException(
                        "Mismatched DDI Formatting: </catgry> expected, found " + xmlr.getLocalName());
            }
        }
    }
}

From source file:edu.harvard.iq.dvn.ingest.statdataio.impl.plugins.ddi.DDIFileReader.java

private void processVar(XMLStreamReader xmlr, SDIOMetadata smd, int variableNumber) throws XMLStreamException {

    // Attributes:

    // ID -- can be ignored (will be reassigned);

    // name:/*from  w w  w.jav a  2  s .  co m*/

    String variableName = xmlr.getAttributeValue(null, "name");
    if (variableName == null || variableName.equals("")) {
        throw new XMLStreamException("NULL or empty variable name attribute.");
    }

    variableNameList.add(variableName);

    // interval type:
    String varIntervalType = xmlr.getAttributeValue(null, "intrvl");

    // OK if not specified; defaults to discrete:
    varIntervalType = (varIntervalType == null ? VAR_INTERVAL_DISCRETE : varIntervalType);

    // Number of decimal points:

    String dcmlAttr = xmlr.getAttributeValue(null, "dcml");
    Long dcmlPoints = null;

    if (dcmlAttr != null && !dcmlAttr.equals("")) {
        try {
            dcmlPoints = new Long(dcmlAttr);
        } catch (NumberFormatException nfe) {
            throw new XMLStreamException("Invalid variable dcml attribute: " + dcmlAttr);
        }
    }

    // weighed variables not supported yet -- L.A.
    //dv.setWeighted( VAR_WEIGHTED.equals( xmlr.getAttributeValue(null, "wgt") ) );
    // default is not-wgtd, so null sets weighted to false

    Map<String, String> valueLabelPairs = new LinkedHashMap<String, String>();
    List<String> missingValues = new ArrayList<String>();

    for (int event = xmlr.next(); event != XMLStreamConstants.END_DOCUMENT; event = xmlr.next()) {
        if (event == XMLStreamConstants.START_ELEMENT) {
            if (xmlr.getLocalName().equals("location")) {
                processLocation(xmlr, smd);
            } else if (xmlr.getLocalName().equals("labl")) {
                String _labl = processLabl(xmlr, LEVEL_VARIABLE);
                if (_labl != null && !_labl.equals("")) {
                    variableLabelMap.put(variableName, _labl);
                }
            } else if (xmlr.getLocalName().equals("invalrng")) {
                processInvalrng(xmlr, smd, variableName);
            } else if (xmlr.getLocalName().equals("varFormat")) {
                int simpleVariableFormat = processVarFormat(xmlr, smd, variableName);
                variableTypeList.add(simpleVariableFormat);

            } else if (xmlr.getLocalName().equals("catgry")) {
                processCatgry(xmlr, valueLabelPairs, missingValues, variableName);

            } else if (xmlr.getLocalName().equals("universe")) {
                // Should not occur in TAB+DDI ingest (?)
                // ignore.
            } else if (xmlr.getLocalName().equals("concept")) {
                // Same deal.
            } else if (xmlr.getLocalName().equals("notes")) {
                // Same.
            } else if (xmlr.getLocalName().equals("sumStat")) {
                throw new XMLStreamException(
                        "sumStat (Summary Statistics) section found in a variable section; not supported!");
            }

            // the "todos" below are from DDIServiceBean -- L.A.
            // todo: qstnTxt: wait to handle until we know more of how we will use it
            // todo: wgt-var : waitng to see example

        } else if (event == XMLStreamConstants.END_ELEMENT) {
            if (xmlr.getLocalName().equals("var")) {
                // Before returning, set rich variable type metadata:
                if (variableTypeList.get(variableNumber) == 0) {
                    // this is a numeric variable;
                    // It could be discrete or continuous, with the number
                    // of decimal points explicitely specified.
                    unfVariableTypes.put(variableName, 0); // default
                    printFormatList.add(5);

                    formatCategoryTable.put(variableName, "other");

                    if ((dcmlPoints != null && dcmlPoints > new Long(0))
                            || (!varIntervalType.equals(VAR_INTERVAL_DISCRETE))) {
                        unfVariableTypes.put(variableName, 1);
                        decimalVariableSet.add(variableNumber);
                        if (dcmlPoints == null || dcmlPoints == new Long(0)) {
                            dcmlPoints = new Long(7);
                        }
                        printFormatNameTable.put(variableName, "F8." + dcmlPoints);
                    } else {
                        unfVariableTypes.put(variableName, 0);

                    }

                } else {
                    // this is a string variable.
                    // (or Date; whih is stored as a string, for most purposes,
                    // but requires some special treatment.

                    unfVariableTypes.put(variableName, -1);
                    printFormatList.add(1);
                    if (!"date".equals(formatCategoryTable.get(variableName))
                            && !"time".equals(formatCategoryTable.get(variableName))) {
                        formatCategoryTable.put(variableName, "other");
                    }

                }

                // Variable Label:
                // (if it's not supplied, we create an empty placeholder)

                if (variableLabelMap.get(variableName) == null
                        || variableLabelMap.get(variableName).equals("")) {
                    variableLabelMap.put(variableName, "");
                }

                // Value Labels:

                if (!valueLabelPairs.isEmpty()) {

                    valueLabelTable.put(variableName, valueLabelPairs);
                    dbgLog.warning("valueLabelTable = " + valueLabelTable.toString());
                    dbgLog.warning("valueLabelTable = " + valueLabelTable);

                    valueVariableMappingTable.put(variableName, variableName);
                }

                // Missing Values:

                if (!missingValues.isEmpty()) {
                    missingValueTable.put(variableName, missingValues);
                }

                dbgLog.info("processed variable number " + variableNumber);

                return;
            }
        }
    }
}

From source file:davmail.exchange.ews.EWSMethod.java

protected void handleEmailAddresses(XMLStreamReader reader, Item item) throws XMLStreamException {
    while (reader.hasNext() && !(XMLStreamUtil.isEndTag(reader, "EmailAddresses"))) {
        reader.next();//  w  w w.j av  a2  s  . c o  m
        if (XMLStreamUtil.isStartTag(reader)) {
            String tagLocalName = reader.getLocalName();
            if ("Entry".equals(tagLocalName)) {
                item.put(reader.getAttributeValue(null, "Key"), XMLStreamUtil.getElementText(reader));
            }
        }
    }
}

From source file:com.liferay.portal.util.LocalizationImpl.java

private String _getRootAttribute(String xml, String name, String defaultValue) {

    String value = null;/*from ww w .ja v a2s .  c  o  m*/

    XMLStreamReader xmlStreamReader = null;

    ClassLoader portalClassLoader = PortalClassLoaderUtil.getClassLoader();

    Thread currentThread = Thread.currentThread();

    ClassLoader contextClassLoader = currentThread.getContextClassLoader();

    try {
        if (contextClassLoader != portalClassLoader) {
            currentThread.setContextClassLoader(portalClassLoader);
        }

        XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();

        xmlStreamReader = xmlInputFactory.createXMLStreamReader(new UnsyncStringReader(xml));

        if (xmlStreamReader.hasNext()) {
            xmlStreamReader.nextTag();

            value = xmlStreamReader.getAttributeValue(null, name);
        }
    } catch (Exception e) {
        if (_log.isWarnEnabled()) {
            _log.warn(e, e);
        }
    } finally {
        if (contextClassLoader != portalClassLoader) {
            currentThread.setContextClassLoader(contextClassLoader);
        }

        if (xmlStreamReader != null) {
            try {
                xmlStreamReader.close();
            } catch (Exception e) {
            }
        }
    }

    if (Validator.isNull(value)) {
        value = defaultValue;
    }

    return value;
}

From source file:com.sun.socialsite.pojos.PropDefinition.java

protected void init(PropDefinition profileDef, InputStream input) throws SocialSiteException {
    try {/*  w  ww .j a v a 2  s .com*/
        XMLInputFactory factory = XMLInputFactory.newInstance();
        XMLStreamReader parser = factory.createXMLStreamReader(input);
        String ns = null; // TODO: namespace for ProfileDef

        // hold the current things we're working on
        Map<String, DisplaySectionDefinition> sdefs = new LinkedHashMap<String, DisplaySectionDefinition>();
        Stack<PropertyDefinitionHolder> propertyHolderStack = new Stack<PropertyDefinitionHolder>();
        List<AllowedValue> allowedValues = null;
        PropertyDefinition pdef = null;

        for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
            switch (event) {
            case XMLStreamConstants.START_ELEMENT:
                log.debug("START ELEMENT -- " + parser.getLocalName());

                if ("display-section".equals(parser.getLocalName())) {
                    propertyHolderStack.push(new DisplaySectionDefinition(parser.getAttributeValue(ns, "name"),
                            parser.getAttributeValue(ns, "namekey")));

                } else if ("property".equals(parser.getLocalName())) {
                    PropertyDefinitionHolder holder = propertyHolderStack.peek();
                    pdef = new PropertyDefinition(holder.getBasePath(), parser.getAttributeValue(ns, "name"),
                            parser.getAttributeValue(ns, "namekey"), parser.getAttributeValue(ns, "type"));

                } else if ("object".equals(parser.getLocalName())) {
                    PropertyDefinitionHolder holder = propertyHolderStack.peek();
                    propertyHolderStack.push(new PropertyObjectDefinition(holder.getBasePath(),
                            parser.getAttributeValue(ns, "name"), parser.getAttributeValue(ns, "namekey")));

                } else if ("collection".equals(parser.getLocalName())) {
                    PropertyDefinitionHolder holder = propertyHolderStack.peek();
                    propertyHolderStack.push(new PropertyObjectCollectionDefinition(holder.getBasePath(),
                            parser.getAttributeValue(ns, "name"), parser.getAttributeValue(ns, "namekey")));

                } else if ("allowed-values".equals(parser.getLocalName())) {
                    allowedValues = new ArrayList<AllowedValue>();

                } else if ("value".equals(parser.getLocalName())) {
                    AllowedValue allowedValue = new AllowedValue(parser.getAttributeValue(ns, "name"),
                            parser.getAttributeValue(ns, "namekey"));
                    allowedValues.add(allowedValue);

                } else if ("default-value".equals(parser.getLocalName())) {
                    pdef.setDefaultValue(parser.getText());
                }
                break;

            case XMLStreamConstants.END_ELEMENT:
                log.debug("END ELEMENT -- " + parser.getLocalName());

                if ("display-section".equals(parser.getLocalName())) {
                    DisplaySectionDefinition sdef = (DisplaySectionDefinition) propertyHolderStack.pop();
                    sdefs.put(sdef.getName(), sdef);

                } else if ("property".equals(parser.getLocalName())) {
                    PropertyDefinitionHolder holder = propertyHolderStack.peek();
                    holder.getPropertyDefinitions().add(pdef);
                    propertyDefs.put(pdef.getName(), pdef);
                    pdef = null;

                } else if ("object".equals(parser.getLocalName())) {
                    PropertyObjectDefinition odef = (PropertyObjectDefinition) propertyHolderStack.pop();
                    PropertyDefinitionHolder holder = propertyHolderStack.peek();
                    holder.getPropertyObjectDefinitions().add(odef);

                    // add to list of all property object defs
                    propertyObjectDefs.put(odef.getName(), odef);
                    odef = null;

                } else if ("collection".equals(parser.getLocalName())) {
                    PropertyObjectCollectionDefinition cdef = (PropertyObjectCollectionDefinition) propertyHolderStack
                            .pop();
                    PropertyDefinitionHolder holder = propertyHolderStack.peek();
                    holder.getPropertyObjectCollectionDefinitions().add(cdef);

                    // add to list of all property object defs
                    propertyObjectCollectionDefs.put(cdef.getName(), cdef);
                    cdef = null;

                } else if ("allowed-values".equals(parser.getLocalName())) {
                    pdef.setAllowedValues(allowedValues);
                    allowedValues = null;
                }
                break;

            case XMLStreamConstants.CHARACTERS:
                break;

            case XMLStreamConstants.CDATA:
                break;

            } // end switch
        } // end while

        parser.close();

        profileDef.sectionDefs = sdefs;

    } catch (Exception ex) {
        throw new SocialSiteException("ERROR parsing profile definitions", ex);
    }
}