Class XmlFile
java.lang.Object
org.sonarsource.analyzer.commons.xml.XmlFile
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionTransform a NodeList (from DOM interface) into a java Liststatic XmlTextRangeattributeNameLocation(Attr node) static XmlTextRangeattributeValueLocation(Attr node) Get all the children of a node, as a proper java list.static XmlFilestatic XmlFilecreate(org.sonar.api.batch.fs.InputFile inputFile) static XmlTextRangeendLocation(CDATASection node) static XmlTextRangeendLocation(Element node) org.sonar.api.batch.fs.InputFilestatic Optional<XmlTextRange>getRange(Node node, XmlFile.Location location) static XmlTextRangenameLocation(Element node) static NodenodeAttribute(Node node, String attribute) Try to retrieve the attribute node corresponding to an attribute name in a given node.static XmlTextRangenodeLocation(Node node) static XmlTextRangestartLocation(CDATASection node) static XmlTextRangestartLocation(Element node)
-
Method Details
-
create
- Throws:
IOException
-
create
-
getInputFile
@Nullable public org.sonar.api.batch.fs.InputFile getInputFile()- Returns:
- null when created based on string
-
getContents
-
getCharset
-
getDocument
- Returns:
- document with namespace information
-
getNamespaceAwareDocument
-
getNamespaceUnawareDocument
-
getPrologElement
-
startLocation
-
endLocation
-
startLocation
-
endLocation
-
nameLocation
-
attributeNameLocation
-
attributeValueLocation
-
nodeLocation
-
getRange
-
children
Get all the children of a node, as a proper java list.- Parameters:
node- the node to get children from- Returns:
- a list of nodes, possibly empty.
-
asList
Transform a NodeList (from DOM interface) into a java List- Parameters:
nodeList- the nodeList to be transformed into a List, possibly null- Returns:
- The equivalent java list. Note that a null NodeList will produce an empty list.
-
nodeAttribute
Try to retrieve the attribute node corresponding to an attribute name in a given node.- Parameters:
node- The node to query for an attributeattribute- The name of the attribute to search for- Returns:
- The corresponding attribute node, if the attribute can be found, or null if not found.
-