Skip to content

Instantly share code, notes, and snippets.

@aknishiumi
aknishiumi / html2dom.java
Created February 1, 2012 03:11
cybernekoを使ってなるべく原型を留めてHTMLをDOMにパースするときのメモ ref: http://qiita.com/items/1962
// DOMパーサーはxercesを使う
DOMParser parser = new DOMParser(new HTMLConfiguration());
parser.setFeature("http://cyberneko.org/html/features/balance-tags", false);
parser.setFeature("http://cyberneko.org/html/features/balance-tags/document-fragment", true); parser.setFeature("http://cyberneko.org/html/features/balance-tags/ignore-outside-content", true);parser.setFeature("http://cyberneko.org/html/features/scanner/notify-builtin-refs", true);
parser.setProperty("http://cyberneko.org/html/properties/names/elems", "match");
parser.setProperty("http://cyberneko.org/html/properties/names/attrs", "no-change");
parser.setProperty("http://cyberneko.org/html/properties/default-encoding", "UTF-8");
parser.parse(new InputSource(new StringReader(layout)));
Document doc = parser.getDocument();
@aknishiumi
aknishiumi / oauth2_sample.xml
Created January 27, 2012 02:16
OpenSocial: OAuth2 Gadget sample
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="OpenSocialGadget OAuth2 sample">
<OAuth2>
<Service name="[service_name]">
<Authorization url="https://.../authorize"/>
<Token url="https://.../oauth2/token"/>
</Service>
</OAuth2>
<Require feature="oauthpopup" />