3 importJava "org.jdom2.Document" where
7 createDocument :: Element -> <Proc> Document
9 @JavaName getRootElement
10 rootElementOf :: Document -> <Proc> Element
12 @JavaName setRootElement
13 setRootElement :: Document -> Element -> <Proc> ()
15 importJava "org.jdom2.Element" where
19 createElement :: String -> <Proc> Element
22 nameOf :: Element -> <Proc> String
25 textOf :: Element -> <Proc> String
27 @JavaName getParentElement
28 parentOf :: Element -> <Proc> Maybe Element
31 childrenWithNameOf :: Element -> String -> <Proc> [Element]
34 childrenOf :: Element -> <Proc> [Element]
37 childWithNameOf :: Element -> String -> <Proc> Maybe Element
39 @JavaName getAttributeValue
40 attributeOf :: Element -> String -> <Proc> Maybe String
42 @JavaName getAttributes
43 attributesOf :: Element -> <Proc> [Attribute]
46 addChild :: Element -> Element -> <Proc> ()
48 setName :: Element -> String -> <Proc> ()
50 setText :: Element -> String -> <Proc> ()
52 setAttribute :: Element -> String -> String -> <Proc> ()
54 importJava "org.jdom2.Attribute" where
58 valueOfAttribute :: Attribute -> <Proc> String
61 nameOfAttribute :: Attribute -> <Proc> String
63 Element ?parentElement ?childName ?childElement :-
65 ?childName = nameOf ?childElement
66 Optional ?parentElement (parentOf ?childElement)
69 ?childElement <- childrenWithNameOf ?parentElement ?childName
72 ?childElement <- childrenOf ?parentElement
73 ?childName = nameOf ?childElement
76 Execute (addNamedChild ?parentElement ?childName ?childElement)
78 Attribute ?element ?attributeName ?attributeValue :-
80 Optional ?attributeValue (attributeOf ?element ?attributeName)
83 ?attribute <- attributesOf ?element
84 ?attributeName = nameOfAttribute ?attribute
85 ?attributeValue = valueOfAttribute ?attribute
89 setAttribute ?element ?attributeName ?attributeValue
91 TextContent ?element ?textContent :-
93 ?textContent = textOf ?element
97 setText ?element ?textContent
99 XPathElement ?parentElement ?xpathExpression ?childElement :-
101 ?childElement <- elementsByXPath ?parentElement ?xpathExpression
103 importJava "org.simantics.scl.data.xml.JDomHelper" where
104 parseString :: String -> <Proc> Document
105 parseFile :: String -> <Proc> Document
106 outputString :: Document -> <Proc> String
108 elementsByXPath :: Element -> String -> <Proc> [Element]
109 addNamedChild :: Element -> String -> Element -> <Proc> ()
110 setNamespace :: Document -> String -> <Proc> ()
111 setElementNamespace :: Element -> String -> <Proc> ()
112 clearNamespace :: Document -> <Proc> ()
113 clearElementNamespace :: Element -> <Proc> ()
114 sortChildrenWith :: (Element -> Element -> <e> Integer) -> Element -> <Proc,e> ()
116 parseStringWithSchemaFile :: String -> String -> <Proc> Document
117 //parseStringWithSchemaURL :: URL -> String -> <Proc> Document
118 parseFileWithSchemaFile :: String -> String -> <Proc> Document
119 //parseFileWithSchemaURL :: URL -> String -> <Proc> Document
121 addCDATA :: Element -> String -> <Proc> ()
122 getCDATAs :: Element -> <Proc> [String]
125 sortChildrenBy :: Ord a => (Element -> <e> a) -> Element -> <Proc,e> ()
126 sortChildrenBy f el = sortChildrenWith (\x y -> compare (f x) (f y)) el