public String toString() { return ( "[xmlns:" + prefix + "=\"" + uri + "\", element=" + element.getLocalName() + "]" ); } }
public String getNodeName() { return decodeNode(currentElement.getLocalName()); }
public String getElementName(Object o) { return (isElement(o) ? ((Element)o).getLocalName() : null); }
public String peekNextChild() { Elements children = currentElement.getChildElements(); if (null == children || children.size() == 0) { return null; } return decodeNode(children.get(0).getLocalName()); } }
static Auth getAuth(Element eAuth) { Elements eChildren = eAuth.getChildElements(); for(int i=0; i<eChildren.size(); i++) { Element e = eChildren.get(i); final String name = e.getLocalName(); if(name.equals("basic")) { return getBasicAuth(e); } else if(name.equals("digest")) { return getDigestAuth(e); } else if(name.equals("ntlm")) { return getNtlmAuth(e); } else if(name.equals("oauth2-bearer")) { return getOAuth2BearerAuth(e); } else { throw new XMLException("Invalid auth element encountered: " + name); } } return null; }
static OAuth2BearerAuth getOAuth2BearerAuth(Element eAuth) { OAuth2BearerAuthBean out = new OAuth2BearerAuthBean(); Elements eChildren = eAuth.getChildElements(); for(int i=0; i<eChildren.size(); i++) { Element e = eChildren.get(i); final String name = e.getLocalName(); if(name.equals("token")) { out.setOAuth2BearerToken(e.getValue()); } else { throw new XMLException("Unknown element in oauth2-bearer auth: " + name); } } return out; }
public static List<Request> getRequestCollectionFromXMLFile(final File f) throws IOException, XMLException { XmlPersistenceRead xUtlRead = new XmlPersistenceRead(); List<Request> out = new ArrayList<>(); Document doc = xUtlRead.getDocumentFromFile(f); Element eRoot = doc.getRootElement(); if(!"request-collection".equals(eRoot.getLocalName())) { throw new XMLException("Expecting root element <request-collection>, but found: " + eRoot.getLocalName()); } final String version = eRoot.getAttributeValue("version"); try { Versions.versionValidCheck(version); } catch(Versions.VersionValidationException ex) { throw new XMLException(ex); } xUtlRead.setReadVersion(version); Elements eRequests = doc.getRootElement().getChildElements(); for(int i=0; i<eRequests.size(); i++) { Element eRequest = eRequests.get(i); Request req = xUtlRead.getRequestBean(eRequest); out.add(req); } return out; }
static void populateBasicDigestAuth(BasicDigestAuthBaseBean bean, Element eAuth) { Elements eChildren = eAuth.getChildElements(); for(int i=0; i<eChildren.size(); i++) { Element e = eChildren.get(i); final String name = e.getLocalName(); if(name.equals("host")) { bean.setHost(e.getValue()); } else if(name.equals("realm")) { bean.setRealm(e.getValue()); } else if(name.equals("username")) { bean.setUsername(e.getValue()); } else if(name.equals("password")) { bean.setPassword(getPassword(e)); } else if(name.equals("preemptive")) { bean.setPreemptive(true); } else { throw new XMLException("Unknown element in basic/digest auth: " + name); } } }
for(int i=0; i<eChildren.size(); i++) { Element e = eChildren.get(i); final String name = e.getLocalName(); if("string".equals(name)) { ContentType ct = getContentType(e);
static NtlmAuth getNtlmAuth(Element eNtlmAuth) { NtlmAuthBean out = new NtlmAuthBean(); Elements eChildren = eNtlmAuth.getChildElements(); for(int i=0; i<eChildren.size(); i++) { Element e = eChildren.get(i); final String name = e.getLocalName(); if(name.equals("domain")) { out.setDomain(e.getValue()); } else if(name.equals("workstation")) { out.setWorkstation(e.getValue()); } else if(name.equals("username")) { out.setUsername(e.getValue()); } else if(name.equals("password")) { out.setPassword(getPassword(e)); } else { throw new XMLException("Unknown element in ntlm auth: " + name); } } return out; }
private ReqEntityPart getMultipartPart(Element e) { final String name = e.getLocalName();
for(int i=0; i<eChildren.size(); i++) { Element e = eChildren.get(i); final String name = e.getLocalName(); if(null != name) switch (name) { case "trust-self-signed-cert": // backward-compatibility...
private boolean isBodySection(Node child) { return (child instanceof Element) && ((Element) child).getLocalName().equals("body"); } }
private static SSubsectionContent subsectionContent( final Element e) throws URISyntaxException { if ("paragraph".equals(e.getLocalName())) { return SDocumentParser.paragraph(e); } else if ("formal-item".equals(e.getLocalName())) { return SDocumentParser.formalItem(e); } throw new UnreachableCodeException(); }
/** * Checks XML element local name and namespace URI. * * @param element XML element to check * @param xmlName XML element name * @return True if the element matches the localname and namespace URI. Otherwise, false. */ protected boolean isInstanceOf(Element element, XmlName xmlName) { return (xmlName.getLocalName().equals(element.getLocalName()) && xmlName.getNamespace().equals(element.getNamespaceURI())); }
public XmlName(Element element) { this.prefix = element.getNamespacePrefix(); this.localName = element.getLocalName(); this.namespace = element.getNamespaceURI(); }
@Override public String peekNextChild() { final Elements children = currentElement.getChildElements(); if (null == children || children.size() == 0) { return null; } return decodeNode(children.get(0).getLocalName()); } }
public String peekNextChild() { Elements children = currentElement.getChildElements(); if(children.size()==0) return null; return unescapeXmlName(children.get(0).getLocalName()); }
public String peekNextChild() { Elements children = currentElement.getChildElements(); if (null == children || children.size() == 0) { return null; } return decodeNode(children.get(0).getLocalName()); } }
public String peekNextChild() { Elements children = currentElement.getChildElements(); if (null == children || children.size() == 0) { return null; } return decodeNode(children.get(0).getLocalName()); } }