Java Code Examples for org.w3c.dom.Element#getNodeValue()
The following examples show how to use
org.w3c.dom.Element#getNodeValue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseDefinitionReader.java From arcusplatform with Apache License 2.0 | 5 votes |
protected String readDescription(Element element) { String value = extractText(element); if (value == null || value.isEmpty()) { value = element.getNodeValue(); } if (value != null) { value = value.replaceAll("[\\n\\r]", ""); } return value; }
Example 2
Source File: DOMUtils.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static String getElementText(Element element) throws DOMException{ for (Node child = element.getFirstChild(); child != null; child = child.getNextSibling()) { if(child.getNodeType() == Node.TEXT_NODE) return child.getNodeValue(); } return element.getNodeValue(); }
Example 3
Source File: DOMUtils.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public static String getElementText(Element element) throws DOMException{ for (Node child = element.getFirstChild(); child != null; child = child.getNextSibling()) { if(child.getNodeType() == Node.TEXT_NODE) return child.getNodeValue(); } return element.getNodeValue(); }
Example 4
Source File: DOMUtils.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static String getElementText(Element element) throws DOMException{ for (Node child = element.getFirstChild(); child != null; child = child.getNextSibling()) { if(child.getNodeType() == Node.TEXT_NODE) return child.getNodeValue(); } return element.getNodeValue(); }
Example 5
Source File: DOMUtils.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public static String getElementText(Element element) throws DOMException{ for (Node child = element.getFirstChild(); child != null; child = child.getNextSibling()) { if(child.getNodeType() == Node.TEXT_NODE) return child.getNodeValue(); } return element.getNodeValue(); }
Example 6
Source File: DOMUtils.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public static String getElementText(Element element) throws DOMException{ for (Node child = element.getFirstChild(); child != null; child = child.getNextSibling()) { if(child.getNodeType() == Node.TEXT_NODE) return child.getNodeValue(); } return element.getNodeValue(); }
Example 7
Source File: DOMUtils.java From hottub with GNU General Public License v2.0 | 5 votes |
public static String getElementText(Element element) throws DOMException{ for (Node child = element.getFirstChild(); child != null; child = child.getNextSibling()) { if(child.getNodeType() == Node.TEXT_NODE) return child.getNodeValue(); } return element.getNodeValue(); }
Example 8
Source File: DOMUtils.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public static String getElementText(Element element) throws DOMException{ for (Node child = element.getFirstChild(); child != null; child = child.getNextSibling()) { if(child.getNodeType() == Node.TEXT_NODE) return child.getNodeValue(); } return element.getNodeValue(); }
Example 9
Source File: DOMUtils.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public static String getElementText(Element element) throws DOMException{ for (Node child = element.getFirstChild(); child != null; child = child.getNextSibling()) { if(child.getNodeType() == Node.TEXT_NODE) return child.getNodeValue(); } return element.getNodeValue(); }
Example 10
Source File: RomImage.java From birt with Eclipse Public License 1.0 | 5 votes |
public String getDefaultValue( Element romProp ) { NodeList list = romProp.getElementsByTagName( "Default" ); if ( list.getLength( ) == 0 ) return null; Element valueNode = (Element) list.item( 0 ); return valueNode.getNodeValue(); }
Example 11
Source File: IssuedTokenBuilder.java From steady with Apache License 2.0 | 4 votes |
public Assertion build(Element element, AssertionBuilderFactory factory) throws IllegalArgumentException { SPConstants consts = SP11Constants.SP_NS.equals(element.getNamespaceURI()) ? SP11Constants.INSTANCE : SP12Constants.INSTANCE; IssuedToken issuedToken = new IssuedToken(consts); issuedToken.setOptional(PolicyConstants.isOptional(element)); issuedToken.setIgnorable(PolicyConstants.isIgnorable(element)); String includeAttr = DOMUtils.getAttribute(element, consts.getIncludeToken()); if (includeAttr != null) { issuedToken.setInclusion(consts.getInclusionFromAttributeValue(includeAttr)); } Element child = DOMUtils.getFirstElement(element); boolean foundPolicy = false; boolean foundRST = false; while (child != null) { String ln = child.getLocalName(); if (SPConstants.ISSUER.equals(ln)) { try { EndpointReferenceType epr = VersionTransformer.parseEndpointReference(child); issuedToken.setIssuerEpr(epr); } catch (JAXBException e) { throw new IllegalArgumentException(e); } } else if (SPConstants.REQUEST_SECURITY_TOKEN_TEMPLATE.equals(ln)) { foundRST = true; issuedToken.setRstTemplate(child); } else if (org.apache.neethi.Constants.ELEM_POLICY.equals(ln)) { foundPolicy = true; Policy policy = builder.getPolicy(child); policy = policy.normalize(builder.getPolicyRegistry(), false); for (Iterator<List<Assertion>> iterator = policy.getAlternatives(); iterator.hasNext();) { processAlternative(iterator.next(), issuedToken); break; // since there should be only one alternative .. } } else if (SPConstants.ISSUER_NAME.equals(ln)) { String issuerName = child.getNodeValue(); issuedToken.setIssuerName(issuerName); } child = DOMUtils.getNextElement(child); } if (!foundPolicy && consts != SP11Constants.INSTANCE) { throw new IllegalArgumentException( "sp:IssuedToken/wsp:Policy must have a value" ); } if (!foundRST) { throw new IllegalArgumentException( "sp:IssuedToken/sp:RequestSecurityTokenTemplate must have a value" ); } return issuedToken; }
Example 12
Source File: IssuedTokenBuilder.java From steady with Apache License 2.0 | 4 votes |
public Assertion build(Element element, AssertionBuilderFactory factory) throws IllegalArgumentException { SPConstants consts = SP11Constants.SP_NS.equals(element.getNamespaceURI()) ? SP11Constants.INSTANCE : SP12Constants.INSTANCE; IssuedToken issuedToken = new IssuedToken(consts); issuedToken.setOptional(PolicyConstants.isOptional(element)); issuedToken.setIgnorable(PolicyConstants.isIgnorable(element)); String includeAttr = DOMUtils.getAttribute(element, consts.getIncludeToken()); if (includeAttr != null) { issuedToken.setInclusion(consts.getInclusionFromAttributeValue(includeAttr)); } Element child = DOMUtils.getFirstElement(element); boolean foundPolicy = false; boolean foundRST = false; while (child != null) { String ln = child.getLocalName(); if (SPConstants.ISSUER.equals(ln)) { try { EndpointReferenceType epr = VersionTransformer.parseEndpointReference(child); issuedToken.setIssuerEpr(epr); } catch (JAXBException e) { throw new IllegalArgumentException(e); } } else if (SPConstants.REQUEST_SECURITY_TOKEN_TEMPLATE.equals(ln)) { foundRST = true; issuedToken.setRstTemplate(child); } else if (org.apache.neethi.Constants.ELEM_POLICY.equals(ln)) { foundPolicy = true; Policy policy = builder.getPolicy(child); policy = policy.normalize(builder.getPolicyRegistry(), false); for (Iterator<List<Assertion>> iterator = policy.getAlternatives(); iterator.hasNext();) { processAlternative(iterator.next(), issuedToken); break; // since there should be only one alternative .. } } else if (SPConstants.ISSUER_NAME.equals(ln)) { String issuerName = child.getNodeValue(); issuedToken.setIssuerName(issuerName); } child = DOMUtils.getNextElement(child); } if (!foundPolicy && consts != SP11Constants.INSTANCE) { throw new IllegalArgumentException( "sp:IssuedToken/wsp:Policy must have a value" ); } if (!foundRST) { throw new IllegalArgumentException( "sp:IssuedToken/sp:RequestSecurityTokenTemplate must have a value" ); } return issuedToken; }
Example 13
Source File: IssuedTokenBuilder.java From steady with Apache License 2.0 | 4 votes |
public Assertion build(Element element, AssertionBuilderFactory factory) throws IllegalArgumentException { SPConstants consts = SP11Constants.SP_NS.equals(element.getNamespaceURI()) ? SP11Constants.INSTANCE : SP12Constants.INSTANCE; IssuedToken issuedToken = new IssuedToken(consts); issuedToken.setOptional(PolicyConstants.isOptional(element)); issuedToken.setIgnorable(PolicyConstants.isIgnorable(element)); String includeAttr = DOMUtils.getAttribute(element, consts.getIncludeToken()); if (includeAttr != null) { issuedToken.setInclusion(consts.getInclusionFromAttributeValue(includeAttr)); } Element child = DOMUtils.getFirstElement(element); boolean foundPolicy = false; boolean foundRST = false; while (child != null) { String ln = child.getLocalName(); if (SPConstants.ISSUER.equals(ln)) { try { EndpointReferenceType epr = VersionTransformer.parseEndpointReference(child); issuedToken.setIssuerEpr(epr); } catch (JAXBException e) { throw new IllegalArgumentException(e); } } else if (SPConstants.REQUEST_SECURITY_TOKEN_TEMPLATE.equals(ln)) { foundRST = true; issuedToken.setRstTemplate(child); } else if (org.apache.neethi.Constants.ELEM_POLICY.equals(ln)) { foundPolicy = true; Policy policy = builder.getPolicy(child); policy = policy.normalize(builder.getPolicyRegistry(), false); for (Iterator<List<Assertion>> iterator = policy.getAlternatives(); iterator.hasNext();) { processAlternative(iterator.next(), issuedToken); break; // since there should be only one alternative .. } } else if (SPConstants.ISSUER_NAME.equals(ln)) { String issuerName = child.getNodeValue(); issuedToken.setIssuerName(issuerName); } child = DOMUtils.getNextElement(child); } if (!foundPolicy && consts != SP11Constants.INSTANCE) { throw new IllegalArgumentException( "sp:IssuedToken/wsp:Policy must have a value" ); } if (!foundRST) { throw new IllegalArgumentException( "sp:IssuedToken/sp:RequestSecurityTokenTemplate must have a value" ); } return issuedToken; }
Example 14
Source File: IssuedTokenBuilder.java From steady with Apache License 2.0 | 4 votes |
public Assertion build(Element element, AssertionBuilderFactory factory) throws IllegalArgumentException { SPConstants consts = SP11Constants.SP_NS.equals(element.getNamespaceURI()) ? SP11Constants.INSTANCE : SP12Constants.INSTANCE; IssuedToken issuedToken = new IssuedToken(consts); issuedToken.setOptional(PolicyConstants.isOptional(element)); issuedToken.setIgnorable(PolicyConstants.isIgnorable(element)); String includeAttr = DOMUtils.getAttribute(element, consts.getIncludeToken()); if (includeAttr != null) { issuedToken.setInclusion(consts.getInclusionFromAttributeValue(includeAttr)); } Element child = DOMUtils.getFirstElement(element); boolean foundPolicy = false; boolean foundRST = false; while (child != null) { String ln = child.getLocalName(); if (SPConstants.ISSUER.equals(ln)) { try { EndpointReferenceType epr = VersionTransformer.parseEndpointReference(child); issuedToken.setIssuerEpr(epr); } catch (JAXBException e) { throw new IllegalArgumentException(e); } } else if (SPConstants.REQUEST_SECURITY_TOKEN_TEMPLATE.equals(ln)) { foundRST = true; issuedToken.setRstTemplate(child); } else if (org.apache.neethi.Constants.ELEM_POLICY.equals(ln)) { foundPolicy = true; Policy policy = builder.getPolicy(child); policy = policy.normalize(builder.getPolicyRegistry(), false); for (Iterator<List<Assertion>> iterator = policy.getAlternatives(); iterator.hasNext();) { processAlternative(iterator.next(), issuedToken); break; // since there should be only one alternative .. } } else if (SPConstants.ISSUER_NAME.equals(ln)) { String issuerName = child.getNodeValue(); issuedToken.setIssuerName(issuerName); } child = DOMUtils.getNextElement(child); } if (!foundPolicy && consts != SP11Constants.INSTANCE) { throw new IllegalArgumentException( "sp:IssuedToken/wsp:Policy must have a value" ); } if (!foundRST) { throw new IllegalArgumentException( "sp:IssuedToken/sp:RequestSecurityTokenTemplate must have a value" ); } return issuedToken; }