private Document getXMLDocumentFromString( String xmlText ) { return (Document) XMLParser.parse( xmlText ); }
public String validate(String code) { try { XMLParser.parse(code); return null; } catch (Exception e) { return e.getMessage(); } } }
public String validate(String code) { try { XMLParser.parse(code); return null; } catch (Exception e) { return e.getMessage(); } } }
@Override protected Element stringToElement( String xml ) { return XMLParser.parse( xml ).getDocumentElement(); }
@Nullable private Document convertFromXML(@Nonnull final Response response) { if (response.getText() != null) { return XMLParser.parse(response.getText()); } else { return null; } } }
@Override protected Document parseResult() throws Exception { try { return XMLParser.parse(response.getText()); } catch (Throwable e) { throw new ResponseFormatException("Response was NOT a valid XML document", e); } } });
@Override protected Document parseResult() throws Exception { try { return XMLParser.parse(response.getText()); } catch (Throwable e) { throw new ResponseFormatException("Response was NOT a valid XML document", e); } } });
public void onResponseReceived(Request request, Response response) { PropertiesManager.this.properties = XMLParser.parse(response.getText()); Application.continueStartup(); } };
/** * Parses a string into a XMLPacket. * * @param xml the string to parse * @return the resulting packet */ public static XMLPacket fromString(final String xml) { try { return new XMLPacketImplGWT(XMLParser.parse(xml).getDocumentElement()); } catch (final DOMParseException e) { return null; } }
public void onSubmitComplete(SubmitCompleteEvent event) { updateStatusTimer.cancel(); onSubmitComplete = true; serverRawResponse = event.getResults(); if (serverRawResponse != null) { serverRawResponse = serverRawResponse.replaceFirst(".*" + TAG_MSG_START + "([\\s\\S]*?)" + TAG_MSG_END + ".*", "$1"); serverRawResponse = serverRawResponse.replace(TAG_MSG_LT, "<").replace(TAG_MSG_GT, ">").replace("<", "<").replaceAll(">", ">").replaceAll(" ", " "); } try { // Parse the xml and extract UploadedInfos Document doc = XMLParser.parse(serverRawResponse); // If the server response is a valid xml parseAjaxResponse(serverRawResponse); } catch (Exception e) { log("onSubmitComplete exception parsing response (Check CORS and XML syntax): ", e); // Otherwise force an ajax request so as we have not to wait to the timer schedule updateStatusTimer.run(); } } };
/** * Returns the wrapped DOM document. If no document is defined yet, it * attempts to parse the XML representation eventually given at construction * time. Otherwise, it just creates a new document. * * @return The wrapped DOM document. */ public Document getDocument() { if (this.dom == null) { if (this.xmlRepresentation != null) { this.dom = XMLParser.parse(this.xmlRepresentation.getText()); } else { this.dom = XMLParser.createDocument(); } } return this.dom; }
/** * Returns the wrapped DOM document. If no document is defined yet, it * attempts to parse the XML representation eventually given at construction * time. Otherwise, it just creates a new document. * * @return The wrapped DOM document. * @throws IOException */ public Document getDocument() throws IOException { if (this.dom == null) { if (this.xmlRepresentation != null) { this.dom = XMLParser.parse(this.xmlRepresentation.getText()); } else { this.dom = XMLParser.createDocument(); } } return this.dom; }
@Override public Document decode(JSONValue value) throws DecodingException { if (value == null || value.isNull() != null) { return null; } JSONString str = value.isString(); if (str == null) { throw new DecodingException("Expected a json string, but was given: " + value); } return XMLParser.parse(str.stringValue()); }
@Override public Document decode(JSONValue value) throws DecodingException { if (value == null || value.isNull() != null) { return null; } JSONString str = value.isString(); if (str == null) { throw new DecodingException("Expected a json string, but was given: " + value); } return XMLParser.parse(str.stringValue()); }
private List<String> convertReponseToList( Response response ) { List<String> dataList = new ArrayList<String>(); Document document = (Document) XMLParser.parse( response.getText() ); Element element = document.getDocumentElement(); Node node = element.getFirstChild(); boolean done = false; do { try { dataList.add( getNodeValueByTagName( node, "Item" ) ); node = ( node.getNextSibling() != null ) ? node.getNextSibling() : null; if ( node == null ) { done = true; } } catch ( Exception e ) { done = true; } } while ( !done ); return dataList; }
public void onResponseReceived(Request request, Response response) { String s = Cookies.getCookie("JSESSIONID"); if (s == null) { s = Utils.getXmlNodeValue(XMLParser.parse(response.getText()), TAG_SESSION_ID); } setSessionId(s); callback.onResponseReceived(request, response); } public void onError(Request request, Throwable exception) {
public void onResponseReceived(Request request, Response response) { try { String s = Utils.getXmlNodeValue(XMLParser.parse(response.getText()), TAG_BLOBSTORE); blobstore = "true".equalsIgnoreCase(s); // with blobstore status does not make sense if (blobstore) { updateStatusTimer.setInterval(5000); } uploadForm.setAction(session.getServletPath()); uploadForm.submit(); } catch (Exception e) { String message = e.getMessage().contains("error:") ? i18nStrs.uploaderServerUnavailable() + " (3) " + getServletPath() + "\n\n" + i18nStrs.uploaderServerError() + "\nAction: " + getServletPath() + "\nException: " + e.getMessage() + response.getText() : i18nStrs.submitError(); cancelUpload( message); } } };
public void onResponseReceived(Request request, Response response) { if (200 == response.getStatusCode()) { try { Document messageDom = XMLParser.parse(response.getText()); WfsGetCapabilitiesInfo capabilities; switch (version) { case V1_0_0: capabilities = new WfsGetCapabilitiesInfo100(messageDom.getDocumentElement()); break; default: callback.onFailure("Unsupported version"); return; } callback.onSuccess(capabilities); } catch (Throwable t) { t.printStackTrace(); callback.onFailure(t.getMessage()); } } else { callback.onFailure(response.getText()); } } });
public void onResponseReceived(Request request, Response response) { if (200 == response.getStatusCode()) { Document messageDom = XMLParser.parse(response.getText()); WmsGetCapabilitiesInfo capabilities; switch (version) { case V1_1_1: capabilities = new WmsGetCapabilitiesInfo111(messageDom.getDocumentElement()); break; case V1_3_0: capabilities = new WmsGetCapabilitiesInfo130(messageDom.getDocumentElement()); break; default: callback.onFailure("Unsupported version"); return; } callback.onSuccess(capabilities); } else { callback.onFailure(response.getText()); } } });
public IDatabaseConnection convertToObject( String xml ) { Document document = XMLParser.parse( xml ); Element element = document.getDocumentElement(); IDatabaseConnection databaseConnection = new DatabaseConnection(); databaseConnection.setDatabaseName( getNodeValueByTagName( element, DATABASE_NAME ) ); databaseConnection.setHostname( getNodeValueByTagName( element, HOSTNAME ) ); databaseConnection.setIndexTablespace( getNodeValueByTagName( element, INDEX_TABLESPACE ) ); databaseConnection.setDataTablespace( getNodeValueByTagName( element, DATA_TABLESPACE ) ); databaseConnection.setName( getNodeValueByTagName( element, NAME ) ); databaseConnection.setUsername( getNodeValueByTagName( element, USERNAME ) ); databaseConnection.setPassword( getNodeValueByTagName( element, PASSWORD ) ); databaseConnection.setDatabasePort( getNodeValueByTagName( element, DATABASE_PORT ) ); databaseConnection .setAccessType( DatabaseAccessType.getAccessTypeByName( getNodeValueByTagName( element, ACCESS_TYPE ) ) ); databaseConnection.setDatabaseType( (DatabaseType) databaseTypeHelper.getDatabaseTypeByShortName( getNodeValueByTagName( element, DATABASE_TYPE ) ) ); databaseConnection.setPassword( getNodeValueByTagName( element, PASSWORD ) ); databaseConnection.setInformixServername( getNodeValueByTagName( element, SERVER_NAME ) ); for ( Node node : getNodesByTagName( element, ATTRIBUTES ) ) { databaseConnection.getAttributes().put( node.getNodeName(), node.getNodeValue() ); } return databaseConnection; }