本文整理匯總了Java中org.w3c.dom.Node.getChildNodes方法的典型用法代碼示例。如果您正苦於以下問題:Java Node.getChildNodes方法的具體用法?Java Node.getChildNodes怎麽用?Java Node.getChildNodes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.w3c.dom.Node
的用法示例。
在下文中一共展示了Node.getChildNodes方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: parseConnectionFactory
import org.w3c.dom.Node; //導入方法依賴的package包/類
protected void parseConnectionFactory(Context context, Node node) {
ConnectionFactoryConfiguration connectionFactoryConfiguration = new ConnectionFactoryConfiguration();
context.setConnectionFactoryConfiguration(connectionFactoryConfiguration);
Properties attributes = parseAttributes(node);
String type = attributes.getProperty("type"); //$NON-NLS-1$
if (stringHasValue(type)) {
connectionFactoryConfiguration.setConfigurationType(type);
}
NodeList nodeList = node.getChildNodes();
for (int i = 0; i < nodeList.getLength(); i++) {
Node childNode = nodeList.item(i);
if (childNode.getNodeType() != Node.ELEMENT_NODE) {
continue;
}
if ("property".equals(childNode.getNodeName())) { //$NON-NLS-1$
parseProperty(connectionFactoryConfiguration, childNode);
}
}
}
示例2: toString
import org.w3c.dom.Node; //導入方法依賴的package包/類
/**
* Return the string value of a Node
*
* @param n The Node.
* @return The string value of the Node
*/
protected static String toString(Node n)
{
if (n instanceof DTMNodeProxy)
return ((DTMNodeProxy)n).getStringValue();
else
{
String value = n.getNodeValue();
if (value == null)
{
NodeList nodelist = n.getChildNodes();
StringBuffer buf = new StringBuffer();
for (int i = 0; i < nodelist.getLength(); i++)
{
Node childNode = nodelist.item(i);
buf.append(toString(childNode));
}
return buf.toString();
}
else
return value;
}
}
示例3: newKeySelector
import org.w3c.dom.Node; //導入方法依賴的package包/類
public KeySelector newKeySelector(Node nodeSignature)
throws DigitalSignatureValidationException {
Node nodeKeyinfo = getKeyInfoNode(nodeSignature);
if (nodeKeyinfo == null) {
throw new DigitalSignatureValidationException(
"No KeyInfo element found in SAML assertion");
}
NodeList children = nodeKeyinfo.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
Node node = children.item(i);
if (SamlXmlTags.NODE_KEY_VALUE.equals(node.getLocalName())) {
return new KeyValueKeySelector();
} else if (SamlXmlTags.NODE_X509DATA.equals(node.getLocalName())) {
return new X509KeySelector(keystore);
}
}
throw new DigitalSignatureValidationException(
"Only RSA/DSA KeyValue and are X509Data supported");
}
示例4: variableNotUsed
import org.w3c.dom.Node; //導入方法依賴的package包/類
private static boolean variableNotUsed(Node root, Node variable)
{
if (root.getNodeName().equals("value"))
{
if (root.isEqualNode(variable))
return false;
else
return true;
}
NodeList statements = root.getChildNodes();
for (int i = 0; i < statements.getLength(); i++)
{
Node statement = statements.item(i);
if (!statement.getNodeName().equals("uses"))
if (!variableNotUsed(statement,variable))
{
return false;
}
}
return true;
}
示例5: parseIbatorPlugin
import org.w3c.dom.Node; //導入方法依賴的package包/類
private void parseIbatorPlugin(Context context, Node node) {
PluginConfiguration pluginConfiguration = new PluginConfiguration();
context.addPluginConfiguration(pluginConfiguration);
Properties attributes = parseAttributes(node);
String type = attributes.getProperty("type"); //$NON-NLS-1$
pluginConfiguration.setConfigurationType(type);
NodeList nodeList = node.getChildNodes();
for (int i = 0; i < nodeList.getLength(); i++) {
Node childNode = nodeList.item(i);
if (childNode.getNodeType() != Node.ELEMENT_NODE) {
continue;
}
if ("property".equals(childNode.getNodeName())) { //$NON-NLS-1$
parseProperty(pluginConfiguration, childNode);
}
}
}
示例6: parseCommentGenerator
import org.w3c.dom.Node; //導入方法依賴的package包/類
protected void parseCommentGenerator(Context context, Node node) {
CommentGeneratorConfiguration commentGeneratorConfiguration = new CommentGeneratorConfiguration();
context.setCommentGeneratorConfiguration(commentGeneratorConfiguration);
Properties attributes = parseAttributes(node);
String type = attributes.getProperty("type"); //$NON-NLS-1$
if (stringHasValue(type)) {
commentGeneratorConfiguration.setConfigurationType(type);
}
NodeList nodeList = node.getChildNodes();
for (int i = 0; i < nodeList.getLength(); i++) {
Node childNode = nodeList.item(i);
if (childNode.getNodeType() != Node.ELEMENT_NODE) {
continue;
}
if ("property".equals(childNode.getNodeName())) { //$NON-NLS-1$
parseProperty(commentGeneratorConfiguration, childNode);
}
}
}
示例7: parseJavaTypeResolver
import org.w3c.dom.Node; //導入方法依賴的package包/類
protected void parseJavaTypeResolver(Context context, Node node) {
JavaTypeResolverConfiguration javaTypeResolverConfiguration = new JavaTypeResolverConfiguration();
context.setJavaTypeResolverConfiguration(javaTypeResolverConfiguration);
Properties attributes = parseAttributes(node);
String type = attributes.getProperty("type"); //$NON-NLS-1$
if (stringHasValue(type)) {
javaTypeResolverConfiguration.setConfigurationType(type);
}
NodeList nodeList = node.getChildNodes();
for (int i = 0; i < nodeList.getLength(); i++) {
Node childNode = nodeList.item(i);
if (childNode.getNodeType() != Node.ELEMENT_NODE) {
continue;
}
if ("property".equals(childNode.getNodeName())) { //$NON-NLS-1$
parseProperty(javaTypeResolverConfiguration, childNode);
}
}
}
開發者ID:xiachengwei5,項目名稱:org.mybatis.generator.core-1.3.5,代碼行數:26,代碼來源:MyBatisGeneratorConfigurationParser.java
示例8: addTextNodesToRemoveAndTrim
import org.w3c.dom.Node; //導入方法依賴的package包/類
private void addTextNodesToRemoveAndTrim(List<Node> toRemove, Node node) {
if (node instanceof Text) {
Text text = (Text)node;
boolean BUG_369394_IS_VALID = false;
if (!BUG_369394_IS_VALID) {
text.setData(text.getData().trim());
} else {
if (text.getData().trim().length() == 0) {
text.setData("");
}
}
if (text.getData().length() == 0) {
toRemove.add(node);
}
}
if (node.getChildNodes() != null) {
for (int i=0; i<node.getChildNodes().getLength(); i++) {
addTextNodesToRemoveAndTrim(toRemove, node.getChildNodes().item(i));
}
}
}
示例9: setFromMarkerSequenceNode
import org.w3c.dom.Node; //導入方法依賴的package包/類
void setFromMarkerSequenceNode(Node markerSequenceNode)
throws IIOInvalidTreeException{
NodeList children = markerSequenceNode.getChildNodes();
// for all the children, add a marker segment
for (int i = 0; i < children.getLength(); i++) {
Node node = children.item(i);
String childName = node.getNodeName();
if (childName.equals("dqt")) {
markerSequence.add(new DQTMarkerSegment(node));
} else if (childName.equals("dht")) {
markerSequence.add(new DHTMarkerSegment(node));
} else if (childName.equals("dri")) {
markerSequence.add(new DRIMarkerSegment(node));
} else if (childName.equals("com")) {
markerSequence.add(new COMMarkerSegment(node));
} else if (childName.equals("app14Adobe")) {
markerSequence.add(new AdobeMarkerSegment(node));
} else if (childName.equals("unknown")) {
markerSequence.add(new MarkerSegment(node));
} else if (childName.equals("sof")) {
markerSequence.add(new SOFMarkerSegment(node));
} else if (childName.equals("sos")) {
markerSequence.add(new SOSMarkerSegment(node));
} else {
throw new IIOInvalidTreeException("Invalid "
+ (isStream ? "stream " : "image ") + "child: "
+ childName, node);
}
}
}
示例10: getElements
import org.w3c.dom.Node; //導入方法依賴的package包/類
private static List<Node> getElements(Node node, String elementName) {
List<Node> list = new LinkedList<Node>();
NodeList nodeList = node.getChildNodes();
for (int i = 0; i < nodeList.getLength(); i++) {
if (nodeList.item(i).getNodeName().equals(elementName)
&& nodeList.item(i).getNodeType() == Node.ELEMENT_NODE) {
list.add(nodeList.item(i));
}
}
return list;
}
示例11: getText
import org.w3c.dom.Node; //導入方法依賴的package包/類
private static String getText(Node node) {
NodeList nodeList = node.getChildNodes();
for (int i = 0; i < nodeList.getLength(); i++) {
if (nodeList.item(i).getNodeName().equals("#text") ||
nodeList.item(i).getNodeName().equals("#cdata-section"))
{
return nodeList.item(i).getNodeValue();
}
}
return null;
}
示例12: getElementsByTagName
import org.w3c.dom.Node; //導入方法依賴的package包/類
/**
*
* @param tagname
*
*
* @see org.w3c.dom.Document
*/
@Override
public final NodeList getElementsByTagName(String tagname)
{
Vector listVector = new Vector();
Node retNode = dtm.getNode(node);
if (retNode != null)
{
boolean isTagNameWildCard = "*".equals(tagname);
if (DTM.ELEMENT_NODE == retNode.getNodeType())
{
NodeList nodeList = retNode.getChildNodes();
for (int i = 0; i < nodeList.getLength(); i++)
{
traverseChildren(listVector, nodeList.item(i), tagname,
isTagNameWildCard);
}
} else if (DTM.DOCUMENT_NODE == retNode.getNodeType()) {
traverseChildren(listVector, dtm.getNode(node), tagname,
isTagNameWildCard);
}
}
int size = listVector.size();
NodeSet nodeSet = new NodeSet(size);
for (int i = 0; i < size; i++)
{
nodeSet.addNode((Node) listVector.elementAt(i));
}
return (NodeList) nodeSet;
}
示例13: getLastChildNode
import org.w3c.dom.Node; //導入方法依賴的package包/類
/**
* Returns the last child node with the provided name if existing.
*
* @param parentNode
* the node to find the wanted child in
* @param nodeName
* the wanted child node name
* @return the matching child node or <code>null</code> if not found
*/
public static Node getLastChildNode(Node parentNode, String nodeName) {
NodeList childNodes = parentNode.getChildNodes();
Node node = null;
for (int index = 0; index < childNodes.getLength(); index++) {
if (nodeName.equals(childNodes.item(index).getNodeName())) {
node = childNodes.item(index);
}
}
return node;
}
示例14: getElement
import org.w3c.dom.Node; //導入方法依賴的package包/類
private static Node getElement(Node node, String elementName) {
NodeList nodeList = node.getChildNodes();
for (int i = 0; i < nodeList.getLength(); i++) {
if (nodeList.item(i).getNodeName().equals(elementName)
&& nodeList.item(i).getNodeType() == Node.ELEMENT_NODE)
return nodeList.item(i);
}
return null;
}
示例15: parseSqlMapGenerator
import org.w3c.dom.Node; //導入方法依賴的package包/類
private void parseSqlMapGenerator(AbatorContext abatorContext, Node node) {
SqlMapGeneratorConfiguration sqlMapGeneratorConfiguration = new SqlMapGeneratorConfiguration();
abatorContext
.setSqlMapGeneratorConfiguration(sqlMapGeneratorConfiguration);
Properties attributes = parseAttributes(node);
String type = attributes.getProperty("type"); //$NON-NLS-1$
String targetPackage = attributes.getProperty("targetPackage"); //$NON-NLS-1$
String targetProject = attributes.getProperty("targetProject"); //$NON-NLS-1$
if (StringUtility.stringHasValue(type)) {
sqlMapGeneratorConfiguration.setConfigurationType(type);
}
sqlMapGeneratorConfiguration.setTargetPackage(targetPackage);
sqlMapGeneratorConfiguration.setTargetProject(targetProject);
NodeList nodeList = node.getChildNodes();
for (int i = 0; i < nodeList.getLength(); i++) {
Node childNode = nodeList.item(i);
if (childNode.getNodeType() != 1) {
continue;
}
if ("property".equals(childNode.getNodeName())) { //$NON-NLS-1$
parseProperty(sqlMapGeneratorConfiguration, childNode);
}
}
}