Reads the attributes contained with-in an RDF:Description node and
converts it all to an Account.

@param element The element (Node) to parse.
@return An Account.
@throws Exception if something goes wrong.
978755
private Account readAccountFromDescriptionNode(Element element)
            throws Exception {
        Account account = new Account();

        // This is the hash
        account.setId(element.getAttribute("RDF:about").trim());
        account.setName(element.getAttribute("NS1:name").trim());
        account.setDesc(element.getAttribute("NS1:description").trim());

        // Groups only have a name, about, and description attribute.
        // If this is detected, mark it as a folder. Otherwise read
        // the full account data set.
        if (!element.hasAttribute("NS1:hashAlgorithmLB")) {
            account.setIsFolder(true);
        } else {
            account.setLeetType(LeetType.fromRdfString(element.getAttribute("NS1:whereLeetLB").trim().toLowerCase()));
            String level = element.getAttribute("NS1:leetLevelLB").trim();
            // chrome passwordmaker sets this to zero when leet is turned off.
            if (level.equals("0")) level = "1";
                account.setLeetLevel(LeetLevel.fromString(level));

            String algorithm = element.getAttribute("NS1:hashAlgorithmLB").trim().toLowerCase();
            Pair<AlgorithmType, Boolean> algo = fromRdfString(account, algorithm);
            account.setAlgorithm(algo.first);
            account.setTrim(algo.second);
            account.setHmac(algorithm.contains("hmac-"));

            String passwordLength = element.getAttribute("NS1:passwordLength").trim();
            if (passwordLength.length() > 0)
                account.setLength(Integer.parseInt(passwordLength));
            else
                account.setLength(Account.DEFAULT_LENGTH);

            account.setUsername(element.getAttribute("NS1:usernameTB").trim());
            account.setModifier(element.getAttribute("NS1:counter").trim());
            // If trim is not set, that means only the Hex characterset is used.
            if ( account.isTrim() )
                account.setCharacterSet(element.getAttribute("NS1:charset").trim());
            account.setPrefix(element.getAttribute("NS1:prefix").trim());
            account.setSuffix(element.getAttribute("NS1:suffix").trim());
            account.setAutoPop(element.getAttribute("NS1:autoPopulate").trim().compareTo("true") == 0);

            // Read the URL extraction specifiers
            account.clearUrlComponents();
            if (element.getAttribute("NS1:protocolCB").trim().compareToIgnoreCase("true") == 0)
                account.addUrlComponent(Account.UrlComponents.Protocol);
            if (element.getAttribute("NS1:subdomainCB").trim().compareToIgnoreCase("true") == 0)
                account.addUrlComponent(Account.UrlComponents.Subdomain);
            if (element.getAttribute("NS1:domainCB").trim().compareToIgnoreCase("true") == 0)
                account.addUrlComponent(Account.UrlComponents.Domain);
            if (element.getAttribute("NS1:pathCB").trim().compareToIgnoreCase("true") == 0)
                account.addUrlComponent(Account.UrlComponents.PortPathAnchorQuery);
            account.setUrl(element.getAttribute("NS1:urlToUse").trim());

            // pattern info... I really hope nobody has more than 100000(MAX_PATTERNS)
            for (int iPattern = 0; iPattern < MAX_PATTERNS; ++iPattern) {
                String pattern = element.getAttribute("NS1:pattern" + iPattern).trim();
                String patternType = element.getAttribute("NS1:patterntype" + iPattern).trim();
                String patternEnabled = element.getAttribute("NS1:patternenabled" + iPattern).trim();
                String patternDesc = element.getAttribute("NS1:patterndesc" + iPattern).trim();

                if (pattern.length() > 0 || patternType.length() > 0 || patternEnabled.length() > 0 || patternDesc.length() > 0) {
                    AccountPatternData data = new AccountPatternData();
                    if ( patternDesc.isEmpty() ) patternDesc = pattern;
                    data.setPattern(pattern);
                    data.setType(AccountPatternType.fromString(patternType));
                    data.setEnabled(patternEnabled.compareTo("true") == 0);
                    data.setDesc(patternDesc);
                    account.getPatterns().add(data);
                } else {
                    iPattern = MAX_PATTERNS + 1;
                }
            }
        }

        if ( account.isRoot() ) {
            // The root node isn't really an account, just a starting point for our account tree.
            if ( ! account.getUrlComponents().isEmpty() || ! account.getUrl().isEmpty()
                    || ! account.getUsername().isEmpty() || !account.getPatterns().isEmpty() ) {
                logger.info("Clear out junk settings on the ROOT account.");
                account.clearUrlComponents();
                account.setUrl("");
                account.setUsername("");
                account.getPatterns().clear();
            }
        }

        return account;
    }
