Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mylyn-integrators] [WikiText] Is it possible to extract attributes using WikiText

Thank you David,
that is the functionality I need. I've tried also with
headings and images.
And it works too.

Best regards,
Luven

On 6/24/2009 6:47 PM, David Green wrote:
You want to do something like this:


public class ExtractHyperlinksBuilder extends NoOpDocumentBuilder {

private Set<String> hyperlinks = new HashSet<String>();

@Override

public void link(Attributes attributes, String hrefOrHashName, String text) {

hyperlinks.add(hrefOrHashName);

}

@Override

public void imageLink(Attributes linkAttributes, Attributes imageAttributes, String href, String imageUrl) {

hyperlinks.add(href);

}

public Set<String> getHyperlinks() {

return hyperlinks;

}

}




MarkupParser parser = new MarkupParser(ServiceLocator.getInstance().getMarkupLanguage("MediaWiki"));

ExtractHyperlinksBuilder builder = new ExtractHyperlinksBuilder();

parser.setBuilder(builder);

Reader markupContent = null;// open reader

try {

parser.parse(markupContent);

finally {

markupContent.close();

}

// do something with builder.getHyperlinks()


Regards,

David

On Wed, Jun 24, 2009 at 4:13 AM, siluven <siluven@xxxxxxxx> wrote:
Hello everyone,
I am a new Mylyn user. I'm planning to work with Wiki Articles with java and eclipse.

Is that possible to extract attributes like hyperlinks, headings, images, etc. directly from e. g. wikimedia markup-language using WikiText.
like:
- obj.getHyperlinks();

If it is possible or maybe there is solutions for this, how could it be done?

Thank you and best regards
Luven

_______________________________________________
mylyn-integrators mailing list
mylyn-integrators@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/mylyn-integrators



_______________________________________________ mylyn-integrators mailing list mylyn-integrators@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/mylyn-integrators

Back to the top