The path to java siege lions-review xml & dom_pull programming, java siege lions xml

Source: Internet
Author: User
Tags file url

The path to java siege lions -- Review xml & dom_pull programming and java siege lions xml


Xml & dom_pull programming:

1. Remove the welcome window: Enter "configuration center" in the preferences option of the window item to find this item and
Check the check box.

2. Remove the pop-up when Myeclipse is opened: Please allow Subclipse team to receive ...... method:

Windows --> Preferences --> General --> Startup and Shutdown --> deselect the Subclipse Usage Reporting check box.

1. Configure workspace-do not use a directory containing spaces or Chinese Characters
All codes are saved in the workspace.
2. When creating a project, set the project to a jre Environment
MyEclipse provides a variety of built-in layout-different layout interfaces and different menus
Project Properties
Dataset set --- when importing other projects, note that the encoding types are consistent.
Set the classpath location in java build path and specify the class library introduced by the current project
Specifies the storage location of. java and. class files in source.
Librialies specifies the class library referenced by the current project
Java Compiler specifies the version used by. java to compile the. class file ----- the Compiler version
When the jre version is earlier than the compiler version: Bad version number in. class file

3. Grouping working set for existing projects
Hide unnecessary projects by grouping

4. Shortcut Keys
Alt +/Content Assist template key --- quickly complete the code ---- windows preferences java editor templates
Ctrl + 1 Quick Fix provides code modification suggestions
* Use alt +/do not respond to modify the shortcut key to set window preference general --- keys
* Format the windows preference java-editor-save actions when saving the code.

Program debugging
Core Competence of java Programmers-code Debug capability
1. When an error occurs in the Code --- view the error message --- locate the error location
* Find the program you wrote in the first line from top to bottom.
2. Guess the cause of the Error Based on experience
Use sysout or log technology to print key data information to the console
Use the built-in breakpoint debugging function of Eclipse to view critical location data ----- breakpoint debugging Break Point ----- the program runs through Debug
* F5 and F7 are used together. You can view the specific code to implement F6. directly jump to the next line of the Code.
F3 View class code
F4 View class inheritance relationships

Code testing ----- testing: white box testing and black box testing
White box test code structure and logic (visible code test), black box test code function and performance (invisible code test)
* Limitations of white box Testing 1. white box testing cannot test all code 2. It is difficult to test white box testing-white box testing is handed over to software development engineers for testing.
A standalone test is a white-box test. It tests the code function module and a single function of the Code.

Junit is a java standalone testing technology.
1. Compile junit to reference the junit class library in the project.
2. Compile a single test case
* Create a public void method without parameters and add the @ Test annotation before the method.
3. Each test method is equivalent to writing the main function. Each test method can be executed independently.

When there are many methods for testing using junit, each method outputs content to the console, and people cannot manually check the content.
* Automated result check-Assert
Assertion principle: Call A method. Before calling a method, prepare test data and test data running results ---- compare the actual results with the expected results

* When writing a standalone test, do not test the correct data and results, and test the incorrect data (invalid data)

XML technology: data-related technologies are commonly used in enterprises to store and transmit data. The popular reason is that xml is irrelevant to any programming language.
Xml can be used in php, java, and. net programming languages.
* Tag data

What is a markup language?
<Xxx> aaa </xxx> typical Markup Language HTML ---- use tags to Modify text information

Arbitrary definition of XML tags-extensible
Typical XML storage and transmission applications:
1. XML acts as a database to save data information-questions are saved in xml, and google data is saved in xml format
2. xml
Many tags are pre-defined in HTML. Each tag has a corresponding display effect. All tags in xml are not predefined.
In xml, <name> HLG </name> ---- to determine the meaning of the name tag, you must add constraints to xml.

XML syntax
1. Document declaration
2. Elements
3. Attributes
4. Notes
5. CDATA Block
6. processing commands