796262
public CarbonReply send(Element element) throws CarbonException
	{
		try
		{
			final String responseXml = send(serialise(element));

			return new CarbonReply(deserialise(responseXml));
		}
		catch (CarbonException e)
		{
			throw e;
		}
		catch (Exception e)
		{
			throw new CarbonException(e);
		}
	}
216868
private int parseObject() throws Exception {
        int elementsWritten = 0;
        while (jsonParser.nextToken() != null && jsonParser.getCurrentToken() != END_OBJECT) {
            if (FIELD_NAME.equals(jsonParser.getCurrentToken())) {
                String elementName = convertName(jsonParser.getCurrentName());
                //jump to element value
                jsonParser.nextToken();
                startElement(elementName);
                parseElement(elementName, false);
                endElement(elementName);
                elementsWritten++;
            } else {
                throw new ParserException("Error when parsing. Expected field name got " + jsonParser.getCurrentToken());
            }
        }
        return elementsWritten;
    }
1186476
public final void elementValuePair() throws RecognitionException {
		int elementValuePair_StartIndex = input.index();

		try {
			if ( state.backtracking>0 && alreadyParsedRule(input, 68) ) { return; }

			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:625:5: ( ( Identifier '=' )? elementValue )
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:625:7: ( Identifier '=' )? elementValue
			{
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:625:7: ( Identifier '=' )?
			int alt90=2;
			int LA90_0 = input.LA(1);
			if ( (LA90_0==Identifier) ) {
				int LA90_1 = input.LA(2);
				if ( (LA90_1==54) ) {
					alt90=1;
				}
			}
			switch (alt90) {
				case 1 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:625:8: Identifier '='
					{
					match(input,Identifier,FOLLOW_Identifier_in_elementValuePair2383); if (state.failed) return;
					match(input,54,FOLLOW_54_in_elementValuePair2385); if (state.failed) return;
					}
					break;

			}

			pushFollow(FOLLOW_elementValue_in_elementValuePair2389);
			elementValue();
			state._fsp--;
			if (state.failed) return;
			}

		}
		catch (RecognitionException re) {
			reportError(re);
			recover(input,re);
		}
		finally {
			// do for sure before leaving
			if ( state.backtracking>0 ) { memoize(input, 68, elementValuePair_StartIndex); }

		}
	}
554121
public void set(Element element) {
        if (element == null) {
            throw new NullPointerException("element == null");
        }

        CstString pairName = new CstString(element.getName());
        Constant pairValue = Element.toConstant(element.getValue());
        NameValuePair nameValuePair = new NameValuePair(pairName, pairValue);
        elements.put(element.getName(), nameValuePair);
    }
531843
protected void parseWorkspaceElement(final Element element) throws ProponoException {
        final Element titleElem = element.getChild("title", AtomService.ATOM_FORMAT);
        setTitle(titleElem.getText());
        if (titleElem.getAttribute("type", AtomService.ATOM_FORMAT) != null) {
            setTitleType(titleElem.getAttribute("type", AtomService.ATOM_FORMAT).getValue());
        }
        final List<Element> collections = element.getChildren("collection", AtomService.ATOM_PROTOCOL);
        for (final Element e : collections) {
            addCollection(new Collection(e));
        }
    }
