Summary of the invention
The invention provides a kind of structured document and generate method and apparatus, low for solving the efficiency that in prior art, manual sorting contribution form exists, the problem that error rate is high.
First aspect of the present invention is to provide a kind of structured document generation method, comprising:
Create Schema file, described Schema file comprises file structure and fundamental element type;
Create document template;
In described document template, the add-in button corresponding with style tags is generated according to described file structure and described fundamental element type;
Document is created according to described document template;
Style tags is added within said document according to described add-in button;
Content is added within said document, generating structured document according to described style tags.
Another aspect of the present invention provides a kind of structured document generating apparatus, comprising:
Creation module, for creating Schema file, described Schema file comprises file structure and fundamental element type;
Described creation module, also for creating document template;
Generation module, for generating the add-in button corresponding with style tags according to described file structure and described fundamental element type in described document template;
Described creation module, also for creating document according to described document template;
Add module, for adding style tags within said document according to described add-in button;
Described generation module, also for adding content within said document according to described style tags, generating structured document.
In the present invention, in document template, the add-in button corresponding with style tags is generated by the file structure that comprises according to Schema file and fundamental element type, document template according to comprising add-in button creates document, style tags is added in a document according to add-in button, and add content in a document according to style tags, generating structured document, and do not need manually to arrange the form of document, improve the efficiency of generating structured document, reduce the error rate of the structured document of generation.
Embodiment
For making the object of the embodiment of the present invention, technical scheme and advantage clearly, below in conjunction with the accompanying drawing in the embodiment of the present invention, technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.
Fig. 1 is the process flow diagram of a structured document generation method provided by the invention embodiment, as shown in Figure 1, comprising:
101, create Schema file, Schema file comprises file structure and fundamental element type.
Wherein, the executive agent of structured document generation method provided by the invention is structured document generating apparatus.Structured document generating apparatus is specifically as follows and is stored in computing machine for the software of generating structured document or system.
Rule (Schema) be one group in order to describe the set of rule that a certain class XML document defines, for retraining a class XML document and determining its structure, the books that the file structure that Schema file comprises and fundamental element type are published as required for structured document generating apparatus or the specification required by periodical carry out creating.Schema file adopts w3c standard, and suffix is called XSD.XSD refers to XML structure definition (XML Schemas Definition).File structure refers to title, a section, chapter, joint etc. in document, and position relationship between title, a section, chapter, joint etc. or ordinal relation, fundamental element type can comprise: frame-generic element, pattern frame elements, title frame elements, one or more in Reuse element and complex element.Font, font, font size, the whether parameter such as overstriking, word space, paragraph alignment, line space can be comprised in above-mentioned various element.
Frame-generic element (ST_NormalFrameElement) refers to the ordinary node in document framework, namely without any the node of attribute.The program arranging frame-generic element is as follows:
Pattern frame elements (CT_StyleFrameElement) refers in document framework has attribute, but is not the node of title element.The program arranging pattern frame elements is as follows:
Title frame elements (CT_TitleFrameElement) refers to and shows that this element is the node of title in document framework, and the program arranging title frame elements is as follows:
Reuse element (CT_DuplicateFrameElement) refers in document framework, is Reuse element according to the element that title element must repeat, such as, in document " section " " chapter " " joint " etc.The program arranging Reuse element is as follows:
Complex element (CT_MixElement) refers to text element, can occur in a document Anywhere.All daughter elements under complex element are content element.The program arranging complex element is as follows:
102, document template is created.
103, in document template, the add-in button corresponding with style tags is generated according to file structure and fundamental element type.
Wherein, step 103 specifically can comprise: according to file structure and fundamental element type determination style type; In document template, the add-in button corresponding with style tags is generated according to style type.
Such as, the style type determined according to the one-level title in file structure and title frame elements can for possessing the one-level title of title frame elements, namely possesses the one-level title of font, font, font size, the whether attribute such as overstriking, word space, paragraph alignment, line space.Can be as shown in Figure 2 according to the add-in button that style type generates.Style tags is style type concrete manifestation form in a document, as shown in Figure 3.
Further, before step 103, can also comprise: by Schema files loading in document template.
Wherein, by Schema files loading to the program in document template be:
104, document is created according to document template.
105, style tags is added in a document according to add-in button.
After structured document generating apparatus generates the add-in button corresponding with style tags according to style type in document template, structured document generating apparatus 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, generating structured document.
Particularly, structured document generating apparatus can write document by editing area according to style tags, generating structured document.
Add content in a document according to style tags, after generating structured document, also comprise:
Delete the style tags in structured document.
In addition, structured document generating apparatus can also be verified structured document according to Schema file after deleting the style tags in structured document.
In the present embodiment, in document template, the add-in button corresponding with style tags is generated by the file structure that comprises according to Schema file and fundamental element type, document template according to comprising add-in button creates document, style tags is added in a document according to add-in button, and add content in a document according to style tags, generating structured document, and do not need manually to arrange the form of document, improve the efficiency of generating structured document, reduce the error rate of the structured document of generation.
One of ordinary skill in the art will appreciate that: all or part of step realizing above-mentioned each embodiment of the method can have been come by the hardware that programmed instruction is relevant.Aforesaid program can be stored in a computer read/write memory medium.This program, when performing, performs the step comprising above-mentioned each embodiment of the method; And aforesaid storage medium comprises: ROM, RAM, magnetic disc or CD etc. various can be program code stored medium.
Fig. 4 is the structural representation of a structured document generating apparatus provided by the invention embodiment, as shown in Figure 4, comprising:
Creation module 41, for creating Schema file, Schema file comprises file structure and fundamental element type;
Creation module 41, also for creating document template;
Generation module 42, for generating the add-in button corresponding with style tags according to file structure and fundamental element type in document template;
Creation module 41, also for creating document according to document template;
Add module 43, for adding style tags in a document according to add-in button;
Generation module 42, also for adding content in a document according to style tags, generating structured document.
Wherein, fundamental element type comprises: frame-generic element, pattern frame elements, title frame elements, one or more in Reuse element and complex element.
Further, generation module 42 generates in the add-in button corresponding with style tags according to file structure and fundamental element type in document template, generation module 42 specifically for,
According to file structure and fundamental element type determination style type;
In document template, the add-in button corresponding with style tags is generated according to style type.
Further, structured document generating apparatus can also comprise: load-on module;
Load-on module is used for, before generation module 42 generates the add-in button corresponding with style tags according to file structure and fundamental element type in document template, by Schema files loading in document template.
Again further, structured document generating apparatus can also comprise: removing module;
Removing module is used for, and generation module 42 adds content in a document according to style tags, after generating structured document, deletes the style tags in structured document.
Wherein, after removing module deletes the style tags in structured document, structured document generating apparatus can also be verified structured document according to Schema file.
In the present embodiment, in document template, the add-in button corresponding with style tags is generated by the file structure that comprises according to Schema file and fundamental element type, document template according to comprising add-in button creates document, style tags is added in a document according to add-in button, and add content in a document according to style tags, generating structured document, and do not need manually to arrange the form of document, improve the efficiency of generating structured document, reduce the error rate of the structured document of generation.
Last it is noted that above each embodiment is only in order to illustrate technical scheme of the present invention, be not intended to limit; Although with reference to foregoing embodiments to invention has been detailed description, those of ordinary skill in the art is to be understood that: it still can be modified to the technical scheme described in foregoing embodiments, or carries out equivalent replacement to wherein some or all of technical characteristic; And these amendments or replacement, do not make the essence of appropriate technical solution depart from the scope of various embodiments of the present invention technical scheme.