protected ModelNode parseConfig ( XMLExtendedStreamReader reader , ModelElement xmlElement , String key , ModelNode lastNode , List < SimpleAttributeDefinition > attributes , List < ModelNode > addOperations ) throws XMLStreamException { if ( ! reader . getLocalName ( ) . equals ( xmlElement . getName ( ) ) ) { return null ; } ModelNode modelNode = Util . getEmptyOperation ( ADD , null ) ; int attributeCount = reader . getAttributeCount ( ) ; for ( int i = 0 ; i < attributeCount ; i ++ ) { String attributeLocalName = reader . getAttributeLocalName ( i ) ; if ( ModelElement . forName ( attributeLocalName ) == null ) { throw unexpectedAttribute ( reader , i ) ; } } for ( SimpleAttributeDefinition simpleAttributeDefinition : attributes ) { String attributeValue = reader . getAttributeValue ( "" , simpleAttributeDefinition . getXmlName ( ) ) ; simpleAttributeDefinition . parseAndSetParameter ( attributeValue , modelNode , reader ) ; } String name = xmlElement . getName ( ) ; if ( key != null ) { name = key ; if ( modelNode . hasDefined ( key ) ) { name = modelNode . get ( key ) . asString ( ) ; } else { String attributeValue = reader . getAttributeValue ( "" , key ) ; if ( attributeValue != null ) { name = attributeValue ; } } } modelNode . get ( ModelDescriptionConstants . OP_ADDR ) . set ( lastNode . clone ( ) . get ( OP_ADDR ) . add ( xmlElement . getName ( ) , name ) ) ; addOperations . add ( modelNode ) ; return modelNode ; }
Reads a element from the stream considering the parameters .