342003
@Override
   public void startElement(String namespaceURI, String localName, String name, Map<String, String> atts)
      throws RepositoryException
   {
      InternalQName elementName = locationFactory.parseJCRName(name).getInternalName();

      if (Constants.SV_NODE_NAME.equals(elementName))
      {
         // sv:node element

         // node name (value of sv:name attribute)
         String svName = getAttribute(atts, Constants.SV_NAME_NAME);
         if (svName == null)
         {
            throw new RepositoryException("Missing mandatory sv:name attribute of element sv:node");
         }
         String svId = getAttribute(atts, Constants.EXO_ID_NAME);
         if (svId == null)
         {
            throw new RepositoryException("Missing mandatory exo:id attribute of element sv:node");
         }

         ImportNodeData newNodeData;
         InternalQName currentNodeName;
         int nodeIndex = 1;
         NodeData parentData = getParent();
         if (!isFirstElementChecked)
         {
            if (!ROOT_NODE_NAME.equals(svName))
            {
               throw new RepositoryException("The first element must be root. But found '" + svName + "'");
            }

            isFirstElementChecked = true;
         }

         if (ROOT_NODE_NAME.equals(svName))
         {
            // remove the wrong root from the stack
            tree.pop();

            newNodeData = addChangesForRootNodeInitialization(parentData);
         }
         else
         {
            currentNodeName = locationFactory.parseJCRName(svName).getInternalName();
            nodeIndex = getNodeIndex(parentData, currentNodeName, null);
            newNodeData = new ImportNodeData(parentData, currentNodeName, nodeIndex);
            newNodeData.setOrderNumber(getNextChildOrderNum(parentData));
            newNodeData.setIdentifier(svId);
            changesLog.add(new ItemState(newNodeData, ItemState.ADDED, true, parentData.getQPath()));
         }
         tree.push(newNodeData);

         mapNodePropertiesInfo.put(newNodeData.getIdentifier(), new NodePropertiesInfo(newNodeData));
      }
      else
      {
         super.startElement(namespaceURI, localName, name, atts);
         if (Constants.SV_PROPERTY_NAME.equals(elementName))
         {
            String svId = getAttribute(atts, Constants.EXO_ID_NAME);
            if (svId == null)
            {
               throw new RepositoryException("Missing mandatory exo:id attribute of element sv:property");
            }
            propertyInfo.setIndentifer(svId);
         }
      }
   }
1352891
public TLVElement readElement() throws IOException, TLVParserException {
        TlvHeader header = readHeader();
        TLVElement element = new TLVElement(header.tlv16, header.nonCritical, header.forwarded, header.type);
        int count = countNestedTlvElements(header);
        if (count > 0) {
            readNestedElements(element, count);
        } else {
            element.setContent(readTlvContent(header));
        }
        return element;
    }
340365
@Override
    public void readElement(XMLExtendedStreamReader reader, List<ModelNode> result) throws XMLStreamException {

        Map<PathAddress, ModelNode> operations = new LinkedHashMap<>();

        PathAddress subsystemAddress = PathAddress.pathAddress(InfinispanExtension.SUBSYSTEM_PATH);
        ModelNode subsystem = Util.createAddOperation(subsystemAddress);

        // command to add the subsystem
        operations.put(subsystemAddress, subsystem);

        while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT)) {
            Element element = Element.forName(reader.getLocalName());
            switch (element) {
                case CACHE_CONTAINER: {
                    parseContainer(reader, subsystemAddress, operations);
                    break;
                }
                default: {
                    throw ParseUtils.unexpectedElement(reader);
                }
            }
        }

        result.addAll(operations.values());
    }
