Summary of the invention
The present invention provides a kind of structured document generation method and device, for solving manual sorting contribution in the prior art
Low efficiency existing for format, the high problem of error rate.
The first aspect of the invention is to provide a kind of structured document generation method, comprising:
Schema file is created, includes file structure and basic element type in the Schema file;
Create document template;
It is generated in the document template according to the file structure and the basic element type corresponding with style tags
Add-in button;
Document is created according to the document template;
Style tags are added within said document according to the add-in button;
Content is added within said document according to the style tags, generates structured document.
Another aspect of the present invention provides a kind of structured document generating means, comprising:
Creation module includes file structure and basic element class in the Schema file for creating Schema file
Type;
The creation module is also used to create document template;
Generation module, for being generated in the document template according to the file structure and the basic element type and
The corresponding add-in button of style tags;
The creation module is also used to create document according to the document template;
Adding module, for adding style tags within said document according to the add-in button;
The generation module is also used to add content within said document according to the style tags, generates structuring text
Shelves.
In the present invention, by according to the file structure and basic element type for including in Schema file in document template
Corresponding with style tags add-in button is generated, document is created according to the document template including add-in button, according to adding
It carries item button and adds style tags in a document, and add content in a document according to style tags, generate structured document, and
It does not need manually to arrange the format of document, improves the efficiency for generating structured document, reduce the structuring of generation
The error rate of document.
Specific embodiment
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention
In attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is
A part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art
Every other embodiment obtained without making creative work, shall fall within the protection scope of the present invention.
Fig. 1 is the flow chart of structured document generation method one embodiment provided by the invention, as shown in Figure 1, comprising:
101, Schema file is created, includes file structure and basic element type in Schema file.
Wherein, the executing subject of structured document generation method provided by the invention is structured document generating means.Knot
Structure document structure tree device, which is specifically as follows, to be stored in computer for generating the software or system of structured document.
Regular (Schema) is one group of set of rule defined to describe certain a kind of XML document, for one kind
XML document carries out constraining and determining its structure, and the file structure for including in Schema file and basic element type are structuring
Specification required by books or periodical that document structure tree device is published as needed is created.Schema file uses
W3c standard, the entitled XSD of suffix.XSD refers to that XML structure defines (XML Schemas Definition).File structure refers to
Positional relationship or ordinal relation between title, a piece, chapter, section in document etc. and title, a piece, chapter, section etc., basic element
Type may include: frame-generic element, pattern frame elements, title frame elements, in Reuse element and complex element
It is one or more.May include in above-mentioned various elements font, font, font size, whether overstriking, word space, paragraph alignment side
The parameters such as formula, line space.
Frame-generic element (ST_NormalFrameElement) refers to the ordinary node in document frame, that is, does not have
The node of any attribute.The program that frame-generic element is arranged is as follows:
Pattern frame elements (CT_StyleFrameElement) refer to thering is attribute in document frame, but are not titles
The node of element.The program that pattern frame elements are arranged is as follows:
Title frame elements (CT_TitleFrameElement) refer to showing that the element is title in document frame
Node, be arranged title frame elements program it is as follows:
Reuse element (CT_DuplicateFrameElement) refers in document frame, must according to title element
The element that must repeat is Reuse element, such as " piece " " chapter " " section " etc. in document.The journey of Reuse element is set
Sequence is as follows:
Complex element (CT_MixElement) refers to text element, from anywhere in can appearing in document.Mixing
All daughter elements under element are content element.The program that complex element is arranged is as follows:
102, document template is created.
103, add-in corresponding with style tags is generated in document template according to file structure and basic element type
Button.
Wherein, step 103 can specifically include: determine style type according to file structure and basic element type;According to
Style type generates add-in button corresponding with style tags in document template.
For example, can be to have according to the style type of level-one title and the determination of title frame elements in file structure
The level-one title of title frame elements, that is, have font, font, font size, whether overstriking, word space, paragraph alignment, in the ranks
Level-one title away from equal attributes.It can be as shown in Figure 2 according to the add-in button that style type generates.Style tags are pattern class
The specific manifestation form of type in a document, as shown in Figure 3.
It further, can also include: that Schema file is loaded into document template before step 103.
Wherein, program Schema file being loaded into document template are as follows:
104, document is created according to document template.
105, style tags are added according to add-in button in a document.
When structured document generating means generate load corresponding with style tags according to style type in document template
After item button, structured document generating means can add style tags in a document according to add-in button, as shown in Figure 3.
106, content is added in a document according to style tags, generate structured document.
Specifically, structured document generating means can write document in editable region according to style tags,
Generate structured document.
Content is added in a document according to style tags, after generating structured document, further includes:
Delete the style tags in structured document.
In addition, after structured document generating means delete the style tags in structured document, it can also be according to Schema
File verifies structured document.
In the present embodiment, by according to the file structure and basic element type for including in Schema file in document template
It is middle to generate add-in button corresponding with style tags, document is created according to including the document template of add-in button, according to
Add-in button adds style tags in a document, and adds content in a document according to style tags, generates structured document,
Without manually being arranged to the format of document, the efficiency for generating structured document is improved, the structure of generation is reduced
Change the error rate of document.
Those of ordinary skill in the art will appreciate that: realize that all or part of the steps of above-mentioned each method embodiment can lead to
The relevant hardware of program instruction is crossed to complete.Program above-mentioned can be stored in a computer readable storage medium.The journey
When being executed, execution includes the steps that above-mentioned each method embodiment to sequence;And storage medium above-mentioned include: ROM, RAM, magnetic disk or
The various media that can store program code such as person's CD.
Fig. 4 is the structural schematic diagram of structured document generating means one embodiment provided by the invention, as shown in figure 4,
Include:
Creation module 41 includes file structure and basic element type in Schema file for creating Schema file;
Creation module 41 is also used to create document template;
Generation module 42, for being generated in document template and style tags pair according to file structure and basic element type
The add-in button answered;
Creation module 41 is also used to create document according to document template;
Adding module 43, for adding style tags in a document according to add-in button;
Generation module 42 is also used to add content in a document according to style tags, generates structured document.
Wherein, basic element type includes: frame-generic element, pattern frame elements, title frame elements, Reuse
One of element and complex element are a variety of.
Further, generation module 42 generates and pattern mark according to file structure and basic element type in document template
It signs in corresponding add-in button, generation module 42 is specifically used for,
Style type is determined according to file structure and basic element type;
Add-in button corresponding with style tags is generated in document template according to style type.
Further, structured document generating means can also include: loading module;
Loading module is used for, generation module 42 according to file structure and basic element type generated in document template with
Before the corresponding add-in button of style tags, Schema file is loaded into document template.
Still further, structured document generating means can also include: removing module;
Removing module is used for, and generation module 42 adds content according to style tags in a document, generate structured document it
Afterwards, the style tags in structured document are deleted.
Wherein, after removing module deletes the style tags in structured document, structured document generating means can be with root
Structured document is verified according to Schema file.
In the present embodiment, by according to the file structure and basic element type for including in Schema file in document template
It is middle to generate add-in button corresponding with style tags, document is created according to including the document template of add-in button, according to
Add-in button adds style tags in a document, and adds content in a document according to style tags, generates structured document,
Without manually being arranged to the format of document, the efficiency for generating structured document is improved, the structure of generation is reduced
Change the error rate of document.
Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention., rather than its limitations;To the greatest extent
Pipe present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that: its according to
So be possible to modify the technical solutions described in the foregoing embodiments, or to some or all of the technical features into
Row equivalent replacement;And these are modified or replaceed, various embodiments of the present invention technology that it does not separate the essence of the corresponding technical solution
The range of scheme.