Package org.hl7.fhir.utilities.xml
Class XMLUtil
- java.lang.Object
-
- org.hl7.fhir.utilities.xml.XMLUtil
-
-
Field Summary
Fields Modifier and Type Field Description static StringSPACE_CHAR
-
Constructor Summary
Constructors Constructor Description XMLUtil()
-
Method Summary
-
-
-
Field Detail
-
SPACE_CHAR
public static final String SPACE_CHAR
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
XMLUtil
public XMLUtil()
-
-
Method Detail
-
isNMTokenChar
public static boolean isNMTokenChar(char c)
-
determineEncoding
public static String determineEncoding(InputStream stream) throws IOException
- Throws:
IOException
-
charSetImpliesAscii
public static boolean charSetImpliesAscii(String charset)
-
escapeXML
public static String escapeXML(String rawContent, String charset, boolean isNoLines)
Converts the raw characters to XML escape characters.- Parameters:
rawContent-charset- Null when charset is not known, so we assume it's unicodeisNoLines-- Returns:
- escape string
-
getFirstChild
public static Element getFirstChild(Element e)
-
getNamedChild
public static Element getNamedChild(Element e, String name)
-
getNamedChildByAttribute
public static Element getNamedChildByAttribute(Element e, String name, String nname, String nvalue)
-
getNextSibling
public static Element getNextSibling(Element e)
-
getNamedChildren
public static void getNamedChildren(Element e, String name, List<Element> set)
-
getNamedChildren
public static List<Element> getNamedChildren(Element e, String name)
-
htmlToXmlEscapedPlainText
public static String htmlToXmlEscapedPlainText(Element r)
-
htmlToXmlEscapedPlainText
public static String htmlToXmlEscapedPlainText(String definition) throws ParserConfigurationException, SAXException, IOException
-
elementToString
public static String elementToString(Element el)
-
getNamedChildValue
public static String getNamedChildValue(Element element, String name)
-
setNamedChildValue
public static void setNamedChildValue(Element element, String name, String value) throws FHIRException
- Throws:
FHIRException
-
getNamedChildrenWithWildcard
public static void getNamedChildrenWithWildcard(Element focus, String name, List<Element> children)
-
getNamedChildrenWithTails
public static void getNamedChildrenWithTails(Element focus, String name, List<Element> children, Set<String> typeTails)
-
hasNamedChild
public static boolean hasNamedChild(Element e, String name)
-
parseToDom
public static Document parseToDom(String content) throws ParserConfigurationException, SAXException, IOException
-
parseFileToDom
public static Document parseFileToDom(String filename) throws ParserConfigurationException, SAXException, IOException
-
getLastChild
public static Element getLastChild(Element e)
-
getPrevSibling
public static Element getPrevSibling(Element e)
-
getNamedChildAttribute
public static String getNamedChildAttribute(Element element, String name, String aname)
-
writeDomToFile
public static void writeDomToFile(Document doc, String filename) throws TransformerException
- Throws:
TransformerException
-
getXsiType
public static String getXsiType(Element element)
-
getDirectText
public static String getDirectText(Element node)
-
deleteByName
public static void deleteByName(Element e, String name)
-
deleteAttr
public static void deleteAttr(Element e, String namespaceURI, String localName)
-
insertChild
public static Element insertChild(Document doc, Element element, String name, String namespace, int indent)
-
insertChild
public static Element insertChild(Document doc, Element element, String name, String namespace, Node before, int indent)
-
addTextTag
public static void addTextTag(Document doc, Element element, String name, String namespace, String text, int indent)
-
saveToFile
public static void saveToFile(Element root, OutputStream stream) throws TransformerException
- Throws:
TransformerException
-
getNamedChildText
public static String getNamedChildText(Element element, String name)
-
-