private void writeDescription(Account account, XmlStreamWriter writer)
            throws Exception {
        writer.writeStartElement("RDF:Description");
        writer.writeAttribute("RDF:about", account.getId());
        writer.writeAttribute("NS1:name", account.getName());
        writer.writeAttribute("NS1:description", account.getDesc());

        if (!account.isFolder()) {
            writer.writeAttribute("NS1:whereLeetLB", account.getLeetType().toRdfString());
            writer.writeAttribute("NS1:leetLevelLB", Integer.toString(account.getLeetLevel().getLevel()));

            if (account.isHmac())
                writer.writeAttribute("NS1:hashAlgorithmLB", account.getAlgorithm().toHmacRdfString());
            else
                writer.writeAttribute("NS1:hashAlgorithmLB", account.getAlgorithm().toRdfString());

            writer.writeAttribute("NS1:passwordLength", Integer.toString(account.getLength()));
            writer.writeAttribute("NS1:usernameTB", account.getUsername());
            writer.writeAttribute("NS1:counter", account.getModifier());
            writer.writeAttribute("NS1:charset", account.getCharacterSet());
            writer.writeAttribute("NS1:prefix", account.getPrefix());
            writer.writeAttribute("NS1:suffix", account.getSuffix());
            writer.writeAttribute("NS1:autoPopulate", "false"); // TODO: make this a setting allowed in accounts

            // The default account contains specifiers for extracting pieces of an URL
            Set<Account.UrlComponents> urlComponents = account.getUrlComponents();
            // only write out any of them, if atleast one is set to true
            if ( ! urlComponents.isEmpty() ) {
                writer.writeAttribute("NS1:protocolCB", urlComponents.contains(Account.UrlComponents.Protocol) ? "true" : "false");
                writer.writeAttribute("NS1:subdomainCB", urlComponents.contains(Account.UrlComponents.Subdomain) ? "true" : "false");
                writer.writeAttribute("NS1:domainCB", urlComponents.contains(Account.UrlComponents.Domain) ? "true" : "false");
                writer.writeAttribute("NS1:pathCB", urlComponents.contains(Account.UrlComponents.PortPathAnchorQuery) ? "true" : "false");
            }
            // only write out urlToUse if its set, or if no url components are set.
            if ( urlComponents.isEmpty() || ! account.getUrl().isEmpty() )
                writer.writeAttribute("NS1:urlToUse", account.getUrl());

            int patternCount = 0;
            for (AccountPatternData data : account.getPatterns()) {
                writer.writeAttribute("NS1:pattern" + patternCount, data.getPattern());
                if (data.getType() == AccountPatternType.WILDCARD)
                    writer.writeAttribute("NS1:patterntype" + patternCount, "wildcard");
                else
                    writer.writeAttribute("NS1:patterntype" + patternCount, "regex");
                writer.writeAttribute("NS1:patternenabled" + patternCount, "true");  // TODO: make this a setting allowed in pattern data
                writer.writeAttribute("NS1:patterndesc" + patternCount, data.getDesc());
                patternCount++;
            }
        }

        writer.writeEndElement();
    }
private void writeDescription ( Account account , XmlStreamWriter writer ) throws Exception { writer . writeStartElement ( "RDF:Description" ) ; writer . writeAttribute ( "RDF:about" , account . getId ( ) ) ; writer . writeAttribute ( "NS1:name" , account . getName ( ) ) ; writer . writeAttribute ( "NS1:description" , account . getDesc ( ) ) ; if ( ! account . isFolder ( ) ) { writer . writeAttribute ( "NS1:whereLeetLB" , account . getLeetType ( ) . toRdfString ( ) ) ; writer . writeAttribute ( "NS1:leetLevelLB" , Integer . toString ( account . getLeetLevel ( ) . getLevel ( ) ) ) ; if ( account . isHmac ( ) ) writer . writeAttribute ( "NS1:hashAlgorithmLB" , account . getAlgorithm ( ) . toHmacRdfString ( ) ) ; else writer . writeAttribute ( "NS1:hashAlgorithmLB" , account . getAlgorithm ( ) . toRdfString ( ) ) ; writer . writeAttribute ( "NS1:passwordLength" , Integer . toString ( account . getLength ( ) ) ) ; writer . writeAttribute ( "NS1:usernameTB" , account . getUsername ( ) ) ; writer . writeAttribute ( "NS1:counter" , account . getModifier ( ) ) ; writer . writeAttribute ( "NS1:charset" , account . getCharacterSet ( ) ) ; writer . writeAttribute ( "NS1:prefix" , account . getPrefix ( ) ) ; writer . writeAttribute ( "NS1:suffix" , account . getSuffix ( ) ) ; writer . writeAttribute ( "NS1:autoPopulate" , "false" ) ; Set < Account . UrlComponents > urlComponents = account . getUrlComponents ( ) ; if ( ! urlComponents . isEmpty ( ) ) { writer . writeAttribute ( "NS1:protocolCB" , urlComponents . contains ( Account . UrlComponents . Protocol ) ? "true" : "false" ) ; writer . writeAttribute ( "NS1:subdomainCB" , urlComponents . contains ( Account . UrlComponents . Subdomain ) ? "true" : "false" ) ; writer . writeAttribute ( "NS1:domainCB" , urlComponents . contains ( Account . UrlComponents . Domain ) ? "true" : "false" ) ; writer . writeAttribute ( "NS1:pathCB" , urlComponents . contains ( Account . UrlComponents . PortPathAnchorQuery ) ? "true" : "false" ) ; } if ( urlComponents . isEmpty ( ) || ! account . getUrl ( ) . isEmpty ( ) ) writer . writeAttribute ( "NS1:urlToUse" , account . getUrl ( ) ) ; int patternCount = 0 ; for ( AccountPatternData data : account . getPatterns ( ) ) { writer . writeAttribute ( "NS1:pattern" + patternCount , data . getPattern ( ) ) ; if ( data . getType ( ) == AccountPatternType . WILDCARD ) writer . writeAttribute ( "NS1:patterntype" + patternCount , "wildcard" ) ; else writer . writeAttribute ( "NS1:patterntype" + patternCount , "regex" ) ; writer . writeAttribute ( "NS1:patternenabled" + patternCount , "true" ) ; writer . writeAttribute ( "NS1:patterndesc" + patternCount , data . getDesc ( ) ) ; patternCount ++ ; } } writer . writeEndElement ( ) ; }
Writes a single RDF:Description node to the XML stream.

@param account The account to write from.
@param writer  The XML stream to write into.
@throws Exception ...