XML (Understanding) XML introduces Extensible Markup Language, and tags like HTML XML can be customized to the purpose: the role of storing data xml:1. Exchanging Data--between different languages2. configuration file--the most common ☆ writing specification for project development and framework XML must have a root element (only one) XML tag must have a close tag XML tag attribute to case sensitive XML must be quoted special characters must be escaped > < & SpaceEnterThe tab characters in the XML are all text node XML must be properly nested we will conform to the above writing rules of XML called well-formed XML document Composition declaration: function: Tell the computer I am an XML file, Format:<?xml version= ' 1.0 ' encoding= ' utf-8 '?>Note: The first line of the XML document must be shelf write elements: Format:<xxx></xxx> <xxx/>Note: XML elements must adhere to the following naming conventions: Names can contain letters, numbers, and other character names that cannot be numerically or Dot symbol Start name cannot be a character"XML"(or XML, XML) Start name cannot contain spaces can use any name, there is no reserved term attribute: format: <xxx key= ' value '/>Note: Attribute values must be quoted in quotation marks: As with HTML<!---->CDATA: Output The format as it is on the page:<![cdata[content as-is output]]>XML constraints: The role of Constraints: to specify which elements and attributes can appear in an XML document, and to specify their order of appearance, the classification of constraints: DTD constraint: Struts hibernate Schema constraint: Spring DTD constraint: DTD and XML Association: Three Kinds: Internal association: Format:<! DOCTYPE root element [syntax]>External Association--System Associations: Formatting: Writing in XML<! DOCTYPE root element SYSTEM "DTD path" >External Association--Common associative formats: writing in XML<! DOCTYPE root element Public "DTD name", "DTD path" >Note: The suffix of the DTD file is composed of the. DTD DTD: element: Format 1:<! element name (content) >Format 2:<! Element name Category >Category: The text node of #PCDATA element is a string and cannot appear when the element is used () to cause a symbol: *: Number of occurrences >=0 +: Number of occurrences >=1?: Number of Occurrences 0|1 |: or (): Grouping,: Order Properties: Format: <! Attlist element Name Property Name property type default Value >type of property: ID: Unique CDATA: string default value: #RUQUIRED: Property must appear #IMPLIED: attribute optional schema constraint: An XML can have multiple schema constraints, But one XML can only appear with one DTD constraint suffix name. xsd a.xsd table width height b.xsd table row Co In an XML document, if this is the case, it can be resolved through the namespace. Namespace notation: xmlns= ' AAA '--refers to a.xsd xmlns: aliases= ' BBB '--refers to b.xsd for example: Xmlns:b= ' BBB ' <table>represents from the A.xsd file<b:table>represented by the b.xsd file Note: There can only be one namespace with no aliases. Role: Determines the constraints of an element from which constraint documents and XML files are associated:1. Write an XSD file. The XSD file is also an XML file, except for the suffix named. xsd targetnamespace= "HTTP://WWW.EXAMPLE.ORG/B1"--give your own constraint file a name that facilitates the use of XML files. Note: The name can be customized using a unique, domain name/Customizing the content targetnamespace= "Http://www.example.com/taotao"determine again which root element is2writing XML based on XSD first writes the root element and then adds the parsing of the constraint XML: Common parsing: DOM: Loading an XML document into In-memory, forming a tree that can perform crud operations on nodes SAX: line-by-row parsing. Use only for R operations. High query efficiency commonly used analytic technology: JAXP (SUN) JDOM dom4j pull XStream Focus: dom4j query operation using the steps:1. Import the jar package (unzip the ZIP package into the project to import dom4j-1.6.1. Jar)2. XML read to memory Saxreader reader=NewSaxreader (); Dodument Doc=reader.read (XML file path); 3. Get the root node Element Rootele first=doc.getrootelement (); 4a common way to get other nodes through the root node: List<Element> booklist=rootele.elements (); Iterate through the list to get to each of the Bookele String value=bookele.attributevalue ("category"); String text=booele.elementtext ("Author"); Get child elements element title=bookele.element ("title"); Extension method (Understanding) Iterator<Element> I=rootele.elementiterator (); --gets the other nodes for each child node: property: String Value=book.attribure ("category"). GetValue (); Text: String text=book.element ("title"). GetText (); The XPath query operation uses the steps:1. Import the jar package (dom4j jar and jaxme-api-0.3. Jar)2. Get Document Dodument Doc=NewSaxreader (). Read (XML path); 3. You can get other nodes by matching expressions common methods: List selectnodes (match expression): Returns multiple element Selec Tsinglenode (Match expression): Returns the related concept of the first Tomcat (☆) Web: Web: Word: Network resource Category: Web resource Static Web resources: Content does not change the resources of the Dynamic Web resources: Content may change the development technology of resource resources: Static development technology: HTML CSS Dynamic Development technology: The architecture of the servlet JSP software: C/s: Client and Server For example: QQ FEIQ b/s: Browser and Server for example: Web Game Web page QQ Web communication based on request response mechanism. Common Web servers: servers: Hardware servers and software servers common Web servers: Server name Company features WebLogic Oracle Large toll Web server, support Java EE all specifications WebSphere IBM Large toll Web server, support Java EE all specifications Tomcat APAC He small and medium-sized free web server, support servlet and JSP specification Download: Apache Install: Unzip zip file run: D:\apache-tomcat-7.0.77\bin\startup.bat Double-click Test: localhost:8080browser appears Tom Cat FAQ: Java_home Configure Port Conflicts: a) Modify the Conf folder in the Tomcat installation directory Server.xml /c2><connector port= "8080" protocol= "http/1.1"ConnectionTimeout= "20000"Redirectport= "8443" usebodyencodingforuri= "true" iencoding= "Utf-8" uriencoding= "UTF-8"/>Sometimes, the port will be changed to B) in the CMD open window input netstat-AoV off: Mode 1: Close cmd Window mode 2: Execute command shutdown.bat mode 3:ctrl+C TOMCAT Directory structure: Bin: directory where executable programs are stored conf: directory for the configuration file lib: The jar package required to store the Tomcat run and the project run logs: storage Directory of log files, main view Catalina temp: Temporary files webapps:☆ the directory where the project is stored work:☆jsp the Java file and bytecode file Web project directory structure generated by the runtime: MyWeb (catalogue)| |---web-INF (directory: not accessible through a browser, but can be accessed through a Java program.) ) | | | |--lib (directory: the jar package used to store the project)| |--Classes (Directory: The class file that holds the Java file)| |--Web. XML (file, project core configuration file)| |---HTML js CSS|Web project Deployment (Publish Project): Also called virtual directory Mapping mode 1. Put the project in Tomcat/WebApps (most commonly used) mode 2. Modify Tomcat/conf/server.xml Add the following code (not recommended) under the host tag of 125 rows or so<context path= "/project Name" docbase= "Project Path"/>For example:<context path= "/my" docbase= "D:/myweb"/>access path: localhost:8080/Project name/resources such as: localhost:8080/my/html/1. HTML mode 3. In Tomcat/conf/catalina/a new XML file under localhost, the name of the file is the project name first write the XML file, add the following code<context docbase= "path to Project"/>For example:<context docbase= "D:/myweb"/>file name is called M.xml access path: localhost:8080/m/html/1. HTML tomcat and Eclipse Integrated War package: Features: Tomcat can automatically unzip the war package suffix name:. War Package Mode 1: Through Eclipse Mode 2: Entry directory, select all files, add to compressed file, select Zip format, change the suffix name to. War Package Mode 3: Enter the project directory in CMD and run the jar-CVF name. War */http (understanding) Hypertext Transfer Protocol. Default port for HTTP protocol:80HTTP is a stateless protocol. Request: The browser is sent to the server component: Request line request Header Request line: The first line of request Information Format: Request for the resource path protocol/Version Example: GET/javaee_day08/1.html http/1.1Request Header: Format: Key:value key: Cookie Referer (anti-theft chain) IF-modified-since accept-Encoding Request Body: There is a blank line before the request header only the request body get:localhost the POST request/web?username=zhangsan&password=1234Post:localhost/the Web request body will appear: Username=zhangsan&password=1234response: The server returns the browser component: Response line Response Header Response Line: Response information First line format: protocol/description of the version status Code status code example: HTTP/1.1 200OK Status code: 1XX: Processing 2xx: Response success 3xx: Further processing is required for the common 3 XX:302: Jump304: No modification, read cache 4xx: Client operation error Common 404:5xx: Server error common 500 (code error ) Response Header: Format: Key:value Focus: Set-Cookie Location: Jump Direction Content-Type Refresh: Refresh Content-Disposition: Upload Download response body: There is a line between the response body and the response header is the content of the page to display
1.xml http