Any xml file must have a document declaration <? Xml version = "1.0"?>

XML is a markup language used to store and transmit data-to save data content.
Xml collation set not specified-ISO-8859-1 encoding by default (Chinese data not supported)
* Note: when encoding = "UTF-8" is specified in xml, the browser must view the dataset. the browser must view the dataset consistent with the saved dataset.
* The New Notepad program uses the default notepad set --- the default notepad set gbk ---- use UTF-8 encoding and save it

When standalone = "yes" is declared as an independent xml file, standalone = "no" depends on some external files.

XML describes complex relational model data through elements

Xml syntax Specification
1. All xml elements must end
<Abc> </abc> ----- in an xml file, if the tag contains no content, it is automatically ended. <abc/>
2. labels cannot be cross-nested.
3. There is only one root element.
4. the space and line feed in the xml file will be parsed by the parser.
5. It is case-sensitive. element and attribute names cannot start with numbers.

Property definition syntax <element name property name = "property value" property name = "property value"...>
One element defines multiple attributes. Each attribute value must use single quotation marks and double quotation marks.
6. attribute values must be enclosed in single or double quotation marks.
7. xml and html annotations are the same <! --> Annotations cannot be nested.

Content not parsed by the parser is retained in the CDATA area-special code is usually stored, which causes xml format confusion.
What are the use cases of CDATA and escape characters? Difference?
* The cdata xml technology is preferred for data storage, data transmission, and data parsing.

8,Control the xml display style using PI commands(There cannot be comments before instructions)
When xml uses the pi command to reference CSS, the effect is equivalent to HTML for page data display.
* Display data using xml, and modify xml data display using XSLT (similar to CSS)

XML technology applications
1. data transmission and storage-programmers do not use the constraint Technology for simplified development.
* The xml format is incorrect because xml constraint technology is not used.
* All xml data content is generated and parsed by a program.
2. Use xml as the configuration file
Android SSH-to ensure the accuracy of xml elements, programmers usually use the constraint Technology in xml documents.

What xml use constraints? Constraint xml document-more standard element content format
If xml in the enterprise does not use constraints ------ When xml is generated through a program and xml is parsed, no constraints are used, and the code is simpler

XML constraint technology DTD and Schema

DTD Quick Start
1. Write Data xml --- books. xml
2. Write a dtd file
* For each element of the document (different names) <! ELEMENT
Syntax <! ELEMENT name child ELEMENT>
Element internal text # PCDATA
3. Associate an xml file with a dtd file

<? Xml version = "1.0" encoding = "UTF-8"?> <? Xml-stylesheet type = "text/css" href = "1.css"?> <! DOCTYPE books SYSTEM "books. dtd "> <books> <book> <name> java Programming ideology </name> <price> 30.0 </price> </book> </books>Books. xml <? Xml version = "1.0" encoding = "UTF-8"?> <! ELEMENT books> <! ELEMENT book (name, price)> <! ELEMENT name (# PCDATA)> <! ELEMENT price (# PCDATA)>Books. dtd @ CHARSET "UTF-8"; name {color: red ;}1. css


Three methods of association between DTD and xml
1. Internal DTD ----- syntax <! DOCTYPE root element []>
2. External DTD (reference local DTD) ----- syntax <! DOCTYPE root element SYSTEM "Local DTD file location">
3. Public DTD (Reference Network DTD) <! DOCTYPE document root node PUBLIC "DTD name" "DTD file URL">
* The Public DTD uses the name specified by the W3C standard official organization.

ELEMENT Definition
* Content features are in line with the meaning
() Sub-elements and groups
, Representing the subelement order
+ *? ---- Regular Expressions + 1 to multiple, * any (0 to multiple ),? 0 or 1
| Select one more

Special Element Content: text content # If PCDATA sub-element content is EMPTY, EMPTY

Attribute (ATTLIST) Definition
Syntax: <! ATTLIST element name attribute list>
Attribute list:
Attribute name type constraints
Attribute name type constraints
Attribute name type constraints
Attribute name type constraints

Attribute type
1. CDATA text type attribute
2. (value 1 | value 2 | value 3) select one of the three values.
3. ID indicates that the property value is unique.

1. # required REQUIERD attributes
2. # optional IMPLIED attributes
3. fixed value attribute values
4. default Value

ENTITY Definition
If the xml data content is repeated, the entity can be extracted.
Syntax: <! ENTITY name "ENTITY content">

========================================================== ==============

XML Schema is developed using a set of predefined elements and attributes.
----- Pre-defined elements and attributes define the schema structure and content
----- Define schema to specify the xml document format and content

Element and attribute defined in advance ------ define schema ------- define xml instance

The Schema itself is also xml, unlike the single syntax used by the DTD

Bind the elements defined in the schema to the URI address (namespace) to uniquely identify the schema from which the element comes.

* Why is there a namespace? An xml instance references multiple schemas. When two schemas define elements with the same name,
To distinguish the document from which an element of the same name is referenced.

Schema Quick Start
1. Compile a data xml file
2. Compile the schema file. xsd
1) Introduce W3C namespace xmlns = ""
Each element corresponds to <element>
Distinguish between complex elements and simple elements
2) Specify the namespace URI for the schema definition element (URI can be any path)
3. reference the custom Schema in the xml instance data file