668368
private void parseElement(final String elementName, final boolean inArray) throws Exception {
        JsonToken currentToken = jsonParser.getCurrentToken();
        if (inArray) {
            startElement(elementName);
        }
        if (START_OBJECT.equals(currentToken)) {
            parseObject();
        } else if (START_ARRAY.equals(currentToken)) {
            parseArray(elementName);
        } else if (currentToken.isScalarValue()) {
            parseValue();
        }
        if (inArray) {
            endElement(elementName);
        }
    }
106293
public static BindEntity parse(final BindModel model, TypeElement element) {
		final Elements elementUtils = BaseProcessor.elementUtils;

		final InnerCounter counterPropertyInValue = new InnerCounter();
		final Converter<String, String> typeNameConverter = CaseFormat.UPPER_CAMEL.converterTo(CaseFormat.LOWER_CAMEL);
		final TypeElement beanElement = element;
				
		final BindEntity currentEntity = new BindEntity(beanElement.getSimpleName().toString(), beanElement, AnnotationUtility.buildAnnotationList(element, classAnnotationFilter));

		// tag typeName
		String tagName = AnnotationUtility.extractAsString(beanElement, BindType.class, AnnotationAttributeType.VALUE);
		if (StringUtils.hasText(tagName)) {
			currentEntity.xmlInfo.label = tagName;
		} else {
			currentEntity.xmlInfo.label = typeNameConverter.convert(beanElement.getSimpleName().toString());
		}
		
		// esamine namespaces
		if (element.getAnnotation(BindXmlType.class) != null) {
			FindXmlNamespaceVisitor visitor = new FindXmlNamespaceVisitor();

			for (AnnotationMirror annotationMirror : element.getAnnotationMirrors()) {
				Map<? extends ExecutableElement, ? extends AnnotationValue> elementValues = annotationMirror.getElementValues();

				if (BindXmlType.class.getName().equals(annotationMirror.getAnnotationType().toString())) {
					for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> entry : elementValues.entrySet()) {
						String key = entry.getKey().getSimpleName().toString();

						entry.getValue().accept(visitor, key);
					}
					List<Pair<String, String>> namespaces = visitor.getNamespace();
					currentEntity.xmlInfo.namespaces = namespaces;

					break;
				}
			}
		}
		
		
		final boolean bindAllFields = AnnotationUtility.getAnnotationAttributeAsBoolean(currentEntity, BindType.class, AnnotationAttributeType.ALL_FIELDS, Boolean.TRUE);
				
		PropertyUtility.buildProperties(elementUtils, currentEntity, new PropertyFactory<BindEntity, BindProperty>() {

			@Override
			public BindProperty createProperty(BindEntity entity, Element propertyElement) {
				return new BindProperty(currentEntity, propertyElement, AnnotationUtility.buildAnnotationList(propertyElement));
			}

		}, propertyAnnotationFilter, new PropertyCreatedListener<BindEntity, BindProperty>() {

			@Override
			public boolean onProperty(BindEntity entity, BindProperty property) {
				// if we are build Map, the model are not null
				boolean contextExternal = (model == null);

				// if @BindDisabled is present, exit immediately
				if (property.hasAnnotation(BindDisabled.class)) {
					if (bindAllFields) {
						return false;
					} else {											
						throw new InvalidDefinition(String.format("In class '%s', @%s can not be used with @%s(allField=false)", property.getParent().getElement().asType().toString(), BindDisabled.class.getSimpleName(), BindType.class.getSimpleName()));
					}
				}

				boolean enabled = bindAllFields;
				ModelAnnotation annotationBind = property.getAnnotation(Bind.class);
				enabled = enabled || (annotationBind != null && AnnotationUtility.extractAsBoolean(property, annotationBind, AnnotationAttributeType.ENABLED));

				// if we are not in external context and element is not enabled,
				// we have to analyze in every case.
				if (!enabled && !contextExternal) {
					return false;
				}

				ModelAnnotation annotationBindXml = property.getAnnotation(BindXml.class);

				property.order = 0;
				property.mapKeyName = Bind.MAP_KEY_DEFAULT;
				property.mapValueName = Bind.MAP_VALUE_DEFAULT;
				// label for item and collection elements are the same for
				// default
				property.label = typeNameConverter.convert(property.getName());
				property.xmlInfo.labelItem = property.label;
				property.xmlInfo.wrappedCollection = false;
				property.xmlInfo.xmlType = XmlType.valueOf(XmlType.TAG.toString());
				property.xmlInfo.mapEntryType = MapEntryType.valueOf(MapEntryType.TAG.toString());
												
				// check if there is an adapter
				if ((property.getAnnotation(BindAdapter.class)!= null)) {
					BindTransform transform = BindTransformer.lookup(TypeUtility.typeName(property.typeAdapter.dataType));

					if (!transform.isTypeAdapterSupported()) {
						String msg = String.format("In class '%s', property '%s' uses @BindAdapter with unsupported 'dataType' '%s'", beanElement.asType().toString(), property.getName(),
								property.typeAdapter.dataType);
						throw (new IncompatibleAnnotationException(msg));
					}

					if (property.getPropertyType().isPrimitive()) {
						String msg = String.format("In class '%s', property '%s' is primitive of type '%s' and it can not be annotated with @BindAdapter", beanElement.asType().toString(),
								property.getName(), property.getPropertyType().getTypeName());
						throw (new IncompatibleAnnotationException(msg));
					}
				}

				// @Bind management
				if (annotationBind != null) {
					int order = AnnotationUtility.extractAsInt(property.getElement(), Bind.class, AnnotationAttributeType.ORDER);
					property.order = order;

					String tempName = AnnotationUtility.extractAsString(property.getElement(), Bind.class, AnnotationAttributeType.VALUE);
					if (StringUtils.hasText(tempName)) {
						// for the moment are the same
						property.label = tempName;
						property.xmlInfo.labelItem = property.label;
					}

					// map info
					String mapKeyName = AnnotationUtility.extractAsString(property.getElement(), Bind.class, AnnotationAttributeType.MAP_KEY_NAME);
					if (StringUtils.hasText(mapKeyName))
						property.mapKeyName = mapKeyName;

					String mapValueName = AnnotationUtility.extractAsString(property.getElement(), Bind.class, AnnotationAttributeType.MAP_VALUE_NAME);
					if (StringUtils.hasText(mapValueName))
						property.mapValueName = mapValueName;
				}

				// @BindXml management
				if (annotationBindXml != null) {
					String mapEntryType = AnnotationUtility.extractAsEnumerationValue(property.getElement(), BindXml.class, AnnotationAttributeType.MAP_ENTRY_TYPE);
					if (StringUtils.hasText(mapEntryType))
						property.xmlInfo.mapEntryType = MapEntryType.valueOf(mapEntryType);

					// define element tag typeName
					String tempElementName = AnnotationUtility.extractAsString(property.getElement(), BindXml.class, AnnotationAttributeType.XML_ELEMENT_TAG);
					if (StringUtils.hasText(tempElementName)) {
						property.xmlInfo.labelItem = tempElementName;
						property.xmlInfo.wrappedCollection = true;
					}

					String xmlType = AnnotationUtility.extractAsEnumerationValue(property.getElement(), BindXml.class, AnnotationAttributeType.XML_TYPE);
					if (StringUtils.hasText(xmlType)) {
						property.xmlInfo.xmlType = XmlType.valueOf(xmlType);
					}
					
					// add namespace to name  
					String namespace= annotationBindXml.getAttribute(AnnotationAttributeType.NAMESPACE);					
					if (StringUtils.hasText(namespace)) {
						if (property.xmlInfo.xmlType == XmlType.VALUE || property.xmlInfo.xmlType == XmlType.VALUE_CDATA) {
							String msg = String.format("In class '%s', property '%s', defined as xml value, can not be used with a namespace", beanElement.asType().toString(), property.getName());
							throw (new IncompatibleAttributesInAnnotationException(msg));
						}
						property.xmlInfo.namespace=namespace;											
					}										
				}

				if (property.xmlInfo.xmlType == XmlType.ATTRIBUTE) {
					BindTransform transform = BindTransformer.lookup(property.getPropertyType().getTypeName());

					// check if property is a array
					if (property.isBindedArray() && !(transform instanceof ByteArrayBindTransform)) {
						String msg = String.format("In class '%s', property '%s' is an array and it can not be mapped in a xml attribute", beanElement.asType().toString(), property.getName());
						throw (new IncompatibleAttributesInAnnotationException(msg));
					}

					// check if property is a collection
					if (property.isBindedCollection()) {
						String msg = String.format("In class '%s', property '%s' is a collection and it can not be mapped in a xml attribute", beanElement.asType().toString(), property.getName());
						throw (new IncompatibleAttributesInAnnotationException(msg));
					}

					// check if property is a map
					if (property.isBindedMap()) {
						String msg = String.format("In class '%s', property '%s' is an map and it can not be mapped in a xml attribute", beanElement.asType().toString(), property.getName());
						throw (new IncompatibleAttributesInAnnotationException(msg));
					}

					if (transform != null && transform instanceof ObjectBindTransform) {
						String msg = String.format("In class '%s', property '%s' is an object and it can not be mapped in a xml attribute", beanElement.asType().toString(), property.getName());
						throw (new IncompatibleAttributesInAnnotationException(msg));
					}
				}

				if (property.xmlInfo.xmlType == XmlType.VALUE || property.xmlInfo.xmlType == XmlType.VALUE_CDATA) {
					counterPropertyInValue.inc();									

					BindTransform transform = BindTransformer.lookup(property.getPropertyType().getTypeName());

					// check if property is a array
					if (property.isBindedArray() && !(transform instanceof ByteArrayBindTransform)) {
						String msg = String.format("In class '%s', property '%s' is an array and it can not be mapped in a xml value", beanElement.asType().toString(), property.getName());
						throw (new IncompatibleAttributesInAnnotationException(msg));
					}

					// check if property is a collection
					if (property.isBindedCollection()) {
						String msg = String.format("In class '%s', property '%s' is a collection and it can not be mapped in a xml value", beanElement.asType().toString(), property.getName());
						throw (new IncompatibleAttributesInAnnotationException(msg));
					}

					// check if property is a map
					if (property.isBindedMap()) {
						String msg = String.format("In class '%s', property '%s' is a map and it can not be mapped in a xml value", beanElement.asType().toString(), property.getName());
						throw (new IncompatibleAttributesInAnnotationException(msg));
					}

					if (transform != null && transform instanceof ObjectBindTransform) {
						String msg = String.format("In class '%s', property '%s' is an object and it can not be mapped in a xml value", beanElement.asType().toString(), property.getName());
						throw (new IncompatibleAttributesInAnnotationException(msg));
					}
				}

				if (counterPropertyInValue.value() > 1) {
					String msg = String.format("In class '%s', property '%s' and other properties are mapped in a xml value, but only one property for class can be a xml value",
							beanElement.asType().toString(), property.getName());
					throw (new IncompatibleAttributesInAnnotationException(msg));
				}

				property.bindedObject = BindTransformer.isBindedObject(property);

				// if it's an object, we need to avoid to print field typeName
				// (like
				// object transform usually do).
				// set inCollection to true, permits this.
				if (property.bindedObject && contextExternal) {
					property.inCollection = true;
				}

				return true;

			}

		});
		
		ImmutableUtility.buildConstructors(elementUtils, currentEntity);

		// if we don't have model, we dont save bean definition
		if (model != null) {
			model.entityAdd(currentEntity);
		}
		return currentEntity;
	}
