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


Java Node.ELEMENT_NODE属性代码示例

本文整理汇总了Java中javax.xml.soap.Node.ELEMENT_NODE属性的典型用法代码示例。如果您正苦于以下问题:Java Node.ELEMENT_NODE属性的具体用法?Java Node.ELEMENT_NODE怎么用?Java Node.ELEMENT_NODE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javax.xml.soap.Node的用法示例。


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

示例1: load

public ArrayList<T> load() throws Exception {
	ArrayList<T> entities = new ArrayList<T>();

	File fXmlFile = new File(this.xmlFilename);
	DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
	DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
	Document doc = dBuilder.parse(fXmlFile);
	doc.getDocumentElement().normalize();

	NodeList nodeList = doc.getElementsByTagName(this.entityTag);

	for (int i = 0; i < nodeList.getLength(); i++) {
		org.w3c.dom.Node node = nodeList.item(i);
		if (node.getNodeType() == Node.ELEMENT_NODE) {
			Element element = (Element) node;
			entities.add(getEntityFromXmlElement(element));
		}
	}
	return entities;
}
 
开发者ID:JavaSummer,项目名称:JavaMainRepo,代码行数:20,代码来源:EntityRepository.java

示例2: GuiData

protected GuiData() {
    try {
        DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
        DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();

        Document doc = dBuilder.parse(FEFEditor.class.getResourceAsStream("data/xml/FileTypes.xml"));
        doc.getDocumentElement().normalize();
        NodeList nList = doc.getDocumentElement().getElementsByTagName("FatesTypes").item(0).getChildNodes();
        for (int x = 0; x < nList.getLength(); x++) {
            if (nList.item(x).getNodeType() == Node.ELEMENT_NODE)
                baseTypes.add(nList.item(x).getAttributes().getNamedItem("name").getNodeValue());
        }
        nList = doc.getDocumentElement().getElementsByTagName("DLC").item(0).getChildNodes();
        for (int x = 0; x < nList.getLength(); x++) {
            if (nList.item(x).getNodeType() == Node.ELEMENT_NODE)
                dlcTypes.add(nList.item(x).getAttributes().getNamedItem("name").getNodeValue());
        }
        nList = doc.getDocumentElement().getElementsByTagName("Awakening").item(0).getChildNodes();
        for (int x = 0; x < nList.getLength(); x++) {
            if (nList.item(x).getNodeType() == Node.ELEMENT_NODE)
                awakeningTypes.add(nList.item(x).getAttributes().getNamedItem("name").getNodeValue());
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
 
开发者ID:thane98,项目名称:FEFEditor,代码行数:26,代码来源:GuiData.java

示例3: deserializeRequest

/**
 * Deserializes the "request" element.
 *
 * @param requestNode request element
 * @return content of the request element
 */
@Override
protected String deserializeRequest(Node requestNode, SOAPMessage message) throws SOAPException {
    if (requestNode == null) {
        logger.warn("\"requestNode\" is null. Null is returned.");
        return null;
    }
    for (int i = 0; i < requestNode.getChildNodes().getLength(); i++) {
        // Request data is inside of "name" element
        if (requestNode.getChildNodes().item(i).getNodeType() == Node.ELEMENT_NODE
                && "name".equals(requestNode.getChildNodes().item(i).getLocalName())) {
            logger.debug("Found \"name\" element.");
            // "name" element was found - return the text content
            return requestNode.getChildNodes().item(i).getTextContent();
        }
    }
    logger.warn("No \"name\" element found. Null is returned.");
    return null;
}
 
开发者ID:vrk-kpa,项目名称:xrd4j,代码行数:24,代码来源:ExampleAdapter.java

示例4: copyRequestNode

private boolean copyRequestNode(final Node node, final SOAPBodyElement body, final ServiceResponse response) {
    for (int i = 0; i < node.getChildNodes().getLength(); i++) {
        if (node.getChildNodes().item(i).getNodeType() == Node.ELEMENT_NODE
                && "request".equals(node.getChildNodes().item(i).getLocalName())) {
            Node requestNode = (Node) node.getChildNodes().item(i).cloneNode(true);
            Node importNode = (Node) body.getOwnerDocument().importNode(requestNode, true);
            body.appendChild(importNode);
            if (response.isAddNamespaceToRequest()) {
                LOGGER.debug("Add provider namespace to request element.");
                SOAPHelper.addNamespace(importNode, response);
            }
            return true;
        }
    }
    return false;
}
 
开发者ID:vrk-kpa,项目名称:xrd4j,代码行数:16,代码来源:AbstractServiceResponseSerializer.java

示例5: load

public ArrayList<T> load() throws ParserConfigurationException, SAXException, IOException {

		ArrayList<T> entities = new ArrayList<T>();

		File fXmlFile = new File(this.xmlFilename);
		DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
		DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
		Document doc = dBuilder.parse(fXmlFile);
		doc.getDocumentElement().normalize();

		NodeList nodeList = doc.getElementsByTagName(this.entityTag);

		for (int i = 0; i < nodeList.getLength(); i++) {
			org.w3c.dom.Node node = nodeList.item(i);
			if (node.getNodeType() == Node.ELEMENT_NODE) {
				Element element = (Element) node;
				entities.add(getEntityFromXmlElement(element));
			}
		}
		return entities;
	}
 
开发者ID:JavaSummer,项目名称:JavaMainRepo,代码行数:21,代码来源:EntityRepository.java

示例6: load

public ArrayList<T> load() throws ParserConfigurationException, SAXException, IOException {
ArrayList<T> entities = new ArrayList<T>();
File fXmlFile = new File(this.xmlFilename);
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = (Document) dBuilder.parse(fXmlFile);
doc.getDocumentElement().normalize();
NodeList nodeList = doc.getElementsByTagName(Constants.XML_TAGS.ANIMAL);	
for (int i = 0; i < nodeList.getLength(); i++) {
	Node node = (Node) nodeList.item(i);
	if (node.getNodeType() == Node.ELEMENT_NODE) { 
		Element element = (Element) node;
		entities.add(getEntityFromXmlElement(element));
	}
}
return entities;
}
 
开发者ID:JavaSummer,项目名称:JavaMainRepo,代码行数:17,代码来源:EntityRepository.java

示例7: deserializeResponseError

/**
 * Tries to deserialize a non-technical SOAP error message that's inside the
 * response element. Returns true if "faultCode" or "faultString" is found.
 * Otherwise returns false.
 *
 * @param response ServiceResponse that holds the SOAPMessage
 * @param responseNode Node that holds the response element
 * @return true if and only if "faultCode" or "faultString" is found.
 * Otherwise returns false.
 * @throws SOAPException if there's a SOAP error
 */
private boolean deserializeResponseError(final ServiceResponse response, final Node responseNode) throws SOAPException {
    LOGGER.debug("Deserialize a non-technical SOAP error message.");
    if (this.isMetaServiceResponse) {
        LOGGER.debug("Response being processed is from X-Road meta service. Skip.");
        return false;
    }
    String faultCode = null;
    String faultString = null;
    for (int i = 0; i < responseNode.getChildNodes().getLength(); i++) {
        // Make sure that it's an element node
        if (responseNode.getChildNodes().item(i).getNodeType() == Node.ELEMENT_NODE) {
            // Hanle faultcode and faultstring
            if ("faultcode".equalsIgnoreCase(responseNode.getChildNodes().item(i).getLocalName())) {
                LOGGER.trace("FaultCode found.");
                faultCode = responseNode.getChildNodes().item(i).getTextContent();
            } else if ("faultstring".equalsIgnoreCase(responseNode.getChildNodes().item(i).getLocalName())) {
                LOGGER.trace("FaultString found.");
                faultString = responseNode.getChildNodes().item(i).getTextContent();
            }
        }
    }
    if (faultCode != null || faultString != null) {
        response.setErrorMessage(new ErrorMessage(faultCode, faultString));
        LOGGER.info("Error message was succesfully deserialized.");
        return true;
    }
    LOGGER.debug("SOAP error message was not found.");
    return false;
}
 
开发者ID:vrk-kpa,项目名称:xrd4j,代码行数:40,代码来源:AbstractResponseDeserializer.java

示例8: deserializeRequestData

protected String deserializeRequestData(Node requestNode) throws SOAPException {
    for (int i = 0; i < requestNode.getChildNodes().getLength(); i++) {
        if (requestNode.getChildNodes().item(i).getNodeType() == Node.ELEMENT_NODE
                && requestNode.getChildNodes().item(i).getLocalName().equals("data")) {
            return requestNode.getChildNodes().item(i).getTextContent();
        }
    }
    return null;
}
 
开发者ID:vrk-kpa,项目名称:xrd4j,代码行数:9,代码来源:ServiceResponseDeserializerTest.java

示例9: deserializeResponseData

protected String deserializeResponseData(Node responseNode, SOAPMessage message) throws SOAPException {
    for (int i = 0; i < responseNode.getChildNodes().getLength(); i++) {
        if (responseNode.getChildNodes().item(i).getNodeType() == Node.ELEMENT_NODE
                && responseNode.getChildNodes().item(i).getLocalName().equals("data")) {
            return responseNode.getChildNodes().item(i).getTextContent();
        }
    }
    return null;
}
 
开发者ID:vrk-kpa,项目名称:xrd4j,代码行数:9,代码来源:ServiceResponseDeserializerTest.java

示例10: deserializeRequest

protected String deserializeRequest(Node requestNode, SOAPMessage message) throws SOAPException {
    for (int i = 0; i < requestNode.getChildNodes().getLength(); i++) {
        if (requestNode.getChildNodes().item(i).getNodeType() == Node.ELEMENT_NODE
                && requestNode.getChildNodes().item(i).getLocalName().equals("data")) {
            return requestNode.getChildNodes().item(i).getTextContent();
        }
    }
    return null;
}
 
开发者ID:vrk-kpa,项目名称:xrd4j,代码行数:9,代码来源:CustomRequestDeserializerTest.java

示例11: getNode

/**
 * Goes through all the child nodes of the given node and returns the first
 * child that matches the given name. If no child with the given is found,
 * null is returned.
 *
 * @param node parent node
 * @param nodeName name of the node to be searched
 * @return node with the given name or null
 */
public static Node getNode(Node node, String nodeName) {
    for (int i = 0; i < node.getChildNodes().getLength(); i++) {
        if (node.getChildNodes().item(i).getNodeType() == Node.ELEMENT_NODE
                && node.getChildNodes().item(i).getLocalName().equals(nodeName)) {
            return (Node) node.getChildNodes().item(i);
        }
    }
    return null;
}
 
开发者ID:vrk-kpa,项目名称:xrd4j,代码行数:18,代码来源:SOAPHelper.java

示例12: removeNamespace

/**
 * Removes the namespace from the given Node and all its children.
 *
 * @param node Node to be modified
 */
public static void removeNamespace(Node node) {
    if (node.getNodeType() == Node.ELEMENT_NODE) {
        node.getOwnerDocument().renameNode(node, null, node.getLocalName());
    }
    NodeList list = node.getChildNodes();
    for (int i = 0; i < list.getLength(); i++) {
        SOAPHelper.removeNamespace((Node) list.item(i));
    }
}
 
开发者ID:vrk-kpa,项目名称:xrd4j,代码行数:14,代码来源:SOAPHelper.java

示例13: deserializeResponseData

@Override
protected String deserializeResponseData(Node responseNode, SOAPMessage message) throws SOAPException {
    // Look for the "processingTime" node, ignore all the other elements
    for (int i = 0; i < responseNode.getChildNodes().getLength(); i++) {
        if (responseNode.getChildNodes().item(i).getNodeType() == Node.ELEMENT_NODE
                && "processingTime".equals(responseNode.getChildNodes().item(i).getLocalName())) {
            return responseNode.getChildNodes().item(i).getTextContent();
        }
    }
    return null;
}
 
开发者ID:petkivim,项目名称:x-road-test-client,代码行数:11,代码来源:TestServiceResponseDeserializer.java

示例14: load

public ArrayList<Employee> load() throws Exception {
	ArrayList<Employee> employees = new ArrayList<Employee>();
	File fXmlFile = new File(XML_FILENAME);
	DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
	DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
	Document doc = dBuilder.parse(fXmlFile);
	doc.getDocumentElement().normalize();
	NodeList nodeList = doc.getElementsByTagName(Constants.XML_TAGS.EMPLOYEE);
	for (int i = 0; i < nodeList.getLength(); i++) {
		org.w3c.dom.Node node =  nodeList.item(i);
		if (node.getNodeType() == Node.ELEMENT_NODE) {
			Element element = (Element) node;
			String discriminant = element.getElementsByTagName(Constants.XML_TAGS.DISCRIMINANT).item(0)
					.getTextContent();
			switch (discriminant) {
			case Constants.Employees.Employee.Caretaker:
				EmployeeAbstractFactory caretakers = new CaretakerFactory();
				Employee caretaker = (Caretaker) caretakers.getEmployee(Constants.Employees.Employee.Caretaker);
				caretaker.decodeFromXml(element);
				employees.add(caretaker);

			default:
				break;
			}
		}
	}
	return employees;
}
 
开发者ID:JavaSummer,项目名称:JavaMainRepo,代码行数:28,代码来源:EmployeeRepository.java

示例15: load

public ArrayList<Employee> load() throws ParserConfigurationException, SAXException, IOException{
	ArrayList<Employee> employees = new ArrayList<Employee>();
	
	File fXmlFile = new File(XML_FILENAME);
	DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
	DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
	Document doc = (Document) dBuilder.parse(fXmlFile);
	doc.getDocumentElement().normalize();
	
	NodeList nodeList = doc.getElementsByTagName(Constants.XML_TAGS.EMPLOYEE);
	for (int i = 0; i < nodeList.getLength(); i++) {
		Node node = (Node) nodeList.item(i);
		if (node.getNodeType() == Node.ELEMENT_NODE) {
			Element element = (Element) node;
			String discriminant = element.getElementsByTagName(Constants.XML_TAGS.DISCRIMINANT).item(0).getTextContent();
			switch (discriminant) {
			case Constants.Employee.Caretaker:
				Employee caretaker = new Caretaker();
				caretaker.decodeFromXml(element);
				employees.add(caretaker);
			default:
				break;
			}
		}
}
	return employees;
}
 
开发者ID:JavaSummer,项目名称:JavaMainRepo,代码行数:27,代码来源:EmployeeRepository.java


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