In the Google RESTFul API, the Google Blogger API (Google Blog API) should be close to our lives, as nearly a lot of people are reading blogs every day and have heard of blogs. In a series of articles in front of Google's application system for integration (5) and Google's Applications for integration (6). We mentioned how to convert the JSON schema of Google Calendar and Google tasks into an XSD
Both XML schema and DTD are used for document verification, but there are some differences between them. The former is more accurate and flexible:
DTDDTD does not comply with XML syntaxThe DTD cannot be expanded.DTD does not support namespace applicationsThe DTD does not provide powerful data type support and can only represent simple data types.
SchemaSchema is fully based on XML syntaxCan be processed using tools for processing XML documentsGreatly
());
}
/* (Non-javadoc)
* @ See org. xml. Sax. errorhandler # warning (Org. xml. Sax. saxparseexception)
*/
Public void warning (saxparseexception exception) throws saxexception {
Errors. Add (exception. getmessage ());
}
Public void adderror (string error ){
Errors. Add (error );
}
Public Boolean haserror (){
Return (errors! = NULL) (errors. Size ()> 0 );
}
}
Parse XML method-the function of this method is to parse the imported XML file into a dodument object and use
There are some Google API introductions, but in actual development we may need to convert the JSON data returned by the Google RESTful API into XML data input into a third-party system, which is very common in enterprise application integration. Then there is the question of how to ensure that the converted XML data format is canonical, which requires XML Schema (XML) for validation. Now the point is, we on
Add a groovy script to verify the test step.
The script is as follows (it has been run successfully ):
import javax.xml.XMLConstantsimport javax.xml.transform.stream.StreamSourceimport javax.xml.validation.SchemaFactory//Load the XSD from a filedef xsd = new File(‘D:\\DOAutomationTest\\Automation_Test_DO_IpadForAdvisor_SoapUI\\Schemas\\schema_Clients.xsd‘).textlog.info "xsd = "+xsd//Get the XML from the responsedef response = testRunner.testCase.testS
Currently, XML is increasingly used. In SQL Server tables, we can create XML columns to store data. Yesterday I saw someone in the Forum saying that a stored procedure was created to process XML, but an error was reported when the target table was inserted, but the error was not detailed. In fact, the root cause of this problem is that there is a problem with the XML data. We should verify the input data during insertion (the user input data must be v
": { " description ":" Years "," Type ":" Integer ", " minimum ": 0 } }, "required": [ "FirstName", "LastName" ]}Let's take a look at the various important keywords that can be used in this pattern:More keywords can refer to http://json-schema.org/latest/json-schema-validation.htmlor http://tools.ietf.org/html/draft-zyp-
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.