ElementFormDefault = "unqualified"
1. If schema uses elementFormDefault = "unqualified", the xml instance document must reference the namespace using the prefix ---- prefix to modify the root element.
2. The prefix cannot be used for all child elements of the current xml instance document.

Namespace function --- uniquely identifies the elements defined in the schema

Simple elements directly write type attributes and complex elements <complexType>

<? Xml version = "1.0" encoding = "UTF-8"?> <Schema xmlns = "" xmlns: xsi = "" xsi: schemaLocation = " books. xsd "> <books> <book> <name> think in java </name> <price> 100 </price> </book> </books> </schema>Books. xml <? Xml version = "1.0" encoding = "UTF-8"?> <Schema xmlns = "" targetNamespace = "" elementFormDefault = "qualified"> <element name = "books"> <complexType> <sequence> <element name = "book"> <complexType> <sequence> <element name = "name" type = "string"> </element> <element name = "price" type = "int"> </element> </sequence> </complexType> </element> </schema>Books. xsd


If there are multiple identical elements, write their own schema separately, as shown below:

<? Xml version = "1.0" encoding = "UTF-8"?> <Company xmlns = "" xmlns: dept = "" xmlns: xsi = "" xsi: schemaLocation = " company. xsd department. xsd "> <employee> <dept: name> think in java </dept: name> <name> 12306 </name> </employee> </company>Company. xml <? Xml version = "1.0" encoding = "UTF-8"?> <Schema xmlns = "" targetNamespace = "" xmlns: tns = "" elementFormDefault = "qualified"> <element name = "company"> <complexType> <sequence> <element name = "employee"> <complexType> <sequence> <any> </any> <element name = "name" type = "int"> </element> </sequence> </complexType> </element> </sequence> </complexType> </element> </schema>Company. xsd <? Xml version = "1.0" encoding = "UTF-8"?> <Schema xmlns = "" targetNamespace = "" xmlns: tns = "" elementFormDefault = "qualified"> <element name = "name" type = "string"> </element> </schema>Department. xsd


Questions for java engineers?

If I have been working for a year, I will ask you what projects you have previously worked on. I will ask you to talk about the projects you have worked on. The most important thing is the basic knowledge of java and the ssh framework.

How can I change an internal xml file in a java project?

Your package path is incorrect
Com. app. res. hibernate. cfg. xml

This. getClass (). getClassLoader (). getResource ("
Com/app/res/hibernate/cfg. xml"
). GetPath ()

Contact Us

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: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.