472012
public static String getAttribute( Element node, String key )
    {
        return getAttribute( node, key, null );
    }
81415
protected void parseChildElements(String elementName, BaseElement parentElement, BpmnModel model, XMLStreamReader xtr) throws Exception {
    parseChildElements(elementName, parentElement, null, model, xtr);
  }
1123002
private MembershipType readMembershipType(Node node) throws Exception
   {
      MembershipTypeImpl mt = new MembershipTypeImpl();
      mt.setName(node.getName().equals(JCROrganizationServiceImpl.JOS_MEMBERSHIP_TYPE_ANY) ? ANY_MEMBERSHIP_TYPE : node
         .getName());
      mt.setInternalId(node.getUUID());
      mt.setDescription(utils.readString(node, MembershipTypeProperties.JOS_DESCRIPTION));
      mt.setCreatedDate(utils.readDate(node, MembershipTypeProperties.EXO_DATE_CREATED));
      mt.setModifiedDate(utils.readDate(node, MembershipTypeProperties.EXO_DATE_MODIFIED));

      return mt;
   }
1059846
private Class<? extends Field> getClassObject(final Element element) {
		String className = element.getAttributeValue(XMLTags.CLASS);
		Class<? extends Field> classObject = null;
		try {
			className = className.indexOf('.') > 0 ? className : getClass().getPackage().getName() + '.' + className;
			classObject = Class.forName(className).asSubclass(Field.class);
		} catch (ClassNotFoundException e) {
			throw new IllegalStateException("could not get class " + className, e);
		}
		return classObject;
	}
