Package com.identity4j.util.xml
Class XMLDataExtractor
- java.lang.Object
-
- com.identity4j.util.xml.XMLDataExtractor
-
public class XMLDataExtractor extends Object
This is a simple utility class which tries to extract node values and attributes from an XML.
This will extract nodes with character value only, a node with children node will result in null.
A node with children or character with attributes will always shows attributes in node instance.
e.g.<item date="February 2014"> <mode>2</mode> <unit>400</unit> <current>2</current> <interactive>5</interactive> </item>When we extract nodes.
- For unit it would extract node value as 400.
- For item it would extract node value as null, as no character data is present, but it will show attributes
- Author:
- gaurav
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classXMLDataExtractor.NodeNode entity representing an XML node.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,XMLDataExtractor.Node>extract(String xml, Set<String> nodes)static XMLDataExtractorgetInstance()
-
-
-
Method Detail
-
getInstance
public static XMLDataExtractor getInstance()
-
extract
public Map<String,XMLDataExtractor.Node> extract(String xml, Set<String> nodes) throws XMLStreamException
- Parameters:
xml-nodes-- Returns:
- Throws:
XMLStreamException
-
-