当前位置: 首页>>代码示例>>Java>>正文


Java ParserException类代码示例

本文整理汇总了Java中org.cybergarage.xml.ParserException的典型用法代码示例。如果您正苦于以下问题:Java ParserException类的具体用法?Java ParserException怎么用?Java ParserException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ParserException类属于org.cybergarage.xml包,在下文中一共展示了ParserException类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addDevice

import org.cybergarage.xml.ParserException; //导入依赖的package包/类
private synchronized void addDevice(SSDPPacket ssdpPacket) {
    if (ssdpPacket.isRootDevice()) {
        Device dev = getDevice(USN.getUDN(ssdpPacket.getUSN()));
        if (dev != null) {
            dev.setSSDPPacket(ssdpPacket);
        } else {
            try {
                Node rootNode = UPnP.getXMLParser().parse(new URL(ssdpPacket.getLocation()));
                Device rootDev = getDevice(rootNode);
                if (rootDev != null) {
                    rootDev.setSSDPPacket(ssdpPacket);
                    addDevice(rootNode);
                    performAddDeviceListener(rootDev);
                }
            } catch (MalformedURLException me) {
                Debug.warning(ssdpPacket.toString());
                Debug.warning(me);
            } catch (ParserException pe) {
                Debug.warning(ssdpPacket.toString());
                Debug.warning(pe);
            }
        }
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:25,代码来源:ControlPoint.java

示例2: loadDescription

import org.cybergarage.xml.ParserException; //导入依赖的package包/类
/**
 * @since 1.8.0
 */
public boolean loadDescription(InputStream input) throws InvalidDescriptionException
{
	try {
		Parser parser = UPnP.getXMLParser();
		rootNode = parser.parse(input);
		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;
}
 
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:26,代码来源:Device.java

示例3: getRootNode

import org.cybergarage.xml.ParserException; //导入依赖的package包/类
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;
}
 
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:18,代码来源:SOAPRequest.java

示例4: loadDescription

import org.cybergarage.xml.ParserException; //导入依赖的package包/类
/**
 * @since 1.8.0
 */
public boolean loadDescription(InputStream input)
		throws InvalidDescriptionException {
	try {
		Parser parser = UPnP.getXMLParser();
		rootNode = parser.parse(input);
		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;
}
 
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:27,代码来源:Device.java

示例5: loadSCPD

import org.cybergarage.xml.ParserException; //导入依赖的package包/类
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;
}
 
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:17,代码来源:Service.java

示例6: loadSCPD

import org.cybergarage.xml.ParserException; //导入依赖的package包/类
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;
}
 
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:16,代码来源:Service.java

示例7: parse

import org.cybergarage.xml.ParserException; //导入依赖的package包/类
public Node parse(InputStream inStream) throws ParserException
	{
		org.cybergarage.xml.Node root = null;
		
		try {
			DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
			DocumentBuilder builder = factory.newDocumentBuilder();
			InputSource inSrc = new InputSource(new NullFilterInputStream(inStream));
			Document doc = builder.parse(inSrc);

			org.w3c.dom.Element docElem = doc.getDocumentElement();

			if (docElem != null)
				root = parse(root, docElem);
/*
			NodeList rootList = doc.getElementsByTagName("root");
			Debug.message("rootList = " + rootList.getLength());
			
			if (0 < rootList.getLength())
				root = parse(root, rootList.item(0));
*/
		}
		catch (Exception e) {
			throw new ParserException(e);
		}
		
		return root;
	}
 
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:29,代码来源:JaxpParser.java

示例8: parse

import org.cybergarage.xml.ParserException; //导入依赖的package包/类
/**
 *  Process the XML input stream.
 *
 *  @param in XML content only. Any su3 or gunzip handling must have
 *            already happened.
 *  @throws IOException on any parse error
 */
public void parse(InputStream in) throws IOException {
    _entries = null;
    _metadata = null;
    XMLParser parser = new XMLParser(_context);
    try {
        Node root = parser.parse(in);
        extract(root);
    } catch (ParserException pe) {
        throw new I2PParserException(pe);
    }
}
 
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:19,代码来源:NewsXMLParser.java

示例9: addDevice

import org.cybergarage.xml.ParserException; //导入依赖的package包/类
private synchronized void addDevice(SSDPPacket ssdpPacket)
{
	if (ssdpPacket.isRootDevice() == false)
		return;
		
	String usn = ssdpPacket.getUSN();
	String udn = USN.getUDN(usn);
	Device dev = getDevice(udn);
	if (dev != null) {
		dev.setSSDPPacket(ssdpPacket);
		return;
	}
	
	String location = ssdpPacket.getLocation();
	try {	
		URL locationUrl = new URL(location);
		Parser parser = UPnP.getXMLParser();
		Node rootNode = parser.parse(locationUrl);
		Device rootDev = getDevice(rootNode);
		if (rootDev == null)
			return;
		rootDev.setSSDPPacket(ssdpPacket);
		addDevice(rootNode);

		// Thanks for Oliver Newell (2004/10/16)
		// After node is added, invoke the AddDeviceListener to notify high-level 
		// control point application that a new device has been added. (The 
		// control point application must implement the DeviceChangeListener interface
		// to receive the notifications)
		performAddDeviceListener( rootDev );
	}
	catch (MalformedURLException me) {
		Debug.warning(ssdpPacket.toString());
		Debug.warning(me);
	}
	catch (ParserException pe) {
		Debug.warning(ssdpPacket.toString());
		Debug.warning(pe);
	}
}
 
开发者ID:jimdowling,项目名称:nat-traverser,代码行数:41,代码来源:ControlPoint.java

示例10: parse

import org.cybergarage.xml.ParserException; //导入依赖的package包/类
public Node parse(InputStream inStream) throws ParserException
	{
		org.cybergarage.xml.Node root = null;
		
		try {
			DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
			DocumentBuilder builder = factory.newDocumentBuilder();
			InputSource inSrc = new InputSource(inStream);
			Document doc = builder.parse(inSrc);

			org.w3c.dom.Element docElem = doc.getDocumentElement();

			if (docElem != null)
				root = parse(root, docElem);
/*
			NodeList rootList = doc.getElementsByTagName("root");
			Debug.message("rootList = " + rootList.getLength());
			
			if (0 < rootList.getLength())
				root = parse(root, rootList.item(0));
*/
		}
		catch (Exception e) {
			throw new ParserException(e);
		}
		
		return root;
	}
 
开发者ID:jimdowling,项目名称:nat-traverser,代码行数:29,代码来源:JaxpParser.java

示例11: browse

import org.cybergarage.xml.ParserException; //导入依赖的package包/类
public Node browse(Device dev, String objectID, String browseFlag, String filter, int startIndex, int requestedCount, String sortCaiteria) {
    System.out.println("browse " + objectID + ", " + browseFlag + ", " + startIndex + ", " + requestedCount);
    if (dev == null) {
        return null;
    }
    Service conDir = dev.getService(ContentDirectory.SERVICE_TYPE);
    if (conDir == null) {
        return null;
    }
    Action action = conDir.getAction(ContentDirectory.BROWSE);
    if (action == null) {
        return null;
    }
    BrowseAction browseAction = new BrowseAction(action);
    browseAction.setObjectID(objectID);
    browseAction.setBrowseFlag(browseFlag);
    browseAction.setStartingIndex(startIndex);
    browseAction.setRequestedCount(requestedCount);
    browseAction.setFilter(filter);
    browseAction.setSortCriteria(sortCaiteria);
    if (!browseAction.postControlAction()) {
        return null;
    }
    if (requestedCount == 0) {
        int numberReturned = browseAction.getNumberReturned();
        int totalMatches = browseAction.getTotalMatches();
        if (numberReturned == 0) {
            if (totalMatches > 0) {
                browseAction.setRequestedCount(totalMatches);
                if (!browseAction.postControlAction()) {
                    return null;
                }
            }
            browseAction.setRequestedCount(9999);
            if (!browseAction.postControlAction()) {
                return null;
            }
        }
    }
    Argument resultArg = browseAction.getArgument("Result");
    if (resultArg == null) {
        return null;
    }
    String resultStr = resultArg.getValue();
    if (resultStr == null) {
        return null;
    }
    try {
        return UPnP.getXMLParser().parse(resultStr);
    } catch (ParserException pe) {
        Debug.warning(pe);
        return null;
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:55,代码来源:MediaController.java

示例12: getSCPDNode

import org.cybergarage.xml.ParserException; //导入依赖的package包/类
private Node getSCPDNode(URL scpdUrl) throws ParserException
{
	Parser parser = UPnP.getXMLParser();
	return parser.parse(scpdUrl);
}
 
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:6,代码来源:Service.java

示例13: addDevice

import org.cybergarage.xml.ParserException; //导入依赖的package包/类
private synchronized void addDevice(SSDPPacket ssdpPacket)
{
	if (ssdpPacket.isRootDevice() == false)
		return;
		
	String usn = ssdpPacket.getUSN();
	String udn = USN.getUDN(usn);
	Device dev = getDevice(udn);
	if (dev != null) {
		dev.setSSDPPacket(ssdpPacket);
		return;
	}
	
	String location = ssdpPacket.getLocation();
	try {	
		URL locationUrl = new URL(location);
		Parser parser = UPnP.getXMLParser();
		Node rootNode = parser.parse(locationUrl);
		Device rootDev = getDevice(rootNode);
		if (rootDev == null)
			return;
		rootDev.setSSDPPacket(ssdpPacket);
		Debug.warning("Add root device", new Exception("received on " + ssdpPacket.getLocalAddress()));
		addDevice(rootNode);

		// Thanks for Oliver Newell (2004/10/16)
		// After node is added, invoke the AddDeviceListener to notify high-level 
		// control point application that a new device has been added. (The 
		// control point application must implement the DeviceChangeListener interface
		// to receive the notifications)
		performAddDeviceListener( rootDev );
	}
	catch (MalformedURLException me) {
		Debug.warning(ssdpPacket.toString());
		Debug.warning(me);
	}
	catch (ParserException pe) {
		Debug.warning(ssdpPacket.toString());
		Debug.warning(pe);
	}
}
 
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:42,代码来源:ControlPoint.java


注:本文中的org.cybergarage.xml.ParserException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。