1278915
private void parseEntSubAttributes(final Entity ent, final Node node) throws ResourceXMLParserException {
        final Element node1 = (Element) node;
        //load all sub elements called "attribute" as properties
        for (final Object attribute : node1.selectNodes(ATTRIBUTE_TAG)) {
            Element attr=(Element) attribute;
            if(null==attr.selectSingleNode("@" + ATTRIBUTE_NAME_ATTR)) {
                throw new ResourceXMLParserException(
                    ATTRIBUTE_TAG + " element has no '" + ATTRIBUTE_NAME_ATTR + "' attribute: "
                    + reportNodeErrorLocation(attr));
            }
            String attrname = attr.selectSingleNode("@" + ATTRIBUTE_NAME_ATTR).getStringValue();

            String attrvalue;
            //look for "value" attribute
            if(null!=attr.selectSingleNode("@"+ATTRIBUTE_VALUE_ATTR)) {
                attrvalue = attr.selectSingleNode("@" + ATTRIBUTE_VALUE_ATTR).getStringValue();
            }else if(null!= attr.getText()) {
                //look for text content
                attrvalue = attr.getText();
            }else {
                throw new ResourceXMLParserException(
                    ATTRIBUTE_TAG + " element has no '" + ATTRIBUTE_VALUE_ATTR + "' attribute or text content: "
                    + reportNodeErrorLocation(attr));
            }

            ent.properties.setProperty(attrname, attrvalue);
        }
    }
1120055
public void parse() throws ParserException {
        try {
            jsonParser.nextToken();
            contentHandler.startDocument();
            if (shouldAddArtificialRoot()) {
                startElement(artificialRootName);
                parseElement(artificialRootName, false);
                endElement(artificialRootName);
            } else if (START_OBJECT.equals(jsonParser.getCurrentToken())) {
                int elementsWritten = parseObject();
                if (elementsWritten>1) {
                    throw new ParserException("More than one root element. Can not generate legal XML. You can set artificialRootName to generate an artificial root.");
                }
            } else {
                throw new ParserException("Unsupported root element. Can not generate legal XML. You can set artificialRootName to generate an artificial root.");
            }
            contentHandler.endDocument();
        } catch (Exception e) {
            throw new ParserException("Parsing error: " + e.getMessage(), e);
        }
    }