parseFileWithSchemaFile :: String -> String -> <Proc> Document
//parseFileWithSchemaURL :: URL -> String -> <Proc> Document
+ addCDATA :: Element -> String -> <Proc> ()
+ getCDATAs :: Element -> <Proc> [String]
+
+
sortChildrenBy :: Ord a => (Element -> <e> a) -> Element -> <Proc,e> ()
sortChildrenBy f el = sortChildrenWith (\x y -> compare (f x) (f y)) el
\ No newline at end of file
import java.io.StringReader;
import java.io.StringWriter;
import java.net.URL;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.ArrayBlockingQueue;
+import org.jdom2.CDATA;
+import org.jdom2.Content;
+import org.jdom2.Content.CType;
import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.IllegalAddException;
}
});
}
+
+ public static void addCDATA(Element element, String cdata) {
+ element.addContent(new CDATA(cdata));
+ }
+
+ public static List<String> getCDATAs(Element element) {
+ ArrayList<String> result = new ArrayList<>();
+ for(Content c : element.getContent()) {
+ if(CType.CDATA.equals(c.getCType())) result.add(c.getValue());
+ }
+ return result;
+ }
+
}