1 / 9

Static Validation of Dynamically Generated XML Documents

Static Validation of Dynamically Generated XML Documents. A survey on a series of papers by the BRICS research group at the University of Aarhus , Denmark. BRICS = Basic Research in Computer Science www.brics.dk. Dynamic Construction of Web Pages. Interactive Web Services. request.

emlyn
Download Presentation

Static Validation of Dynamically Generated XML Documents

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Static Validation of Dynamically Generated XML Documents A survey on a series of papers by the BRICS research group at the University of Aarhus, Denmark. BRICS = Basic Research in Computer Science www.brics.dk

  2. Dynamic Construction of Web Pages • Interactive Web Services request response Client with a browser Web server • Application-to-application Web Services Clients are not humans but general programs XML widely used as data interchange format for Web Services Typical solutions: embedded server-side scripting languages (PHP,ASP,JSP,etc) Problems: 1.Linear document construction (printing string fragments to output stream) 2.No compile-time validation of the generated XML (according to a schema)

  3. Approaches to Statically Validate Dynamic XML • Main ideas: 1.Construction based on XML templates (sequences of XML trees • containing named gaps) • 2.Provide compile-time validation of transformed XML documents • An XML schema S describes a set L(S) of XML documents • An XML document X is valid with respect to an XML schema S iff X is in the set L(S) • For a program, verify at compile-time that given that • for each i. • Evolution: • bigwig- high-level C-based domain-specific programming language for developing • interactive Web services; HTML templates are first-class values that may be computed • and stored in variables; • JWIG - Java-based framework for Web service development; a flexible mechanism for • dynamic construction and validation of XML documents, in particular XHTML; • Xact – an extension of JWIG applied on general XML, supports also deconstruction of • XML documents; XML templates are first-class JAVA values;

  4. XML templates An XML template is a well-formed XML fragment with named gaps: <recipe number=[number]> <title><[title]></title> <ingredients><[list]></ingredients> <preparation> <[steps]></preparation> <[nutrition]> </recipe> • There are template gaps and attribute gaps. • Both templates and strings (or arrays of these) can be plugged into template gaps. • Only strings can be plugged into attribute gaps.

  5. ConstructionDeconstructionof XML Templates The plug operation: The select and gapify operations:

  6. Compile-time Output Validation Given an XML transformation T and an XML schema S, is it the case that whenever T outputs an XML document X, then X is valid with respect to S? • This is a hard problem • Practical solution – give approximate but safe (conservative) answers • Perform dataflow analysis using Summary Graphs (a set of XML template values • as nodes, and edges corresponding to possible plugging of gaps) The Program Analyzer • Construct summary graphs for each XML variable at each program point. The • set of summary graphs constitutes a finite lattice (suitable for dataflow analysis). • 2. Construct summary graphs from DTD schemas. • 3. Validate summary graphs (of output XML docs) against DTD schemas.  1. 2. Set of possible XML docs Set of valid XML docs 3.Validation!

  7. Example – no errors import dk.brics.xact.*; public class Hello { XML person = [[ <person><name>John Doe</name></person> ]]; XML html = [[<html> <head><title>Hello</title></head> <body bgcolor="red"> <h1>Hello <[name]></h1> </body> </html> ]]; public XML sayHello() { XML name = person.select("/person/name/text()")[0]; return html.plug("name", name); } public static void main(String[] args) { Hello hello = new Hello(); XML greeting = hello.sayHello(); greeting.analyze("xhtml1-transitional.dtd"); System.out.println(greeting); }} Output Code: <html> <head> <title>Hello</title> </head> <body bgcolor="red"> <h1>Hello John Doe</h1> </body> </html> Browser Output: Hello John Doe

  8. Example – invalid output import dk.brics.xact.*; public class Hello { XML person = [[ <person><name>John Doe</name></person> ]]; XML html = [[<html> <head><title>Hello</title></head> <body gbcolor="red"> <h1>Hello <[name]></h1> </body> </html> ]]; public XML sayHello() { XML name = person.select("/person/name/text()")[0]; return html.plug("name", name); } public static void main(String[] args) { Hello hello = new Hello(); XML greeting = hello.sayHello(); greeting.analyze("xhtml1-transitional.dtd"); System.out.println(greeting); }} Output Code: <html> <head> <title>Hello</title> </head> <body gbcolor="red"> <h1>Hello John Doe</h1> </body> </html> Browser Output: Hello John Doe The XACT analyzer reports the error! *** Invalid XML at line 26 XML template at line 8: attribute gap 'gbcolor' in element 'body' not declared

  9. Example – plug error import dk.brics.xact.*; public class Hello { XML person = [[ <person><name>John Doe</name></person> ]]; XML html = [[<html> <head><title>Hello</title></head> <body bgcolor="red"> <h1>Hello <[name]></h1> </body> </html> ]]; public XML sayHello() { XML name = person.select("/person/name/text()")[0]; return html.plug(“nema", name); } public static void main(String[] args) { Hello hello = new Hello(); XML greeting = hello.sayHello(); greeting.analyze("xhtml1-transitional.dtd"); System.out.println(greeting); }} Output Code: <html> <head> <title>Hello</title> </head> <body bgcolor="red"> <h1>Hello </h1> </body> </html> Browser Output: Hello The XACT analyzer reports the error! *** Inconsistent plug operation at line 20 Template gap 'nema' does not exist

More Related