CN104361055B - A kind of method and system of parsing Apache configuration files - Google Patents

A kind of method and system of parsing Apache configuration files Download PDF

Info

Publication number
CN104361055B
CN104361055B CN201410605645.8A CN201410605645A CN104361055B CN 104361055 B CN104361055 B CN 104361055B CN 201410605645 A CN201410605645 A CN 201410605645A CN 104361055 B CN104361055 B CN 104361055B
Authority
CN
China
Prior art keywords
node
character
leaf
content
angle brackets
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201410605645.8A
Other languages
Chinese (zh)
Other versions
CN104361055A (en
Inventor
厉颖
高隆林
车帅
翟鲁超
何忠胜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
CVIC Software Engineering Co Ltd
Original Assignee
CVIC Software Engineering Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by CVIC Software Engineering Co Ltd filed Critical CVIC Software Engineering Co Ltd
Priority to CN201410605645.8A priority Critical patent/CN104361055B/en
Publication of CN104361055A publication Critical patent/CN104361055A/en
Application granted granted Critical
Publication of CN104361055B publication Critical patent/CN104361055B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/252Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present invention discloses a kind of method and system of parsing Apache configuration files.This method includes:Obtain Apache configuration files;The first character in configuration file is recognized line by line;Whether be left angle brackets, obtain the first judged result if judging first character;It is the first non-leaf nodes by the content-label after left angle brackets when the first judged result is to be;To be leaf node comprising the content-label after the first character including first character when the first judged result is no;First non-leaf nodes and leaf node are recorded in node listing.Using the method or system of the present invention, the configuration file of the formatting in Apache can both be parsed, the nonformat file in Apache can also be parsed.

Description

A kind of method and system of parsing Apache configuration files
Technical field
The present invention relates to data processing field, more particularly to a kind of method and system of parsing Apache configuration files.
Background technology
Apache is that the world uses the web server software ranked the first.It may operate in nearly all widely use Computer platform on, be most popular Web server end software because its cross-platform and security is widely used.
At present, the load equalizer using Apache as application server turns into main flow.Due to matching somebody with somebody to Apache Put when file is configured, it is necessary to change the distinctive configuration files of Apache, such as httpd.conf files and Work.properties files.Wherein, the form of the content in work.properties files is mainly key name=key assignments.This The configuration file for planting form is also referred to as the configuration file formatted.For the configuration file of formatting, it can use in java and read The mode of file stream is taken to be parsed.And for the configuration file of the unformatteds such as httpd.conf files, then before can not using The mode of stating is parsed.
The content of the invention
, both can be in Apache it is an object of the invention to provide a kind of method and system of parsing Apache configuration files The configuration file of formatting parsed, the nonformat file in Apache can also be parsed.
To achieve the above object, the invention provides following scheme:
A kind of method of parsing Apache configuration files, including:
Obtain Apache configuration files;
The first character in the configuration file is recognized line by line;
Whether be left angle brackets, obtain the first judged result if judging the first character;
When it is left angle brackets that first judged result, which represents the first character, in after the left angle brackets Hold and be labeled as the first non-leaf nodes;Search and whether there is right point corresponding with the left angle brackets after the left angle brackets and include Number, obtain the first lookup result;When first lookup result represents to find the right angle bracket, included for the left point Initial character in node number between the right angle bracket, judges whether initial character is left angle brackets in the node, obtains Two judged results;
When second judged result represents that initial character is left angle brackets in the node, by described in left angle brackets Content-label in node after initial character is the second non-leaf nodes;Search in the node whether there is after initial character with The corresponding right angle bracket of initial character in the node, obtains the second lookup result;When second lookup result represents to find During right angle bracket corresponding with initial character in the node, continue to recognize the content in second non-leaf nodes, until knowing Do not go out leaf node or terminate current process;When second lookup result represents not find and initial character pair in the node During the right angle bracket answered, terminate current process;When first lookup result represents not find the right angle bracket, terminate Current process;
When it is not left angle brackets that first judged result, which represents the first character, it will exist comprising the first character Content-label after the interior first character is leaf node;
First non-leaf nodes and the leaf node are recorded in node listing.
Optionally, it is described to record first non-leaf nodes and the leaf node in node listing, specific bag Include:
By position of first non-leaf nodes in the configuration file and the mark of first non-leaf nodes Record is in the node listing;
By the identification record of position of the leaf node in the configuration file and the leaf node in the section In point list.
Optionally, it is described first non-leaf nodes and the leaf node are recorded in node listing after, also Including:
Obtaining current page needs the identification information of node of displaying;The node is leaf node and/or non-leaf section Point;
The mark represented according to the identification information, determines the corresponding leaf node of the mark in the node listing Position in the configuration file;
By the content displaying of the position in the current page.
Optionally, the content displaying by the position is after the current page, in addition to:
User is obtained to operate for the modification of the content of the position in the current page;
The content of the amended position is stored in the configuration file.
A kind of system of parsing Apache configuration files, including:
Configuration file acquiring unit, for obtaining Apache configuration files;
Character recognition unit, for recognizing the first character in the configuration file line by line;
First judging unit, for judging whether the first character is left angle brackets, obtains the first judged result;
First resolution unit, for when it is left angle brackets that first judged result, which represents the first character, by institute It is the first non-leaf nodes to state the content-label after left angle brackets;Search and whether there is and the left side after the left angle brackets The corresponding right angle bracket of angle brackets, obtains the first lookup result;When first lookup result represents that finding the right point includes Number when, continue to recognize the content in first non-leaf nodes, until identifying leaf node or terminating current process;Work as institute When stating the first lookup result and representing not find the right angle bracket, terminate current process;
First resolution unit includes the first judgment sub-unit and the first parsing subelement, wherein:
First judgment sub-unit, for for lead-in in the node between the left angle brackets and the right angle bracket Symbol, judges that whether initial character is left angle brackets in the node, obtains the second judged result;
The first parsing subelement, for representing that initial character is that left point is included in the node when second judged result Number when, be the second non-leaf nodes by the content-label after initial character in the node for left angle brackets;Search the section It whether there is right angle bracket corresponding with initial character in the node in point after initial character, obtain the second lookup result;Work as institute When stating the second lookup result and representing to find right angle bracket corresponding with initial character in the node, continue to recognize that described second is non- Content in leaf node, until identifying leaf node or terminating current process;When second lookup result represents not look into When finding right angle bracket corresponding with initial character in the node, terminate current process;
Second resolution unit, for when it is not left angle brackets that first judged result, which represents the first character, inciting somebody to action It is leaf node comprising the content-label after the first character including the first character;
Recording unit, for first non-leaf nodes and the leaf node to be recorded in node listing.
Optionally, the recording unit, is specifically included:
Subelement is recorded, for by position of first non-leaf nodes in the configuration file and described first non- The identification record of leaf node is in the node listing;By position of the leaf node in the configuration file and described The identification record of leaf node is in the node listing.
Optionally, in addition to:
Identification information obtaining unit, is recorded in node listing for first non-leaf nodes and the leaf node Afterwards, the identification information that current page needs the node of displaying is obtained;The node is leaf node and/or non-leaf nodes;;
Node location determining unit, for the mark represented according to the identification information, is determined in the node listing The position that corresponding node is identified in the configuration file;
Page presentation unit, for by the content displaying of the position in the current page.
Optionally, in addition to:
Modification operation acquiring unit, for after the current page, the content displaying of the position to be obtained into user Operated in the current page for the modification of the content of the position;
Storage unit, for the content of the amended position to be stored in the configuration file.
The specific embodiment provided according to the present invention, the invention discloses following technique effect:
The method and system of parsing Apache configuration files in the embodiment of the present invention, due to by recognizing described match somebody with somebody line by line Put the first character in file;Whether be left angle brackets, if it is, by after the left angle brackets if judging the first character Content-label be the first non-leaf nodes;Otherwise, by comprising in after the first character including the first character Hold and be labeled as leaf node;Nonformat file in Apache can be parsed, again can be to the formatting in Apache Configuration file parsed.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to institute in embodiment The accompanying drawing needed to use is briefly described, it should be apparent that, drawings in the following description are only some implementations of the present invention Example, for those of ordinary skill in the art, without having to pay creative labor, can also be according to these accompanying drawings Obtain other accompanying drawings.
Fig. 1 is the flow chart of the embodiment of the method 1 of the parsing Apache configuration files of the present invention;
Fig. 2 is the flow chart of the embodiment of the method 2 of the parsing Apache configuration files of the present invention;
Fig. 3 is the flow chart of the embodiment of the method 3 of the parsing Apache configuration files of the present invention;
Fig. 4 is the structure chart of the system embodiment of the parsing Apache configuration files of the present invention.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete Site preparation is described, it is clear that described embodiment is only a part of embodiment of the invention, rather than whole embodiments.It is based on Embodiment in the present invention, it is every other that those of ordinary skill in the art are obtained under the premise of creative work is not made Embodiment, belongs to the scope of protection of the invention.
For the ease of understanding the present invention, the application scenarios of the present invention are illustrated below.
After a main frame is deployed web applications, with the increase of application client number, the master will certainly be caused The access pressure of the carrying of machine is excessive.Pressure is accessed to alleviate, mainframe cluster can be built, front end load is used as using Apache Balanced device, other application server node of the distributing portion visit capacity into mainframe cluster.Specifically, this can deployed The main frame of web applications does not dispose installation Apache softwares on the main frame that the web is applied.Apache main frame is being installed On, the visit capacity for the main frame that web applications are deployed to access by Apache load-balancing function is divided Stream, the other application server node that the visit capacity for a main frame is branched in mainframe cluster.
In practical application, before Apache progress load balancing, it is necessary first to which Apache configuration file is carried out Configuration, enables Apache softwares to clearly require which other main frame the access for which main frame is diverted to, wherein also wrapping Include the setting for the details parameter during load balancing.
In the prior art for the configuration process of Apache configuration files, mainly by the word in Apache configuration file Symbol information is integrally read out, then by the substantial amounts of character of user manual read, it is determined that the position of the content to be changed, is repaiied manually Change.Because the reading for configuration file needs to have certain professional, it is necessary to have the user of certain experiences to Apache It can operate.It is careless slightly to may result in configuration error which increase the difficulty that user is configured.
In addition, being directed to specific text-string in httpd.conf files in the industry, although also develop some parsing sides Method, such as matched line by line by the character string in ProxyPass.But these methods, it is impossible to in httpd.conf files All characters are parsed, therefore without versatility.
The present invention is mainly the desire to provide a kind of general analytic method for Apache configuration files, can parse non-lattice The configuration file of formula, can also parse the configuration file of unformatted, and then can aid in user and enter for configuration file Row modification.
In order to facilitate the understanding of the purposes, features and advantages of the present invention, it is below in conjunction with the accompanying drawings and specific real Applying mode, the present invention is further detailed explanation.
Fig. 1 is the flow chart of the embodiment of the method 1 of the parsing Apache configuration files of the present invention.As shown in figure 1, this method It can include:
Step 101:Obtain Apache configuration files;
The store path of the configuration file, the routing information that can be inputted by user is obtained.Specifically to institute State before configuration file configured, can be selected carry the path of Apache server by user, further by user Select storage location of the configuration file on the server.
Step 102:The first character in the configuration file is recognized line by line;
The configuration file, if opened with txt forms, can generally be shown as substantial amounts of character.Can be to every First character in a line is identified.
Step 103:Whether be left angle brackets, obtain the first judged result if judging the first character;
The left angle brackets, be specifically as follows "<" (symbol i.e. between double quotation marks).Because Apache configuration file In, if certain section of content is nested structure, the content being nested in this section of content needs to be marked using angle brackets, i.e. quilt Nested content be usually located at "<" with ">" between.More specifically, the left angle brackets can be<proxy>The word of this form Left angle brackets in symbol string, in a particular application, proxy back therein can also have the word for being used for describing other attributes Symbol.The right angle bracket can be</proxy>Right angle bracket in the character string of this form,<proxy>With</proxy> It is typically what is used in pairs in Apache configuration files.Now,<proxy>With</proxy>Between content be to be nested Content.
When the first character is left angle brackets, represent that there is nested content behind left angle brackets, it is possible to will Content-label after the left angle brackets is the first non-leaf nodes;When the non-left angle brackets of the first character, institute is represented State behind first character without nested content, it is possible to by the content-label after the first character be leaf section Point.
Wherein, leaf node and non-leaf nodes are the concepts among discrete mathematics.There is no child node among one tree (i.e. Spend for node 0), referred to as leafy node, abbreviation " leaf ".Leaf degree of referring to is 0 node, also known as terminal node.N omicronn-leaf Child node represents also there is other nodes under the non-leaf nodes.
Step 104:When it is left angle brackets that first judged result, which represents the first character, by the left angle brackets Content-label afterwards is the first non-leaf nodes;Search after the left angle brackets with the presence or absence of corresponding with the left angle brackets Right angle bracket, obtain the first lookup result;When first lookup result represents to find the right angle bracket, continue to know Content in not described first non-leaf nodes, until identifying leaf node or terminating current process;When the described first lookup When as a result representing not find the right angle bracket, terminate current process;
, wherein it is desired to which explanation, the right angle bracket corresponding with the left angle brackets, can refer to that the left point is included In content behind number, the word between first right angle bracket, with the left angle brackets and first right angle bracket is removed Symbol is conspired to create to the right angle bracket in the character string that uses.
Step 105:When it is not left angle brackets that first judged result, which represents the first character, the head will be included The content-label after the first character including individual character is leaf node;
In practical application, when the first character is the character in key name, space and key assignments form, due to first character It is not left angle brackets, therefore, the first character and content afterwards can be marked as leaf node.On the other hand, for " key The configuration file of this form of name=key assignments ", the configuration file also referred to as formatted in the industry.For " key name=key assignments " this The configuration file of kind of form, because first character is not equally left angle brackets, therefore, the first character and content afterwards Leaf node can be marked as.That is, using this method, can also be parsed to the configuration file of formatting.
Step 106:First non-leaf nodes and the leaf node are recorded in node listing.
Specifically, by position of first non-leaf nodes in the configuration file and first non-leaf nodes Identification record in the node listing;By position of the leaf node in the configuration file and the leaf node Identification record in the node listing.
It should be noted that for the first non-leaf nodes and leaf node with set membership, in node row In table, the set membership between the first non-leaf nodes and leaf node can be also recorded in the node listing.So, When searching the position of leaf node according to the node listing afterwards, first the father node of the leaf node can be determined Position, then the position of the leaf node is navigated to step by step.In addition, by first non-leaf nodes in the configuration file Position and first non-leaf nodes identification record in the node listing, can afterwards according to the node arrange The position of the non-leaf nodes of table search first.By position of the leaf node in the configuration file and the leaf node Identification record in the node listing, can afterwards according to the node listing search leaf node position.
In summary, the present embodiment, due to by recognizing the first character in the configuration file line by line;Judge the head Whether individual character is left angle brackets, if it is, being the first non-leaf nodes by the content-label after the left angle brackets;It is no Then, will be leaf node comprising the content-label after the first character including the first character;Can be to Apache In nonformat file parsed, the configuration file of the formatting in Apache can be parsed again.
In practical application, for continuing to recognize the content in first non-leaf nodes, until identifying leaf node Or the step for end current process, specifically may comprise steps of:
For initial character in the node between the left angle brackets and the right angle bracket, initial character in the node is judged Whether it is left angle brackets, obtains the second judged result;
When second judged result represents that initial character is left angle brackets in the node, by described in left angle brackets Content-label in node after initial character is the second non-leaf nodes;Search in the node whether there is after initial character with The corresponding right angle bracket of initial character in the node, obtains the second lookup result;When second lookup result represents to find During right angle bracket corresponding with initial character in the node, continue to recognize the content in second non-leaf nodes, until knowing Do not go out leaf node or terminate current process;When second lookup result represents not find and initial character pair in the node During the right angle bracket answered, terminate current process.
When the first non-leaf nodes is embedded is cased with multiple nodes, execution above-mentioned steps can be circulated, until identifying leaf Child node.
Fig. 2 is the flow chart of the embodiment of the method 2 of the parsing Apache configuration files of the present invention.As shown in Fig. 2 this method It can include:
Step 201:Read the first character in the first row of unidentified content;
Step 202:Judge the first character whether be "<", if it is, performing step 203, otherwise, perform step 207;
Step 203:It is non-leaf nodes by the content-label after the first character;
Step 204:Search with it is described "<" match ">”;
Step 205:Judge whether to find;If it is, performing step 208, otherwise, step 206 is performed;
Step 206:Record parsing error message;And perform step 209;
Step 207:It is leaf node by the content-label after the first character;
Step 208:The position of the non-leaf nodes or the leaf node in the configuration file and mark are remembered Record is in node listing.
Step 209:Judge finished for whether the configuration file recognizes;If it is, terminating;Otherwise, return and perform Step 201.
Using the method for the present embodiment, configuration file can be finally identified by way of recurrence performs above-mentioned steps In each non-leaf nodes and leaf node, and by non-leaf nodes and the relevant information of leaf node record in node listing In.
Fig. 3 is the flow chart of the embodiment of the method 3 of the parsing Apache configuration files of the present invention.As shown in figure 3, this method It can include:
Step 301:Obtain Apache configuration files;
Step 302:The first character in the configuration file is recognized line by line;
Step 303:Whether be left angle brackets, obtain the first judged result if judging the first character;
Step 304:When it is left angle brackets that first judged result, which represents the first character, by the left angle brackets Content-label afterwards is the first non-leaf nodes;Search after the left angle brackets with the presence or absence of corresponding with the left angle brackets Right angle bracket, obtain the first lookup result;When first lookup result represents to find the right angle bracket, continue to know Content in not described first non-leaf nodes, until identifying leaf node or terminating current process;When the described first lookup When as a result representing not find the right angle bracket, terminate current process;
Step 305:When it is not left angle brackets that first judged result, which represents the first character, the head will be included The content-label after the first character including individual character is leaf node;
Step 306:First non-leaf nodes and the leaf node are recorded in node listing.
Step 307:Obtaining current page needs the identification information of leaf node of displaying;
Step 308:The mark represented according to the identification information, determines that the mark is corresponding in the node listing Position of the leaf node in the configuration file;
Step 309:By the content displaying of the position in the current page.
In practical application, generally in current page, and the content of whole leaf nodes need not be shown.For example, working as When user needs to change affine on session setting in configuration file, can pair with the affine related leaf node progress of session Screening, is filtered out and the affine unrelated leaf node of session.Specifically can according to the identification information of leaf node carry out screening and Filtering.After it is determined that needing the identification information of the leaf node of display, it is possible to determine the mark by the node listing Know position of the corresponding leaf node in the configuration file, and most the content displaying of the leaf node is worked as described at last The preceding page.
It should be noted that by the content displaying of the position after the current page, following step can also be included Suddenly:
User is obtained to operate for the modification of the content of the position in the current page;
The content of the amended position is stored in the configuration file.
It will be appreciated that by above-mentioned steps, user can be caused for the modification process of Apache configuration files, to become more Plus it is simple, it is easy to operate.
Present invention also offers a kind of system of parsing Apache configuration files.
Fig. 4 is the structure chart of the system embodiment of the parsing Apache configuration files of the present invention.As shown in figure 4, the system It can include:
Configuration file acquiring unit 401, for obtaining Apache configuration files;
Character recognition unit 402, for recognizing the first character in the configuration file line by line;
First judging unit 403, for judging whether the first character is left angle brackets, obtains the first judged result;
First resolution unit 404, for when it is left angle brackets that first judged result, which represents the first character, inciting somebody to action Content-label after the left angle brackets is the first non-leaf nodes;Search whether there is after the left angle brackets with it is described The corresponding right angle bracket of left angle brackets, obtains the first lookup result;When first lookup result represents to find the right point During bracket, continue to recognize the content in first non-leaf nodes, until identifying leaf node or terminating current process;When When first lookup result represents not find the right angle bracket, terminate current process;
Second resolution unit 405, for when it is not left angle brackets that first judged result, which represents the first character, To be leaf node comprising the content-label after the first character including the first character;
Recording unit 406, for first non-leaf nodes and the leaf node to be recorded in node listing.
In summary, the present embodiment, due to by recognizing the first character in the configuration file line by line;Judge the head Whether individual character is left angle brackets, if it is, being the first non-leaf nodes by the content-label after the left angle brackets;It is no Then, will be leaf node comprising the content-label after the first character including the first character;Can be to Apache In nonformat file parsed, the configuration file of the formatting in Apache can be parsed again.
In practical application, first resolution unit 404 can specifically include:
First judgment sub-unit, for for initial character in the node between the left angle brackets and the right angle bracket, Judge that whether initial character is left angle brackets in the node, obtains the second judged result;
First parsing subelement, for representing that initial character is left angle brackets in the node when second judged result When, it is the second non-leaf nodes by the content-label after initial character in the node for left angle brackets;Search the node It whether there is right angle bracket corresponding with initial character in the node after interior initial character, obtain the second lookup result;When described When second lookup result represents to find right angle bracket corresponding with initial character in the node, continue to recognize second n omicronn-leaf Content in child node, until identifying leaf node or terminating current process;When second lookup result represents not search During to right angle bracket corresponding with initial character in the node, terminate current process.
In practical application, the recording unit 406 can specifically include:
Subelement is recorded, for by position of first non-leaf nodes in the configuration file and described first non- The identification record of leaf node is in the node listing;By position of the leaf node in the configuration file and described The identification record of leaf node is in the node listing.
In practical application, it can also include:
Identification information obtaining unit, for first non-leaf nodes and the leaf node to be recorded in node listing In after, obtain current page need show node identification information;The node is leaf node and/or non-leaf section Point;
Node location determining unit, for the mark represented according to the identification information, is determined in the node listing The position that corresponding node is identified in the configuration file;
Page presentation unit, for by the content displaying of the position in the current page.
In practical application, it can also include:
Modification operation acquiring unit, for after the current page, the content displaying of the position to be obtained into user Operated in the current page for the modification of the content of the position;
Storage unit, for the content of the amended position to be stored in the configuration file.
The embodiment of each in this specification is described by the way of progressive, and what each embodiment was stressed is and other Between the difference of embodiment, each embodiment identical similar portion mutually referring to.For system disclosed in embodiment For, because it is corresponded to the method disclosed in Example, so description is fairly simple, related part is said referring to method part It is bright.
Specific case used herein is set forth to the principle and embodiment of the present invention, and above example is said The bright method and its core concept for being only intended to help to understand the present invention;Simultaneously for those of ordinary skill in the art, foundation The thought of the present invention, will change in specific embodiments and applications.In summary, this specification content is not It is interpreted as limitation of the present invention.

Claims (8)

1. a kind of method of parsing Apache configuration files, it is characterised in that including:
Obtain Apache configuration files;
The first character in the configuration file is recognized line by line;
Whether be left angle brackets, obtain the first judged result if judging the first character;
When it is left angle brackets that first judged result, which represents the first character, by the content mark after the left angle brackets It is designated as the first non-leaf nodes;Search and whether there is right angle bracket corresponding with the left angle brackets after the left angle brackets, Obtain the first lookup result;When first lookup result represents to find the right angle bracket, for the left angle brackets Initial character in node between the right angle bracket, judges that whether initial character is left angle brackets in the node, obtains second Judged result;
When it is left angle brackets that second judged result, which represents in the node initial character, by for the node of left angle brackets Content-label after interior initial character is the second non-leaf nodes;Search in the node whether there is after initial character with it is described The corresponding right angle bracket of initial character in node, obtains the second lookup result;When second lookup result represents to find and institute When stating the corresponding right angle bracket of initial character in node, continue to recognize the content in second non-leaf nodes, until identifying Leaf node terminates current process;When second lookup result represent not find it is corresponding with initial character in the node During right angle bracket, terminate current process;When first lookup result represents not find the right angle bracket, terminate current Process;
When it is not left angle brackets that first judged result, which represents the first character, including comprising the first character Content-label after the first character is leaf node;
First non-leaf nodes and the leaf node are recorded in node listing.
2. according to the method described in claim 1, it is characterised in that described by first non-leaf nodes and the leaf section Point record is specifically included in node listing:
By position of first non-leaf nodes in the configuration file and the identification record of first non-leaf nodes In the node listing;
The identification record of position of the leaf node in the configuration file and the leaf node is arranged in the node In table.
3. the method according to claim any one of 1-2, it is characterised in that described by first non-leaf nodes and institute After leaf node record is stated in node listing, in addition to:
Obtaining current page needs the identification information of node of displaying;The node is leaf node and/or non-leaf nodes;
The mark represented according to the identification information, determines that the corresponding node of the mark is matched somebody with somebody described in the node listing Put the position in file;
By the content displaying of the position in the current page.
4. method according to claim 3, it is characterised in that the content displaying by the position is in the current page After face, in addition to:
User is obtained to operate for the modification of the content of the position in the current page;
The content of the amended position is stored in the configuration file.
5. a kind of system of parsing Apache configuration files, it is characterised in that including:
Configuration file acquiring unit, for obtaining Apache configuration files;
Character recognition unit, for recognizing the first character in the configuration file line by line;
First judging unit, for judging whether the first character is left angle brackets, obtains the first judged result;
First resolution unit, for when it is left angle brackets that first judged result, which represents the first character, by the left side Content-label after angle brackets is the first non-leaf nodes;Search after the left angle brackets with the presence or absence of being included with the left point Number corresponding right angle bracket, obtains the first lookup result;When first lookup result represents to find the right angle bracket, Continue to recognize the content in first non-leaf nodes, until identifying leaf node or terminating current process;When described When one lookup result represents not find the right angle bracket, terminate current process;
First resolution unit includes:First judgment sub-unit and the first parsing subelement, wherein:
First judgment sub-unit, for for initial character in the node between the left angle brackets and the right angle bracket, Judge that whether initial character is left angle brackets in the node, obtains the second judged result;
The first parsing subelement, for representing that initial character is left angle brackets in the node when second judged result When, it is the second non-leaf nodes by the content-label after initial character in the node for left angle brackets;Search the node It whether there is right angle bracket corresponding with initial character in the node after interior initial character, obtain the second lookup result;When described When second lookup result represents to find right angle bracket corresponding with initial character in the node, continue to recognize second n omicronn-leaf Content in child node, until identifying leaf node or terminating current process;When second lookup result represents not search During to right angle bracket corresponding with initial character in the node, terminate current process;
Second resolution unit, for that when it is not left angle brackets that first judged result, which represents the first character, will include The content-label after the first character including the first character is leaf node;
Recording unit, for first non-leaf nodes and the leaf node to be recorded in node listing.
6. system according to claim 5, it is characterised in that the recording unit, is specifically included:
Subelement is recorded, for by position of first non-leaf nodes in the configuration file and first non-leaf The identification record of node is in the node listing;By position of the leaf node in the configuration file and the leaf The identification record of node is in the node listing.
7. the system according to claim any one of 5-6, it is characterised in that also include:
Identification information obtaining unit, for first non-leaf nodes and the leaf node to be recorded in node listing into it Afterwards, the identification information that current page needs the node of displaying is obtained;The node is leaf node and/or non-leaf nodes;
Node location determining unit, for the mark represented according to the identification information, is determined described in the node listing Identify position of the corresponding node in the configuration file;
Page presentation unit, for by the content displaying of the position in the current page.
8. system according to claim 7, it is characterised in that also include:
Modification operation acquiring unit, for the content displaying of the position after the current page, to be obtained into user in institute The modification that current page is stated for the content of the position is operated;
Storage unit, for the content of the amended position to be stored in the configuration file.
CN201410605645.8A 2014-10-31 2014-10-31 A kind of method and system of parsing Apache configuration files Active CN104361055B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410605645.8A CN104361055B (en) 2014-10-31 2014-10-31 A kind of method and system of parsing Apache configuration files

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410605645.8A CN104361055B (en) 2014-10-31 2014-10-31 A kind of method and system of parsing Apache configuration files

Publications (2)

Publication Number Publication Date
CN104361055A CN104361055A (en) 2015-02-18
CN104361055B true CN104361055B (en) 2017-09-05

Family

ID=52528316

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410605645.8A Active CN104361055B (en) 2014-10-31 2014-10-31 A kind of method and system of parsing Apache configuration files

Country Status (1)

Country Link
CN (1) CN104361055B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109189395B (en) * 2018-08-14 2022-03-01 北京搜狐新媒体信息技术有限公司 Data analysis method and device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103646055A (en) * 2013-11-29 2014-03-19 广州视源电子科技股份有限公司 Method and device for obtaining program configuration information
CN103744673A (en) * 2014-01-06 2014-04-23 北京乐动卓越科技有限公司 Resource allocation method based on iOS (Internet 0perating System) platform

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8612487B2 (en) * 2011-09-07 2013-12-17 International Business Machines Corporation Transforming hierarchical language data into relational form

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103646055A (en) * 2013-11-29 2014-03-19 广州视源电子科技股份有限公司 Method and device for obtaining program configuration information
CN103744673A (en) * 2014-01-06 2014-04-23 北京乐动卓越科技有限公司 Resource allocation method based on iOS (Internet 0perating System) platform

Also Published As

Publication number Publication date
CN104361055A (en) 2015-02-18

Similar Documents

Publication Publication Date Title
US7877399B2 (en) Method, system, and computer program product for comparing two computer files
CN103902653B (en) A kind of method and apparatus for building data warehouse table genetic connection figure
CN109508381B (en) Knowledge graph processing method and device
KR20160040282A (en) Method and device for storing data
CN107783770A (en) Page configuration update method, device, server and medium
CN105808609A (en) Discrimination method and equipment of point-of-information data redundancy
CN107122169A (en) A kind of method and device of Flash function encryptings
CN108959575A (en) A kind of enterprise&#39;s incidence relation information mining method and device
CN105488210B (en) A kind of batch data matching process and device
KR20190095099A (en) Transaction system error detection method, apparatus, storage medium and computer device
CN113986968B (en) Scheme intelligent proofreading method based on electric power standard standardization datamation
CN107239549A (en) Method, device and the terminal of database terminology retrieval
CN108282509A (en) page sharing method, device and server
CN106814998A (en) List sequencing method and device
CN108491715A (en) Generation method, device and the server in Terminal fingerprints library
CN104598374B (en) The method and apparatus of correction failure script
CN106919390A (en) A kind of method and apparatus of page generation
JP2010157004A (en) Information editing supporting apparatus, method and program
CN104361055B (en) A kind of method and system of parsing Apache configuration files
JP5259260B2 (en) Search result providing method and system
JP2003131931A (en) Method and device for scheduling, generating and processing document comprising blocks of information
CN110209780A (en) A kind of question template generation method, device, server and storage medium
CN105988943B (en) A kind of method and device driving wireless adapter
CN110309364A (en) A kind of information extraction method and device
CN108241705A (en) A kind of data insertion method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant