use of org.cybergarage.xml.Parser in project i2p.i2p by i2p.
the class Device method loadDescription.
public boolean loadDescription(String descString) throws InvalidDescriptionException {
try {
Parser parser = UPnP.getXMLParser();
rootNode = parser.parse(descString);
if (rootNode == null)
throw new InvalidDescriptionException(Description.NOROOT_EXCEPTION);
deviceNode = rootNode.getNode(Device.ELEM_NAME);
if (deviceNode == null)
throw new InvalidDescriptionException(Description.NOROOTDEVICE_EXCEPTION);
} catch (ParserException e) {
throw new InvalidDescriptionException(e);
}
if (initializeLoadedDescription() == false)
return false;
setDescriptionFile(null);
return true;
}
use of org.cybergarage.xml.Parser in project i2p.i2p by i2p.
the class Service method loadSCPD.
public boolean loadSCPD(File file) throws ParserException {
Parser parser = UPnP.getXMLParser();
Node scpdNode = parser.parse(file);
if (scpdNode == null)
return false;
ServiceData data = getServiceData();
data.setSCPDNode(scpdNode);
return true;
}
use of org.cybergarage.xml.Parser in project i2p.i2p by i2p.
the class Service method loadSCPD.
// //////////////////////////////////////////////
// SCPD node
// //////////////////////////////////////////////
public boolean loadSCPD(String scpdStr) throws InvalidDescriptionException {
try {
Parser parser = UPnP.getXMLParser();
Node scpdNode = parser.parse(scpdStr);
if (scpdNode == null)
return false;
ServiceData data = getServiceData();
data.setSCPDNode(scpdNode);
} catch (ParserException e) {
throw new InvalidDescriptionException(e);
}
return true;
}
use of org.cybergarage.xml.Parser in project i2p.i2p by i2p.
the class UPnP method loadDefaultXMLParser.
/**
* This method loads the default XML Parser using the following behavior:
* - First if present loads the parsers specified by the system property {@link UPnP#XML_CLASS_PROPERTTY}<br>
* - Second by a fall-back technique, it tries to load the XMLParser from one<br>
* of the following classes: {@link JaxpParser}, {@link kXML2Parser}, {@link XercesParser}
*
* @return {@link Parser} which has been loaded successuflly or null otherwise
*
* @since 1.8.0
*/
private static Parser loadDefaultXMLParser() {
Parser parser = null;
String[] parserClass = new String[] { System.getProperty(XML_CLASS_PROPERTTY), // "org.cybergarage.xml.parser.XmlPullParser",
"org.cybergarage.xml.parser.JaxpParser" // "org.cybergarage.xml.parser.kXML2Parser",
// "org.cybergarage.xml.parser.XercesParser"
};
for (int i = 0; i < parserClass.length; i++) {
if (parserClass[i] == null)
continue;
try {
parser = (Parser) Class.forName(parserClass[i]).getDeclaredConstructor().newInstance();
return parser;
} catch (Throwable e) {
Debug.warning("Unable to load " + parserClass[i] + " as XMLParser due to " + e);
}
}
return null;
}
use of org.cybergarage.xml.Parser in project i2p.i2p by i2p.
the class SOAPRequest method getRootNode.
private synchronized Node getRootNode() {
if (rootNode != null)
return rootNode;
try {
byte[] content = getContent();
ByteArrayInputStream contentIn = new ByteArrayInputStream(content);
Parser parser = SOAP.getXMLParser();
rootNode = parser.parse(contentIn);
} catch (ParserException e) {
Debug.warning(e);
}
return rootNode;
}
Aggregations