import "OSGi" importJava "org.jdom2.Document" where data Document @JavaName "" createDocument :: Element -> Document @JavaName getRootElement rootElementOf :: Document -> Element @JavaName setRootElement setRootElement :: Document -> Element -> () importJava "org.jdom2.Element" where data Element @JavaName "" createElement :: String -> Element @JavaName getName nameOf :: Element -> String @JavaName getText textOf :: Element -> String @JavaName getParentElement parentOf :: Element -> Maybe Element @JavaName getChildren childrenWithNameOf :: Element -> String -> [Element] @JavaName getChildren childrenOf :: Element -> [Element] @JavaName getChild childWithNameOf :: Element -> String -> Maybe Element @JavaName getAttributeValue attributeOf :: Element -> String -> Maybe String @JavaName getAttributes attributesOf :: Element -> [Attribute] @JavaName addContent addChild :: Element -> Element -> () setName :: Element -> String -> () setText :: Element -> String -> () setAttribute :: Element -> String -> String -> () importJava "org.jdom2.Attribute" where data Attribute @JavaName getValue valueOfAttribute :: Attribute -> String @JavaName getName nameOfAttribute :: Attribute -> String Element ?parentElement ?childName ?childElement :- @ffb 1.0 ?childName = nameOf ?childElement Optional ?parentElement (parentOf ?childElement) @bbf 10.0 ?childElement <- childrenWithNameOf ?parentElement ?childName @bff 10.0 ?childElement <- childrenOf ?parentElement ?childName = nameOf ?childElement @enforce Execute (addNamedChild ?parentElement ?childName ?childElement) Attribute ?element ?attributeName ?attributeValue :- @bbf 0.95 Optional ?attributeValue (attributeOf ?element ?attributeName) @bff 4.0 ?attribute <- attributesOf ?element ?attributeName = nameOfAttribute ?attribute ?attributeValue = valueOfAttribute ?attribute @enforce Execute do setAttribute ?element ?attributeName ?attributeValue TextContent ?element ?textContent :- @bf 1 ?textContent = textOf ?element @enforce Execute do setText ?element ?textContent XPathElement ?parentElement ?xpathExpression ?childElement :- @bbf 10 ?childElement <- elementsByXPath ?parentElement ?xpathExpression importJava "org.simantics.scl.data.xml.JDomHelper" where parseString :: String -> Document parseFile :: String -> Document outputString :: Document -> String elementsByXPath :: Element -> String -> [Element] addNamedChild :: Element -> String -> Element -> () setNamespace :: Document -> String -> () setElementNamespace :: Element -> String -> () clearNamespace :: Document -> () clearElementNamespace :: Element -> () sortChildrenWith :: (Element -> Element -> Integer) -> Element -> () parseStringWithSchemaFile :: String -> String -> Document //parseStringWithSchemaURL :: URL -> String -> Document parseFileWithSchemaFile :: String -> String -> Document //parseFileWithSchemaURL :: URL -> String -> Document sortChildrenBy :: Ord a => (Element -> a) -> Element -> () sortChildrenBy f el = sortChildrenWith (\x y -> compare (f x) (f y)) el