Package org.jdom2

Examples of org.jdom2.Attribute


                                {
                                    skey.textToShow = trans.get(f);
                                    f = org.size();
                                }

                            Attribute a;
                            if ((a = keyEl.getAttribute(length)) != null)
                                skey.keyWidth = Integer.parseInt(a.getValue());

                            line.add(skey);
                        } else
                            line.add(SpecialKey.getKeyboardKey(fontName, special));
                    }
View Full Code Here


                            {
                                // _blank _self _parent _top
                                if( !token.equals(TARGET)
                                        || Arrays.binarySearch( PERMITTED_TARGET_VALUES, value ) >= 0 )
                                {
                                    Attribute a = new Attribute(token,value);
                                    link.addAttribute(a);
                                }
                                else
                                {
                                    throw new ParseException("unknown target attribute value='"
View Full Code Here

                sb.append( ' ' );
                sb.append( '|' );
                Iterator it = getAttributes();
                while ( it.hasNext() )
                {
                    Attribute a = (Attribute)it.next();
                    sb.append( ' ' );
                    sb.append( a.getName() );
                    sb.append( '=' );
                    sb.append( '\'' );
                    sb.append( a.getValue() );
                    sb.append( '\'' );
                }
            }
            sb.append( ']' );
            return sb.toString();
View Full Code Here

            Object childElement = itr.next();
            if( childElement instanceof Element )
            {
                Element element = (Element)childElement;
                String elementName = element.getName().toLowerCase();
                Attribute classAttr = element.getAttribute( CLASS_ATTRIBUTE );

                if( elementName.equals( A_ELEMENT ) )
                {
                    if( classAttr != null )
                    {
                        String classValue = classAttr.getValue();
                        Attribute hrefAttr = element.getAttribute( HREF_ATTRIBUTE );

                        XHtmlToWikiConfig wikiConfig = new XHtmlToWikiConfig( m_context );

                        // Get the url for wiki page link - it's typically "Wiki.jsp?page=MyPage"
                        // or when using the ShortURLConstructor option, it's "wiki/MyPage" .
                        String wikiPageLinkUrl = wikiConfig.getWikiJspPage();
                        String editPageLinkUrl = wikiConfig.getEditJspPage();

                        if( classValue.equals( WIKIPAGE )
                            || ( hrefAttr != null && hrefAttr.getValue().startsWith( wikiPageLinkUrl ) ) )
                        {
                            // Remove the leading url string so that users will only see the
                            // wikipage's name when editing an existing wiki link.
                            // For example, change "Wiki.jsp?page=MyPage" to just "MyPage".
                            String newHref = hrefAttr.getValue().substring( wikiPageLinkUrl.length() );

                            // Convert "This%20Pagename%20Has%20Spaces" to "This Pagename Has Spaces"
                            newHref = m_context.getEngine().decodeName( newHref );

                            // Handle links with section anchors.
                            // For example, we need to translate the html string "TargetPage#section-TargetPage-Heading2"
                            // to this wiki string: "TargetPage#Heading2".
                            hrefAttr.setValue( newHref.replaceFirst( LINKS_SOURCE, LINKS_TRANSLATION ) );
                        }
                        else if( hrefAttr != null && (classValue.equals( EDITPAGE ) ||
                                                      hrefAttr.getValue().startsWith( editPageLinkUrl ) ) )
                        {
                            Attribute titleAttr = element.getAttribute( TITLE_ATTRIBUTE );
                            if( titleAttr != null )
                            {
                                // remove the title since we don't want to eventually save the default undefined page title.
                                titleAttr.detach();
                            }

                            String newHref = hrefAttr.getValue().substring( editPageLinkUrl.length() );
                            newHref = m_context.getEngine().decodeName( newHref );
View Full Code Here

        if( el != null && attributes != null )
        {
            while( attributes.hasNext() )
            {
                Attribute attr = (Attribute)attributes.next();
                if( attr != null )
                {
                    el.setAttribute(attr);
                }
            }
View Full Code Here

                    if( base.indexOf( e ) != 1 )
                    {
                        m_out.print( ";" );
                    }

                    Attribute selected = e.getAttribute( "selected" );
                    if( selected !=  null )
                    {
                        m_out.print( "*" );
                    }

View Full Code Here

   
    @Test
    public void testOutputDocumentRootAttNS() {
      Document doc = new Document();
      Element e = new Element("root");
      e.setAttribute(new Attribute("att", "val", Namespace.getNamespace("ans", "mynamespace")));
      doc.addContent(e);
      roundTripDocument(doc);
    }
View Full Code Here

    public void testOutputDocumentNamespaces() {
    Element emt = new Element("root", Namespace.getNamespace("ns", "myns"));
    Namespace ans = Namespace.getNamespace("ans", "attributens");
    emt.addNamespaceDeclaration(ans);
    emt.addNamespaceDeclaration(Namespace.getNamespace("two", "two"));
    emt.setAttribute(new Attribute("att", "val", ans));
    emt.addContent(new Element("child", Namespace.getNamespace("", "childuri")));
    Document doc = new Document(emt);
    roundTripDocument(doc);
    }
View Full Code Here

    @Test
    public void testOutputElementAttributes() {
      Element emt = new Element("root");
      emt.setAttribute("att", "val");
      emt.setAttribute(new Attribute("attx", "valx", AttributeType.UNDECLARED));
    roundTripElement(emt);
    }
View Full Code Here

    public void testRTOutputElementNamespaces() {
    Element emt = new Element("root", Namespace.getNamespace("ns", "myns"));
    Namespace ans = Namespace.getNamespace("ans", "attributens");
    emt.addNamespaceDeclaration(ans);
    emt.addNamespaceDeclaration(Namespace.getNamespace("two", "two"));
    emt.setAttribute(new Attribute("att", "val", ans));
    emt.addContent(new Element("child", Namespace.getNamespace("", "childns")));
    roundTripElement(emt);
    }
View Full Code Here

TOP

Related Classes of org.jdom2.Attribute

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.