WO2020168521A1 - 报文解析的方法、数据发送端、数据接收端和系统 - Google Patents

报文解析的方法、数据发送端、数据接收端和系统 Download PDF

Info

Publication number
WO2020168521A1
WO2020168521A1 PCT/CN2019/075752 CN2019075752W WO2020168521A1 WO 2020168521 A1 WO2020168521 A1 WO 2020168521A1 CN 2019075752 W CN2019075752 W CN 2019075752W WO 2020168521 A1 WO2020168521 A1 WO 2020168521A1
Authority
WO
WIPO (PCT)
Prior art keywords
message
target identifier
node
xml
independent
Prior art date
Application number
PCT/CN2019/075752
Other languages
English (en)
French (fr)
Inventor
张凯
陈亮
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to EP19916377.5A priority Critical patent/EP3913879A4/en
Priority to PCT/CN2019/075752 priority patent/WO2020168521A1/zh
Priority to CN201980061022.XA priority patent/CN112740635B/zh
Publication of WO2020168521A1 publication Critical patent/WO2020168521A1/zh
Priority to US17/407,705 priority patent/US11956337B2/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing
    • G06F40/221Parsing markup language streams
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/30Definitions, standards or architectural aspects of layered protocol stacks
    • H04L69/32Architecture of open systems interconnection [OSI] 7-layer type protocol stacks, e.g. the interfaces between the data link level and the physical level
    • H04L69/321Interlayer communication protocols or service data unit [SDU] definitions; Interfaces between layers

Definitions

  • This application relates to the field of network technology, and in particular to a method, data sending end, data receiving end and system for message parsing.
  • Netconf protocol As a general configuration protocol for network equipment, Netconf protocol has been widely supported by network equipment. For example, in a software-defined network (Software Defined Networking, SDN) structure, data transmission is performed between the controller and the repeater through the Netconf protocol. When using the Netconf protocol for data transmission, the format of an Extensible Markup Language (XML) message is generally used to carry data.
  • SDN Software Defined Networking
  • XML Extensible Markup Language
  • DOM Document Object Model
  • the specific analysis method is: parse the XML message into a tree structure, which is It is called a node tree.
  • node tree the relationship between each node is described by the package relationship.
  • the root node vertically includes the parent node
  • the parent node vertically includes the child nodes
  • the sibling nodes are horizontal nodes.
  • embodiments of the present application provide a method, a data sending end, a data receiving end, and a system for parsing a message.
  • the technical solution is as follows:
  • a method for message parsing includes:
  • Receiving an extensible markup language XML message and in the process of receiving the XML message, if it is detected that the XML message has a target identifier, intercept an independent message corresponding to the target identifier from the XML message Block; parse the independent message block.
  • the target identifier can be preset and stored at the data receiving end, and the target identifier can be used to characterize that the corresponding message block is an independent message block without context dependence.
  • the data receiving end can receive the XML message sent by the data sending end.
  • the process of receiving the XML message if it detects that the XML message has a target identifier, it can be included in the XML message , Intercept the independent message block corresponding to the target identifier. In this way, independent independent message blocks without context dependence can be obtained. Then the independent message block can be parsed.
  • the process of receiving the XML message because it encounters an independent message block, it can be directly intercepted and then parsed, without the need to cache the entire XML message in the memory, so the memory cost can be relatively reduced.
  • the storage requirement can be applied to the analysis of packets with a large amount of data, so a method for parsing packets with a large amount of data is provided.
  • the method further includes: using SAX to parse a message block of a node that does not have a target identifier in the XML message.
  • the data receiving end can obtain the packets of these nodes for nodes that do not have target identifiers, and parse them according to the simple XML interface (Simple API for XML, SAX) method, that is, at these nodes
  • SAX Simple API for XML
  • the messages can be read line by line in the buffer, and the following events are recognized, such as XML start, XML end, tag start, tag end, substring value, exception, etc., and trigger analysis at each event deal with.
  • messages other than independent message blocks can also be read line by line using SAX after buffering, so they can also be parsed while scanning, and the memory occupied is relatively small.
  • the method further includes: if no target identifier is detected in the XML message, using SAX to parse the XML message.
  • the data receiving end does not detect the target identifier in the entire XML message, it can use SAX to parse the XML message, that is, after all the XML messages are buffered, the buffer is row by row Read and identify the following events, such as XML start, XML end, tag start, tag end, substring value, exception, etc., and trigger the analysis process at each event.
  • the SAX method can also be used to read line by line, so it can also be parsed while scanning, and the memory occupied is relatively small.
  • the intercepting the independent message block corresponding to the target identifier from the XML message includes: in the XML message, starting from the position of the target identifier and moving to the left Determine the start point of the independent message block corresponding to the target identifier, and determine the end point of the independent message block corresponding to the target identifier from the position of the target identifier to the right; according to the start point and the end Point, intercept the independent message block corresponding to the target identifier from the XML message.
  • the starting point of the independent message block corresponding to the target identifier can be determined from the position of the target identifier to the left, and the starting point of the independent message block corresponding to the target identifier can be determined from the position of the target identifier Determine the end point of the independent message block corresponding to the target identifier to the right, and then intercept the independent message block between the start point and the end point in the XML message. In this way, the independent message block corresponding to the target identifier can be intercepted. In this way, since the start point and the end point can be used for direct interception, the interception efficiency can be improved.
  • the target identifier is the attribute value of the attribute of the node; if it is detected that the XML message has a target identifier, then the XML message corresponding to the target identifier is intercepted
  • the independent message block includes: if it is detected that the attribute value of the attribute of the target node in the XML message is a target identifier, then the independent message corresponding to the target identifier is intercepted from the XML message according to the target node. Text block.
  • the data receiving end when the data receiving end detects that the attribute value of the attribute of a certain node in the message (ie the target node) is the target identifier, it can intercept the target identifier from the XML message according to the target identifier The corresponding independent message block. In this way, the target node can be the attribute value of the attribute of the node.
  • the interception of the independent message block corresponding to the target identifier from the XML message according to the target node includes: if the target node does not include child nodes, from In the XML message, an independent message block corresponding to the target node is intercepted, and if the target node includes child nodes, the target node and the child node correspondence included in the target node are intercepted from the XML message Independent message block.
  • the data receiving end detects that the attribute value of the attribute of a certain node (that is, the target node) in the message is the target identifier, and then it can determine whether the target node includes child nodes. , The start point and end point of the independent message block corresponding to the target node can be determined, and then the independent message block between the start point and the end point can be intercepted from the XML message. If child nodes are included, the target node and The start point and end point of the independent message block corresponding to the child nodes included in the target node, and then the independent message block between the start point and the end point is intercepted in the XML message.
  • the target identifier is the node name of the parent node; if it is detected that the XML message has a target identifier, intercept the independent corresponding to the target identifier from the XML message.
  • the message block includes: if it is detected that there is a parent node whose node name is the target identifier in the XML message, intercepting from the XML message the correspondence of the child node included in the parent node whose node name is the target identifier Independent message block.
  • the data receiving end when the data receiving end determines that the node name of a certain parent node is the target identifier, it can determine the child nodes included in the parent node, and then determine the origin of the independent message block corresponding to the child node. Start point and end point, and then intercept the independent message block between the start point and the end point from the XML message.
  • the independent message block is an independent message block that can be independently parsed. In this way, the target identifier can be the node name of the parent node.
  • a method for message parsing includes:
  • adding a target identifier to the XML message is used to indicate an independent message block in the XML message, where the independent message block is an independent non-context dependent Message block; sending the XML message to the data receiving end.
  • the data sending end needs to send an XML message to the data receiving end.
  • the XML message if a message block in the XML message is an independent message block without context dependency, If the message block is an independent message block, the target identifier can be added to the independent message block. If a message block does not exist in the XML message as an independent message block without context dependence, the XML message can be created directly. Then send the created XML message to the data receiving end.
  • the data receiving end can identify the independent message block, and perform parsing in parallel when receiving, without having to wait until all the cache is finished for parsing, which can save the memory usage of the cache .
  • the data sending end can determine the message block without context dependence in the XML message as an independent message block, and then obtain the attribute value of the attribute of the node to which the determined independent message block belongs The target identifier is added to the identifier bit, so that the determined attribute value of the attribute of the node to which the independent message block belongs is the target identifier.
  • the data sending end can determine the message block without context dependency in the XML message, which is an independent message block, and then add a node name for the node to which the determined independent message block belongs.
  • the parent node of the target ID is the target identifier.
  • a data receiving end for packet analysis includes a receiver, a memory, and a processor, wherein:
  • the receiver is used to receive an extensible markup language XML message
  • the processor is used for:
  • the processor is further configured to:
  • the processor is further configured to:
  • SAX is used to parse the XML message.
  • the processor is configured to:
  • the starting point of the independent message block corresponding to the target identifier is determined to the left from the position of the target identifier, and the target identifier is determined to the right from the position of the target identifier.
  • an independent message block corresponding to the target identifier is intercepted from the XML message.
  • the target identifier is an attribute value of an attribute of the node
  • the processor is used for:
  • an independent message block corresponding to the target identifier is intercepted from the XML message according to the target node.
  • the processor is configured to:
  • the independent message block corresponding to the target node is intercepted from the XML message; if the target node includes child nodes, the XML message is intercepted The target node and the independent message blocks corresponding to the child nodes included in the target node.
  • the target identifier is the node name of the parent node
  • the processor is used for:
  • a data sending end for packet analysis includes a processor, a transmitter, and a memory, where:
  • the processor is configured to add a target identifier to the XML message to indicate an independent message block in the XML message when creating an extensible markup language XML message, wherein the independent message block It is an independent message block without context dependence;
  • the transmitter is configured to send the XML message to the data receiving end.
  • the target identifier is an attribute value of an attribute of the node
  • the processor is used for:
  • the independent message block in the XML message is determined, and the attribute value of the attribute of the node to which the determined independent message block belongs is set as the target identifier.
  • the target identifier is the node name of the parent node
  • the processor is used for:
  • an independent message block in the XML message is determined, and a parent node is added to the node to which the determined independent message block belongs, wherein the node name of the added parent node is the target identifier.
  • a data receiving end for message analysis includes a plurality of modules, and the method for message analysis provided in the first aspect can be realized through the cooperative function between the plurality of modules. .
  • a data sending end for message analysis includes a plurality of modules, and the method for message analysis provided in the second aspect can be realized through the cooperative function between the plurality of modules. .
  • a computer-readable storage medium stores instructions that, when the computer-readable storage medium runs on a data receiving end, causes the data receiving end to execute the above The method described in one aspect.
  • a computer program product containing instructions which when the computer program product runs on a data receiving end, causes the data receiving end to execute the method described in the first aspect.
  • a computer-readable storage medium stores instructions that, when the computer-readable storage medium runs on a data sending end, causes the data sending end to execute the above The method described in the two aspects.
  • a computer program product containing instructions which when the computer program product runs on a data sending end, causes the data sending end to execute the method described in the second aspect.
  • a message parsing system includes a data sending end and a data receiving end, wherein: the data sending end is the data sending end described in the sixth aspect; the data The receiving end is the data receiving end described in the fifth method.
  • the data sending end may add a target identifier to the XML message to indicate an independent message block in the XML message, and the independent message block is an independent message without context dependence.
  • the data receiving end can then send an XML message to the data receiving end.
  • the data receiving end if the data receiving end detects that the XML message has a target identifier, it can intercept the independent message corresponding to the target identifier from the XML message
  • the file block is then analyzed and processed on the intercepted independent message block.
  • the embodiments of the present application can save memory, in the context of limited memory, rapid analysis and response of messages can be achieved, so that business response, user interface (UI) refresh, etc. can be quickly performed, and also Improve the user experience.
  • UI user interface
  • Figure 1 is a schematic diagram of a structure between devices for a reconciliation operation in an embodiment of the present application
  • FIG. 2 is a schematic diagram of the structure between devices for a reconciliation operation in an embodiment of the present application
  • FIG. 3 is a schematic structural diagram of a data receiving end/data sending end in an embodiment of the present application
  • FIG. 4 is a schematic flowchart of a method for message parsing in an embodiment of the present application
  • Figure 5 is a schematic diagram of a node tree in an embodiment of the present application.
  • Figure 6 is a schematic diagram of parsing independent message blocks in an embodiment of the present application.
  • FIG. 7 is a schematic diagram of parsing independent message blocks in an embodiment of the present application.
  • FIG. 8 is a schematic structural diagram of a data receiving end in an embodiment of the present application.
  • Fig. 9 is a schematic structural diagram of a data sending end in an embodiment of the present application.
  • the embodiments of the present application can be applied to a data transmission system.
  • the data transmission system includes a data sending end and a data receiving end.
  • the data sending end is used to send messages
  • the data receiving end is used to receive and parse messages.
  • the controller and the transponder perform account reconciliation.
  • the configuration information of the transmitter shall prevail, the controller is the data sending end, and the repeater is the data receiving end.
  • SDN network is a new type of network architecture whose main feature is to implement the network control plane in software. This architecture allows network administrators to re-plan the network with programs in a central control mode without changing the hardware devices, providing a new solution for controlling network traffic, and also providing a good platform for core network and application innovation.
  • DOM is a standard programming interface for processing extensible markup language recommended by the W3C organization.
  • DOM will parse the XML document into a tree structure, which is called a node tree. After the DOM is parsed, the entire XML tree structure can be passed The root node performs horizontal (between sibling) and vertical (between parent and child) accesses, that is, any node in the entire xml message corresponds to a DOM node in memory.
  • the DOM parsing method requires the entire XML message to be completely parsed in memory before it can be manipulated. This parsing method has extremely high requirements for memory and is suitable for parsing short messages.
  • SAX is an event-driven XM1 application program interface (Application Program Interface, API).
  • API Application Program Interface
  • the difference between SAX and DOM is that it parses while scanning, and parses sequentially from top to bottom. As it parses while scanning, it has the advantages of fast parsing XML and less memory.
  • Netconf protocol is a network configuration management protocol defined in RFC6241. It is a commonly used configuration protocol for network equipment.
  • the reconciliation operation is the data synchronization process between the data receiving end and the data sending end.
  • the embodiment of this application provides a method for message parsing.
  • the execution subject of the method can be a data receiving end and a data sending end.
  • the data receiving end can be any device that can receive XML messages.
  • the data sending end can be a creation and The device that sends the XML message.
  • FIG. 3 shows a structural block diagram of a data receiving end and a data sending end in an embodiment of the present application.
  • the data receiving end and the data sending end may at least include a receiver 301, a processor 302, a memory 303, and a transmitter 304, respectively.
  • the receiver 301 can be used to receive data, specifically it can be used to receive XML messages
  • the transmitter 304 can be used to send data, specifically it can be used to send XML messages
  • the memory 303 can be used to store software.
  • the processor 302 executes various functional applications and data processing by running software programs and modules stored in the memory 303.
  • the memory 303 may mainly include a program storage area and a data storage area.
  • the program storage area may store an operating system, an application program required by at least one function, etc.; the data storage area may store data created according to the use of the data receiving end.
  • the memory 303 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices.
  • the memory 303 may further include a memory controller to provide access to the memory 303 by the processor 302, the receiver 301, and the transmitter 304.
  • the processor 302 is the control center of the data receiving end, which uses various interfaces and lines to connect the various parts of the entire data receiving end, by running or executing the software programs and/or modules stored in the memory 303, and calling the data stored in the memory 303 , Perform various functions of the data receiving end and process data, so as to monitor the data receiving end as a whole.
  • the processor 302 may include one or more processing cores; preferably, the processor 302 may integrate an application processor and a modem processor, where the application processor mainly processes the operating system, user interface, and application programs, etc. , The modem processor mainly deals with wireless communication. It can be understood that the foregoing modem processor may not be integrated into the processor 302.
  • the embodiment of the present application provides a method for message parsing, which is applied to the data receiving end and the data sending end. As shown in FIG. 4, the processing flow of the method may be as follows:
  • Step 401 When the data sending end creates an XML message, it adds a target identifier to the XML message to indicate an independent message block in the XML message, where the independent message block is an independent message block without context dependency.
  • the data sender must send an XML message to the data receiver.
  • the message block is Independent message block, you can add a target identifier to the independent message block. If a message block does not exist in the XML message as an independent message block without context dependence, the XML message can be created directly.
  • the target identifier may be the attribute value of the attribute of the node. Accordingly, the processing of adding the target identifier may be as follows:
  • the independent message block in the XML message is determined, and the attribute value of the attribute of the node to which the determined independent message block belongs is set as the target identifier.
  • the data sender can determine the message block without context dependence in the XML message as an independent message block, and then obtain the identification bit of the attribute value of the attribute of the node to which the determined independent message block belongs, and identify the target Add to the identification bit, so that the determined attribute value of the node to which the independent message block belongs is the target identifier.
  • the target identifier is the node name of the parent node. Accordingly, the processing of adding the target identifier can be as follows:
  • an independent message block in the XML message is determined, and a parent node is added to the node to which the determined independent message block belongs, where the node name of the added parent node is the target identifier.
  • new XML upper-level nodes (not limited to specific node names here) to identify independently parsed independent message blocks (that is, independent message blocks that can be parsed without using context).
  • the XML language itself is a tree structure, and each node is composed of node name, namespace, node value, attribute, and attribute value.
  • an independent message block that can be independently resolved is used as the child node of the parent node. In this way, when the node name of a certain parent node is the target identifier, it means that the independent message blocks of the child nodes included in this parent node may not be resolved independently based on context.
  • the data sender can determine the message block without context dependence in the XML message as an independent message block, and then add a node name as the parent node of the target identifier to the node to which the determined independent message block belongs. In this way, the node name of the added parent node is the target identifier.
  • Step 402 The data sending end sends an XML message to the data receiving end.
  • the data sending end after the data sending end creates the XML message, it can send the created XML message to the data receiving end.
  • Step 403 The data receiving end receives the XML message.
  • the data receiving end can continuously receive the character stream composed of XML messages sent by the data sending end.
  • step 404 in the process of receiving the XML message, if the data receiving end detects that the XML message has a target identifier, it intercepts an independent message block corresponding to the target identifier from the XML message.
  • the target identifier can be preset and stored at the data receiving end, and the target identifier can be used to characterize that the corresponding message block is an independent message block without context dependence.
  • the data receiving end can detect whether there is a target identifier in the received XML message during the process of receiving the character stream composed of the XML message sent by the data sender, and if there is a target identifier, it can start from the XML message The independent message block corresponding to the target identifier is intercepted in. In this way, independent independent message blocks without context dependence can be obtained.
  • the start point and end point of the independent message block corresponding to the target identifier may be determined first, and then the independent message block may be intercepted.
  • the corresponding processing may be as follows:
  • the starting point of the independent message block corresponding to the target identifier is determined from the position of the target identifier to the left, and the end point of the independent message block corresponding to the target identifier is determined from the position of the target identifier to the right, according to Start point and end point, intercept independent message blocks corresponding to the target identifier from the XML message.
  • the starting point of the independent message block corresponding to the target identifier can be determined from the position of the target identifier to the left, and the target identifier can be determined from the position of the target identifier to the right Corresponding to the end point of the independent message block, and then intercept the independent message block between the start point and the end point in the XML message. In this way, the independent message block corresponding to the target identifier can be intercepted.
  • the target identifier can be any identifier that can represent an independent message block.
  • Two possible implementation manners are given below:
  • the target identifier is the attribute value of the attribute of the node; if the attribute value of the attribute of the target node in the XML message is detected as the target identifier, the independent message block corresponding to the target identifier is intercepted from the XML message according to the target node .
  • the data receiving end when the data receiving end detects that the attribute value of the attribute of a node in the message (ie the target node) is the target identifier, it can intercept the independent message corresponding to the target identifier from the XML message according to the target node Piece.
  • the independent message block corresponding to the target identifier is intercepted, and the corresponding processing may be as follows:
  • the independent message block corresponding to the target node is intercepted from the XML message; if the target node includes child nodes, the independent message block corresponding to the target node and the child nodes included in the target node is intercepted from the XML message Message block.
  • the data receiving end when the data receiving end detects that the attribute value of a certain node in the message (ie the target node) is the target identifier, it can determine whether the target node includes child nodes, and if it does not include child nodes, it can determine The start point and end point of the independent message block corresponding to the target node, and then intercept the independent message block between the start point and the end point from the XML message. If the child node is included, the target node and the target node can be determined The start point and end point of the independent message block corresponding to the child node, and then intercept the independent message block between the start point and the end point in the XML message.
  • the top node add the target identifier "independent”, as shown below:
  • independent is the attribute value of the attribute of the ⁇ fast>" node.
  • the starting point of the independent message block corresponding to the target identifier can be obtained from the " ⁇ " position in ⁇ bbf, and to the right, you can get The end point of the independent message block corresponding to the target identifier is the ">" in ⁇ /bbf-fast:fast>.
  • the target node and the independent message blocks corresponding to the child nodes included in the target node are independent, so the target node and the independent messages corresponding to the child nodes included in the target node can be intercepted Piece.
  • the target identifier is the node name of the parent node; if it is detected that there is a parent node whose node name is the target identifier in the XML message, then intercept the corresponding child nodes included in the parent node whose node name is the target identifier from the XML message Independent message block.
  • the data receiving end when the data receiving end determines the node name of a parent node as the target identifier, it can determine the child nodes included in the parent node, and then determine the start point and end point of the independent message block corresponding to the child node. Then the independent message block between the start point and the end point is intercepted from the XML message, and the independent message block is an independent message block that can be independently parsed.
  • the independent message block between ⁇ independent-fragment-root> and ⁇ /independent-fragment-root> is an independent message block that is parsed independently.
  • Step 405 The data receiving end analyzes the independent message block.
  • the data receiving end after the data receiving end obtains an independent independent message block without the above dependencies, it can deliver it to the parsing thread pool and start the parsing thread for parsing.
  • DOM can be used directly for analysis.
  • the independent message block is:
  • parsed XML tree structure is shown in Figure 5, where body is div and ul as parent nodes, div and ul are child nodes of body, and div and ul are sibling nodes.
  • the data receiving end intercepts the independent message block, it can be added to the independent message buffer (the independent message buffer area and the XML message other than the intercepted independent message block) The buffer area is different), and then the parsing task manager recognizes that there is a parsable independent message block in the independent message buffer area, and can start the parsing thread for parsing.
  • Figure 6 for the above method 1, a schematic diagram of the analysis process is provided.
  • the ⁇ block1> node is the target node, and the start point of the independent message block corresponding to the target identifier is the " ⁇ " in ⁇ block1>, and the end point is ">" in ⁇ /block1>, the independent message block intercepted is the independent message block between " ⁇ " in ⁇ block1> and ">" in ⁇ /block1>, which is added to the independent message buffer area
  • the independent message block is the independent message block between " ⁇ " in ⁇ block1> and ">" in ⁇ /block1>, and then the parsing thread performs analysis.
  • Figure 7 for the second method above, a schematic diagram of the analysis process is provided.
  • the independent message block corresponding to the ⁇ block1> node is an independent message block, and the starting point of the independent message block corresponding to the target identifier is ⁇ independent-fragment
  • the " ⁇ " in -root>, the end point is the ">" in ⁇ /independent-fragment-root>
  • the intercepted independent message block is the " ⁇ ” and ⁇ /independent- in ⁇ independent-fragment-root>
  • the independent message block between ">" in fragment-root>, that is, the independent message block added to the independent message buffer area is the " ⁇ " and ⁇ /independent-fragment-root> in ⁇ independent-fragment-root>
  • the parsing thread will analyze.
  • SAX can be used for analysis, and the corresponding processing can be as follows:
  • the data receiving end can obtain the messages of these nodes for nodes without target identifiers, and parse them according to the SAX method, that is, after all the messages of these nodes are received, they can be read line by line in the buffer , And recognize the following events, such as XML start, XML end, tag start, tag end, substring value, exception, etc., and trigger the analysis process at each event.
  • SAX can be used to parse the XML message, and the corresponding processing can be as follows:
  • SAX is used to parse the XML message.
  • the data receiving end does not detect the target identifier in the entire XML message, it can use SAX to parse the XML message, that is, after all the XML messages are buffered, read from the buffer line by line, and identify The following events, such as start of XML, end of XML, start of tag, end of tag, substring value, exception, etc., will trigger the parsing process at each event.
  • the above-mentioned message parsing method can not only be applied to the message reception between network devices in the SDN network, but also can be applied to any continuous function body that carries messages based on XML syntax.
  • Message transmission between For example, data synchronization between mobile terminals and cloud servers, data synchronization between different business nodes in a cluster environment, etc.
  • the data sending end may add a target identifier to the XML message to indicate an independent message block in the XML message, and the independent message block is an independent message without context dependence.
  • the data receiving end can then send an XML message to the data receiving end.
  • the data receiving end if the data receiving end detects that the XML message has a target identifier, it can intercept the independent message corresponding to the target identifier from the XML message
  • the file block is then analyzed and processed on the intercepted independent message block.
  • the embodiments of the present application can save memory, in the context of limited memory, rapid analysis and response of messages can be achieved, so that business response, user interface (UI) refresh, etc. can be quickly performed, and also Improve the user experience.
  • UI user interface
  • Fig. 8 is a structural diagram of a data receiving end for packet analysis provided in an embodiment of the present application.
  • the data receiving end can be implemented as part or all of the terminal through software, hardware or a combination of the two.
  • the data receiving end for packet analysis provided in the embodiment of the present application can implement the process shown in FIG. 4 of the embodiment of the present application.
  • the data receiving end includes: a receiving module 810, an intercepting module 820, and a parsing module 830, wherein:
  • the receiving module 810 is configured to receive an extensible markup language XML message
  • the interception module 820 is configured to, in the process of receiving the XML message, if it is detected that the XML message has a target identifier, intercept the independent message block corresponding to the target identifier from the XML message;
  • the parsing module 830 is configured to perform parsing processing on the independent message block.
  • the parsing module 830 is also used for:
  • the parsing module 830 is also used for:
  • SAX is used to parse the XML message.
  • the intercepting module 820 is configured to:
  • the starting point of the independent message block corresponding to the target identifier is determined to the left from the position of the target identifier, and the target identifier is determined to the right from the position of the target identifier.
  • an independent message block corresponding to the target identifier is intercepted from the XML message.
  • the target identifier is an attribute value of an attribute of the node
  • the interception module 820 is used to:
  • an independent message block corresponding to the target identifier is intercepted from the XML message according to the target node.
  • the intercepting module 820 is configured to:
  • the independent message block corresponding to the target node is intercepted from the XML message; if the target node includes child nodes, the XML message is intercepted The target node and the independent message blocks corresponding to the child nodes included in the target node.
  • the target identifier is the node name of the parent node
  • the interception module 820 is used to:
  • the data sending end may add a target identifier to the XML message to indicate an independent message block in the XML message, and the independent message block is an independent message without context dependence.
  • the data receiving end can then send an XML message to the data receiving end.
  • the data receiving end if the data receiving end detects that the XML message has a target identifier, it can intercept the independent message corresponding to the target identifier from the XML message
  • the file block is then analyzed and processed on the intercepted independent message block.
  • the data receiving end provided in the above embodiment performs message analysis
  • only the division of the above functional modules is used as an example.
  • the above functions can be allocated by different functional modules according to needs. , That is, divide the internal structure of the data receiving end into different functional modules to complete all or part of the functions described above.
  • the data receiving end provided in the foregoing embodiment and the method embodiment of message parsing belong to the same concept, and the specific implementation process is detailed in the method embodiment, and will not be repeated here.
  • FIG. 9 is a structural diagram of a data sending end for packet analysis provided by an embodiment of the present application.
  • the data sending end can be implemented as part or all of the terminal through software, hardware or a combination of the two.
  • the data sending end for message analysis provided in the embodiment of the present application can implement the process shown in FIG. 4 of the embodiment of the present application.
  • the data sending end includes: a creation module 910 and a sending module 920, wherein:
  • the creation module 910 is used to create an extensible markup language XML message, adding a target identifier to the XML message to indicate an independent message block in the XML message, where the independent message block is Independent message block without context dependence;
  • the sending module 920 is configured to send the XML message to the data receiving end.
  • the target identifier is an attribute value of an attribute of the node
  • the creation module 910 is used to:
  • the independent message block in the XML message is determined, and the attribute value of the attribute of the node to which the determined independent message block belongs is set as the target identifier.
  • the target identifier is the node name of the parent node
  • the creation module 910 is used to:
  • an independent message block in the XML message is determined, and a parent node is added to the node to which the determined independent message block belongs, wherein the node name of the added parent node is the target identifier.
  • the data sending end may add a target identifier to the XML message to indicate an independent message block in the XML message, and the independent message block is an independent message without context dependence.
  • the data receiving end can then send an XML message to the data receiving end.
  • the data receiving end if the data receiving end detects that the XML message has a target identifier, it can intercept the independent message corresponding to the target identifier from the XML message
  • the file block is then analyzed and processed on the intercepted independent message block.
  • the embodiment of the present application also provides a computer-readable storage medium that stores instructions, and when the computer-readable storage medium runs on a data receiving end, the data receiving end is caused to execute the above Method steps for message parsing.
  • the embodiment of the present application also provides a computer program product containing instructions, which when the computer program product runs on a data receiving end, causes the data receiving end to perform the above-mentioned method steps of message parsing.
  • the embodiments of the present application also provide a computer-readable storage medium that stores instructions, and when the computer-readable storage medium runs on a data sending end, the data sending end is caused to execute the above Method steps for message parsing.
  • the embodiment of the present application also provides a computer program product containing instructions, when the computer program product runs on a data sending end, the data sending end is caused to execute the above-mentioned method steps of message parsing. .
  • An embodiment of the present application also provides a message parsing system.
  • the system includes a data sending end and a data receiving end, wherein:
  • the data sending end is the data sending end as described in FIG. 8; the data receiving end is the data receiving end as described in FIG. 9.
  • the computer program product includes one or more computer instructions.
  • the computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium.
  • the computer instructions may be transmitted from a website, computer, server, or data center.
  • the computer-readable storage medium may be any available medium that can be accessed by a network device or a data storage device such as a server or data center integrated with one or more available media.
  • the usable medium may be a magnetic medium (such as a floppy disk, a hard disk, and a magnetic tape), an optical medium (such as a digital video disk (Digital Video Disk, DVD), etc.), or a semiconductor medium (such as a solid-state hard disk, etc.).

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Computer Security & Cryptography (AREA)
  • Theoretical Computer Science (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Artificial Intelligence (AREA)
  • Health & Medical Sciences (AREA)
  • Multimedia (AREA)
  • Information Transfer Between Computers (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请提供了一种报文解析的方法、数据发送端、数据接收端和系统,属于网络技术领域。所述方法包括:数据发送端在创建XML报文时,可以在XML报文中添加目标标识用于指示XML报文中的独立报文块,独立报文块为独立的无上下文依赖的报文块,然后可以向数据接收端发送XML报文,数据接收端在接收XML报文的过程中,如果检测到XML报文存在目标标识,则可以从XML报文中截取目标标识对应的独立报文块,然后对截取出的独立报文块进行解析处理。采用本申请,提供了一种数据量大的报文的解析方式。

Description

报文解析的方法、数据发送端、数据接收端和系统 技术领域
本申请涉及网络技术领域,特别涉及一种报文解析的方法、数据发送端、数据接收端和系统。
背景技术
Netconf协议作为网络设备的一种通用配置协议,已经被网络设备广泛支持。例如,在软件定义网络(Software Defined Networking,SDN)结构中,控制器与转发器之间通过Netconf协议进行数据传输。在使用Netconf协议进行数据传输时,一般是使用可扩展标记语言(Extensible Markup Language,XML)报文的格式承载数据。
相关技术中,使用XML报文的格式承载数据时,一般是使用文档对象模型(Document Object Model,DOM)进行解析,具体解析方式为:将XML报文解析成一个树状的结构,该结构被称为节点树,在节点树中,使用包裹关系描述各个节点之间的关系,一般是根节点竖向包括父节点,父节点竖向包括子节点,兄弟节点为横向节点。
在实现本申请的过程中,发明人发现相关技术至少存在以下问题:
使用DOM进行解析时,由于是通过根节点进行横向以及竖向的访问,所以使用DOM进行解析时,需要将整个XML报文完整的缓存到内存中,才能对其进行操作,所以对内存的存储量的要求极高,不适于数据量大的报文的解析,所以需要提供一种数据量大的报文的解析方式。
发明内容
为了解决上述相关技术的问题,本申请实施例提供了一种报文解析的方法、数据发送端、数据接收端和系统。所述技术方案如下:
第一方面,提供了一种报文解析的方法,所述方法包括:
接收可扩展标记语言XML报文,在接收所述XML报文的过程中,如果检测到所述XML报文存在目标标识,则从所述XML报文中截取所述目标标识对应的独立报文块;对所述独立报文块进行解析处理。
其中,目标标识可以预设,并且存储在数据接收端,目标标识可以用于表征所对应的报文块为独立的无上下文依赖的独立报文块。
本申请实施例所示的方案,数据接收端可以接收数据发送端发送的XML报文,在接收该XML报文的过程中,如果检测到XML报文存在目标标识,则可以在XML报文中,截取目标标识所对应的独立报文块。这样,可以得到独立的无上下文依赖的独立报文块。然后可以对独立报文块进行解析处理。这样,在接收XML报文的过程中,由于遇到独立报文块可以直接进行进行截取,然后进行解析处理,而不需要将整个XML报文都缓存到内存中,所以可以相对降低对内存的存储量的要求,可以适用于数据量大的报文的解析,所以提供了一种数据量大的报文的解析方式。
在一种可能的实现方式中,所述方法还包括:使用SAX解析所述XML报文中未存在目标标识的节点的报文块。
本申请实施例所示的方案,数据接收端对于不存在目标标识的节点,可以获取这些节点的报文,按照简单的XML接口(Simple API for XML,SAX)方式进行解析,也就是在这些节点的报文全部接收完毕后,可以在缓冲中逐行读取,并识别如下事件,如XML开始、XML结束、tag开始、tag结束,子串值、异常等,并在每个事件时触发解析处理。这样,在除独立报文块之外的其它报文,在缓存完后,采用SAX方式也可以逐行读取,所以也可以边扫描边解析,占用的内存也比较小。
在一种可能的实现方式中,所述方法还包括:如果未检测到所述XML报文存在目标标识,则使用SAX解析所述XML报文。
本申请实施例所示的方案,数据接收端在整个XML报文中均未检测到目标标识,则可以使用SAX解析XML报文,也就是在XML报文全部缓冲完之后,从缓冲中逐行读取,并识别如下事件,如XML开始、XML结束、tag开始、tag结束,子串值、异常等,并在每个事件时触发解析处理。这样,在没有独立报文块时,在缓存完XML报文后,采用SAX方式也可以逐行读取,所以也可以边扫描边解析,占用的内存也比较小。
在一种可能的实现方式中,所述从所述XML报文中截取所述目标标识对应的独立报文块,包括:在所述XML报文中,从所述目标标识所在位置开始向左确定所述目标标识对应的独立报文块的起始点,并从所述目标标识所在位置开始向右确定所述目标标识对应的独立报文块的结束点;根据所述起始点和所述结束点,从所述XML报文中截取所述目标标识对应的独立报文块。
本申请实施例所示的方案,在确定出XML报文中存在目标标识,可以从目标标识所在位置开始向左确定目标标识对应的独立报文块的起始点,并且可以从目标标识所在位置开始向右确定目标标识对应的独立报文块的结束点,然后在XML报文中截取起始点和结束点之间的独立报文块。这样,就可以截取出目标标识对应的独立报文块。这样,由于可以使用起始点和结束点直接截取,可以提高截取效率。
在一种可能的实现方式中,所述目标标识为节点的属性的属性值;所述如果检测到所述XML报文存在目标标识,则从所述XML报文中截取所述目标标识对应的独立报文块,包括:如果检测到所述XML报文中目标节点的属性的属性值为目标标识,则根据所述目标节点,从所述XML报文中截取所述目标标识对应的独立报文块。
本申请实施例所示的方案,数据接收端在检测到报文中某个节点(即目标节点)的属性的属性值为目标标识,则可以根据目标标识,从XML报文中截取到目标标识对应的独立报文块。这样,目标节点可以是节点的属性的属性值。
在一种可能的实现方式中,所述根据所述目标节点,从所述XML报文中截取所述目标标识对应的独立报文块,包括:如果所述目标节点不包括子节点,则从所述XML报文中截取所述目标节点对应的独立报文块,如果所述目标节点包括子节点,则从所述XML报文中截取所述目标节点及所述目标节点包括的子节点对应的独立报文块。
本申请实施例所示的方案,数据接收端在检测到报文中某个节点(即目标节点)的属性的属性值为目标标识,则可以判断目标节点是否包括子节点,如果不包括子节点,则可以确定目标节点对应的独立报文块的起始点和结束点,然后从XML报文中截取起始点和结 束点之间的独立报文块,如果包括子节点,则可以确定目标节点以及目标节点包括的子节点对应的独立报文块的起始点和结束点,然后在XML报文中截取起始点和结束点之间的独立报文块。
在一种可能的实现方式中,所述目标标识为父节点的节点名称;所述如果检测到所述XML报文存在目标标识,则从所述XML报文中截取所述目标标识对应的独立报文块,包括:如果检测到所述XML报文中存在节点名称为目标标识的父节点,则从所述XML报文中截取节点名称为所述目标标识的父节点所包括的子节点对应的独立报文块。
本申请实施例所示的方案,数据接收端在确定某个父节点的节点名称为目标标识时,可以确定该父节点所包括的子节点,然后确定该子节点对应的独立报文块的起始点和结束点,然后从XML报文中截取起始点和结束点之间的独立报文块,该独立报文块即为可以独立解析的独立报文块。这样,目标标识可以为父节点的节点名称。
第二方面,提供了一种报文解析的方法,所述方法包括:
创建可扩展标记语言XML报文时,在所述XML报文中添加目标标识用于指示所述XML报文中的独立报文块,其中,所述独立报文块为独立的无上下文依赖的报文块;向数据接收端发送所述XML报文。
本申请实施例所示的方案,数据发送端要向数据接收端发送XML报文,在创建XML报文时,如果XML报文中某个报文块为独立的无上下文依赖的报文块,该报文块为独立报文块,则可以在该独立报文块中添加目标标识。如果XML报文中不存某个报文块为独立的无上下文依赖的报文块,则可以直接创建XML报文。然后向数据接收端发送创建的XML报文。这样,由于在独立报文块中添加了目标标识,所以数据接收端可以识别到独立报文块,在接收时,并行进行解析,而不需要等到全部缓存完进行解析,可以节约缓存的内存占用。
在一种可能的实现方式中,所述目标标识为节点的属性的属性值;所述在所述XML报文中添加目标标识用于指示所述XML报文中的独立报文块,包括:在所述XML报文中,确定所述XML报文中的独立报文块,将确定出的独立报文块所属节点的属性的属性值设置为所述目标标识。
本申请实施例所示的方案,数据发送端可以在XML报文中,确定无上下文依赖的报文块,为独立报文块,然后获取确定出的独立报文块所属节点的属性的属性值的标识位,将目标标识添加至该标识位,这样,确定出的独立报文块所属节点的属性的属性值为目标标识。
在一种可能的实现方式中,所述目标标识为父节点的节点名称;所述在所述XML报文中添加目标标识用于指示所述XML报文中的独立报文块,包括:在所述XML报文中,确定所述XML报文中的独立报文块,为确定出的独立报文块所属节点添加父节点,其中,添加的父节点的节点名称为所述目标标识。
本申请实施例所示的方案,数据发送端可以在XML报文中,确定无上下文依赖的报文块,为独立报文块,然后为确定出的独立报文块所属节点添加一个节点名称为目标标识的父节点。这样,添加的父节点的节点名称为目标标识。
第三方面,提供了一种报文解析的数据接收端,该数据接收端包括接收器、存储器和处理器,其中:
所述接收器,用于接收可扩展标记语言XML报文;
所述处理器,用于:
在接收所述XML报文的过程中,如果检测到所述XML报文存在目标标识,则从所述XML报文中截取所述目标标识对应的独立报文块;
对所述独立报文块进行解析处理。
在一种可能的实施方式中,所述处理器,还用于:
使用SAX解析所述XML报文中未存在目标标识的节点的报文块。
在一种可能的实施方式中,所述处理器,还用于:
如果未检测到所述XML报文存在目标标识,则使用SAX解析所述XML报文。
在一种可能的实施方式中,所述处理器,用于:
在所述XML报文中,从所述目标标识所在位置开始向左确定所述目标标识对应的独立报文块的起始点,并从所述目标标识所在位置开始向右确定所述目标标识对应的独立报文块的结束点;
根据所述起始点和所述结束点,从所述XML报文中截取所述目标标识对应的独立报文块。
在一种可能的实施方式中,所述目标标识为节点的属性的属性值;
所述处理器,用于:
如果检测到所述XML报文中目标节点的属性的属性值为目标标识,则根据所述目标节点,从所述XML报文中截取所述目标标识对应的独立报文块。
在一种可能的实施方式中,所述处理器,用于:
如果所述目标节点不包括子节点,则从所述XML报文中截取所述目标节点对应的独立报文块,如果所述目标节点包括子节点,则从所述XML报文中截取所述目标节点及所述目标节点包括的子节点对应的独立报文块。
在一种可能的实施方式中,所述目标标识为父节点的节点名称;
所述处理器,用于:
如果检测到所述XML报文中存在节点名称为目标标识的父节点,则从所述XML报文中截取节点名称为所述目标标识的父节点所包括的子节点对应的独立报文块。
第四方面,提供了一种报文解析的数据发送端,该数据发送端包括处理器、发送器和存储器,其中:
所述处理器,用于创建可扩展标记语言XML报文时,在所述XML报文中添加目标标识用于指示所述XML报文中的独立报文块,其中,所述独立报文块为独立的无上下文依赖的报文块;
所述发送器,用于向数据接收端发送所述XML报文。
在一种可能的实施方式中,所述目标标识为节点的属性的属性值;
所述处理器,用于:
在所述XML报文中,确定所述XML报文中的独立报文块,将确定出的独立报文块所属节点的属性的属性值设置为所述目标标识。
在一种可能的实施方式中,所述目标标识为父节点的节点名称;
所述处理器,用于:
在所述XML报文中,确定所述XML报文中的独立报文块,为确定出的独立报文块所属节点添加父节点,其中,添加的父节点的节点名称为所述目标标识。
第五方面,提供了一种报文解析的数据接收端,该数据接收端包括多个模块,通过该多个模块之间的协同功能,能够实现上述第一方面所提供的报文解析的方法。
第六方面,提供了一种报文解析的数据发送端,该数据发送端包括多个模块,通过该多个模块之间的协同功能,能够实现上述第二方面所提供的报文解析的方法。
第七方面,提供了一种计算机可读存储介质,所述计算机可读存储介质存储有指令,当所述计算机可读存储介质在数据接收端上运行时,使得所述数据接收端执行上述第一方面所述的方法。
第八方面,提供了一种包含指令的计算机程序产品,当所述计算机程序产品在数据接收端上运行时,使得所述数据接收端执行上述第一方面所述的方法。
第九方面,提供了一种计算机可读存储介质,所述计算机可读存储介质存储有指令,当所述计算机可读存储介质在数据发送端上运行时,使得所述数据发送端执行上述第二方面所述的方法。
第十方面,提供了一种包含指令的计算机程序产品,当所述计算机程序产品在数据发送端上运行时,使得所述数据发送端执行上述第二方面所述的方法。
第十一方面,提供了一种报文解析的系统,所述系统包括数据发送端和数据接收端,其中:所述数据发送端,如上述第六方面所述的数据发送端;所述数据接收端,如第五方法所述的数据接收端。
本申请实施例提供的技术方案带来的有益效果至少包括:
本申请实施例中,数据发送端在创建XML报文时,可以在XML报文中添加目标标识用于指示XML报文中的独立报文块,独立报文块为独立的无上下文依赖的报文块,然后可以向数据接收端发送XML报文,数据接收端在接收XML报文的过程中,如果检测到XML报文存在目标标识,则可以从XML报文中截取目标标识对应的独立报文块,然后对截取出的独立报文块进行解析处理。这样,在接收XML报文的过程中,由于遇到独立报文块可以直接进行进行截取,然后进行解析处理,而不需要将整个XML报文都缓存到内存中,所以可以相对降低对内存的存储量的要求,可以适用于数据量大的报文的解析,所以提供了一种数据量大的报文的解析方式。
而且,由于本申请实施例可以节约内存,所以在有限内存的情景下,可以实现报文的快速解析和响应,从而可以快速的进行业务响应、用户界面(User Interface,UI)刷新等,也可以提升用户的体验。
附图说明
图1是本申请实施例中一种对账操作的设备之间的结构示意图;
图2是本申请实施例中一种对账操作的设备之间的结构示意图;
图3是本申请实施例中一种数据接收端/数据发送端的结构示意图;
图4是本申请实施例中一种报文解析的方法的流程示意图;
图5是本申请实施例中一种节点树的示意图;
图6是本申请实施例中一种解析独立报文块的示意图;
图7是本申请实施例中一种解析独立报文块的示意图;
图8是本申请实施例中一种数据接收端的结构示意图;
图9是本申请实施例中一种数据发送端的结构示意图。
具体实施方式
为使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请实施方式作进一步地详细描述。
为了便于对本申请实施例的理解,下面首先介绍本申请实施例涉及的系统架构、以及所涉及到名词的概念。
本申请实施例可以适用于数据传输系统,数据传输系统包括数据发送端和数据接收端,数据发送端用于发送报文,数据接收端用于接收并解析报文。例如,在SDN网络中,控制器与转发器进行对账操作,在转发器上线由控制器纳管时,存在两种对账操作方式,如图1所示,为正向对账,以控制器的配置信息为准,控制器为数据发送端,转发器为数据接收端。或者,如图2所示,为反向对账,以转发器的配置信息为准,控制器为数据接收端,转发器为数据发送端。
SDN网络,是一种新型网络架构,主要特点是将网络控制面以软件方式实现。该架构可使网络管理员在不更改硬件设备的前提下,以中央控制方式用程序重新规划网络,为控制网络流量提供了新方案,也为核心网络和应用创新提供了良好平台。
DOM,是W3C组织推荐的处理可扩展置标语言的标准编程接口,DOM会将XML文档解析成一个树状的结构,该结构被称为节点树,DOM解析完毕后整个XML树形结构可以通过根节点进行横向(兄弟(sibling)之间)以及竖向(父(parent)与子(child)之间)的访问,即整个xml报文中的任意节点都在内存中对应了一个DOM节点。换句话说,DOM的解析方式需要将整个XML报文整个完整的解析内存中才能对其进行操作。这种解析方式对内存的要求极高,适合短小报文的解析方式。
SAX,是一种以事件驱动的XMl应用程序接口(Application Program Interface,API)。SAX与DOM不同的是它边扫描边解析,自顶向下依次解析,由于边扫描边解析,所以它解析XML具有速度快,占用内存少的优点。
Netconf协议,是RFC6241中定义的一种网络配置管理协议。是一种网络设备常用的配置协议。
对账操作,是数据接收端与数据发送端的数据同步过程。
本申请实施例提供了一种报文解析的方法,该方法的执行主体可以是数据接收端和数据发送端,数据接收端可以是任何可以接收XML报文的设备,数据发送端可以是创建并发送XML报文的设备。
图3示出了本申请实施例中数据接收端和数据发送端的结构框图,该数据接收端和数据发送端分别至少可以包括接收器301、处理器302、存储器303和发射器304。其中,接收器301可以用于实现数据的接收,具体可以用于XML报文的接收,发射器304可以用于数据的发送,具体可以用于XML报文的发送,存储器303可以用于存储软件程序以及模块, 处理器302通过运行存储在存储器303中的软件程序以及模块,从而执行各种功能应用以及数据处理。存储器303可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序等;存储数据区可存储根据数据接收端的使用所创建的数据等。此外,存储器303可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。相应地,存储器303还可以包括存储器控制器,以提供处理器302、接收器301和发射器304对存储器303的访问。处理器302是数据接收端的控制中心,利用各种接口和线路连接整个数据接收端的各个部分,通过运行或执行存储在存储器303内的软件程序和/或模块,以及调用存储在存储器303内的数据,执行数据接收端的各种功能和处理数据,从而对数据接收端进行整体监控。
可选的,处理器302可包括一个或多个处理核心;优选的,处理器302可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器302中。
本申请实施例提供了一种报文解析的方法,应用于数据接收端和数据发送端,如图4所示,该方法的处理流程可以如下:
步骤401,数据发送端创建XML报文时,在XML报文中添加目标标识用于指示XML报文中的独立报文块,其中,独立报文块为独立的无上下文依赖的报文块。
在实施中,数据发送端要向数据接收端发送XML报文,在创建XML报文时,如果XML报文中某个报文块为独立的无上下文依赖的报文块,该报文块为独立报文块,则可以在该独立报文块中添加目标标识。如果XML报文中不存某个报文块为独立的无上下文依赖的报文块,则可以直接创建XML报文。
可选的,目标标识可以为节点的属性的属性值,相应的,添加目标标识的处理可以如下:
在XML报文中,确定XML报文中的独立报文块,将确定出的独立报文块所属节点的属性的属性值设置为目标标识。
在实施中,一般XML语言的报文体本身是一个树形结构,每个节点由节点名称、命名空间、节点值、属性以及属性值构成。所以在数据发送端,可以针对可独立报文块(即没有上下文依赖)所属节点添加一个标识(即目标标识),该标识以节点的属性的方式呈现。如“fragment="independent"”,此处“fragment”为属性,“independent”为属性值,这样,在某个节点的属性的属性值为目标标识时,就说明这个节点对应的独立报文块可以不基于上下文独立解析。也即数据发送端可以在XML报文中,确定无上下文依赖的报文块,为独立报文块,然后获取确定出的独立报文块所属节点的属性的属性值的标识位,将目标标识添加至该标识位,这样,确定出的独立报文块所属节点的属性的属性值为目标标识。
可选的,目标标识为父节点的节点名称,相应的,添加目标标识的处理可以如下:
在XML报文中,确定XML报文中的独立报文块,为确定出的独立报文块所属节点添加父节点,其中,添加的父节点的节点名称为目标标识。
在实施中,通过定义新XML上层节点(此处不限于具体的节点名称)来识别独立解析的 独立报文块(即不需要通过上下文也可以解析的独立报文块)。如上文,XML语言本身是一个树形结构,每个节点由节点名称、命名空间、节点值、属性以及属性值构成。在数据发送端,通过添加新的节点名称为目标标识的节点作为父节点,将一个可独立解析的独立报文块作为该父节点的子节点。这样,某个父节点的节点名称为目标标识时,说明这个父节点包括的子节点的独立报文块可以不基于上下文独立解析。也即数据发送端可以在XML报文中,确定无上下文依赖的报文块,为独立报文块,然后为确定出的独立报文块所属节点添加一个节点名称为目标标识的父节点。这样,添加的父节点的节点名称为目标标识。
步骤402,数据发送端向数据接收端发送XML报文。
在实施中,数据发送端创建好XML报文后,可以向数据接收端发送创建好的XML报文。
步骤403,数据接收端接收XML报文。
在实施中,数据接收端可以持续接收数据发送端发送的XML报文组成的字符流。
步骤404,数据接收端在接收XML报文的过程中,如果检测到XML报文存在目标标识,则从XML报文中截取目标标识对应的独立报文块。
其中,目标标识可以预设,并且存储在数据接收端,目标标识可以用于表征所对应的报文块为独立的无上下文依赖的独立报文块。
在实施中,数据接收端在接收到数据发送端发送的XML报文组成的字符流过程中,可以检测接收到的XML报文中是否存在目标标识,如果存在目标标识,则可以从XML报文中截取目标标识所对应的独立报文块。这样,可以得到独立的无上下文依赖的独立报文块。
可选的,可以首先确定目标标识对应的独立报文块的起始点和结束点,然后再截取独立报文块,相应的处理可以如下:
在XML报文中,从目标标识所在位置开始向左确定目标标识对应的独立报文块的起始点,并从目标标识所在位置开始向右确定目标标识对应的独立报文块的结束点,根据起始点和结束点,从XML报文中截取目标标识对应的独立报文块。
在实施中,在确定出XML报文中存在目标标识,可以从目标标识所在位置开始向左确定目标标识对应的独立报文块的起始点,并且可以从目标标识所在位置开始向右定目标标识对应的独立报文块的结束点,然后在XML报文中截取起始点和结束点之间的独立报文块。这样,就可以截取出目标标识对应的独立报文块。
例如,XML报文<block0>xxxxxxxx</block0><block1 fragment="independent">xxxxxxxx</block1><block2>xxxxxxxx</block2>中,目标标识为"independent",找到目标标识后,向左找到起始点为<block1,向右找到结束点为</block1>,这样,截取出的独立报文块为<block1 fragment="independent">xxxxxxxx</block1>。
需要说明的是,由于XML语言有自身特点,所以可以找到起始点和结束点。
可选的,在XML报文中,目标标识可以是任意一种可以表征独立报文块的标识,以下给出两种可行的实施方式:
方式一:目标标识为节点的属性的属性值;如果检测到XML报文中目标节点的属性的属性值为目标标识,则根据目标节点,从XML报文中截取目标标识对应的独立报文块。
在实施中,数据接收端在检测到报文中某个节点(即目标节点)的属性的属性值为目标标识,则可以根据目标节点,从XML报文中截取到目标标识对应的独立报文块。
可选的,基于目标节点是否包含子节点,截取目标标识对应的独立报文块,相应的处理可以如下:
如果目标节点不包括子节点,则从XML报文中截取目标节点对应的独立报文块,如果目标节点包括子节点,则从XML报文中截取目标节点及目标节点包括的子节点对应的独立报文块。
在实施中,数据接收端在检测到报文中某个节点(即目标节点)的属性的属性值为目标标识,则可以判断目标节点是否包括子节点,如果包括不包括子节点,则可以确定目标节点对应的独立报文块的起始点和结束点,然后从XML报文中截取起始点和结束点之间的独立报文块,如果包括子节点,则可以确定目标节点以及目标节点包括的子节点对应的独立报文块的起始点和结束点,然后在XML报文中截取起始点和结束点之间的独立报文块。
例如,在SDN网络中,控制器与转发器之间进行正向对账操作(即控制器向转发器同步自身的配置)时,在创建配置的XML报文时,在顶层节点(即“<fast>”节点)中添加目标标识“independent”,如下所示:
Figure PCTCN2019075752-appb-000001
"independent"为<fast>”节点的属性的属性值,使用XML语法特点,向左可以得到目标 标识对应的独立报文块的起始点为<bbf中的“<”位置处,向右可以得到目标标识对应的独立报文块的结束点为</bbf-fast:fast>中的“>”位置处。
需要说明的是,在目标节点包括子节点时,目标节点和目标节点包括的子节点对应的独立报文块是独立的,所以可以截取出目标节点以及目标节点包括的子节点对应的独立报文块。
方式二:目标标识为父节点的节点名称;如果检测到XML报文中存在节点名称为目标标识的父节点,则从XML报文中截取节点名称为目标标识的父节点所包括的子节点对应的独立报文块。
在实施中,数据接收端在确定某个父节点的节点名称为目标标识时,可以确定该父节点所包括的子节点,然后确定该子节点对应的独立报文块的起始点和结束点,然后从XML报文中截取起始点和结束点之间的独立报文块,该独立报文块即为可以独立解析的独立报文块。
例如,在SDN网络中,控制器与转发器之间进行正向对账操作(即控制器向转发器同步自身的配置)时,在创建配置的XML报文时,在为<fast>”节点添加父节点<independent-fragment-root>,如下所示:
Figure PCTCN2019075752-appb-000002
Figure PCTCN2019075752-appb-000003
<independent-fragment-root>和</independent-fragment-root>之间的独立报文块为独立解析的独立报文块。
需要说明的是,上述目标标识仅为两种可选的方式。
步骤405,数据接收端对独立报文块进行解析处理。
在实施中,数据接收端在获取到独立的无上文依赖的独立报文块后,可以投递到解析线程池,启动解析线程进行解析。
需要说明书的,由于截取出的独立报文块一般比较小,所以可以直接使用DOM方式进行解析。例如:独立报文块为:
Figure PCTCN2019075752-appb-000004
解析得到的XML树形结构如图5所示,body为div与ul为父节点,div与ul为body的子节点,div与ul为兄弟节点。
另外,在数据接收端截取到独立报文块后,可以将其添加至独立报文缓冲区(独立报文缓存区与XML报文中除截取到的独立报文块之外的其它报文的缓存区不同),然后解析任务管理器识别到独立报文缓存区有可解析的独立报文块,可以启动解析线程,进行解析。如图6所示,针对上述方式一中,提供了解析流程示意图,<block1>节点为目标节点,目标标识对应的独立报文块的起始点为<block1>中的“<”,结束点为</block1>中的“>”,截取出的独立报文块为<block1>中“<”与</block1>中“>”之间的独立报文块,即添加至独立报文缓存区的独立报文块为<block1>中“<”与</block1>中“>”之间的独立报文块,然后解析线程进行解析。如图7所示,针对上述方式二中,提供了解析流程示意图,<block1>节点对应的独立报文块为独立报文块,目标标识对应的独立报文块的起始点为<independent-fragment-root>中的“<”,结束点为</independent-fragment-root>中的“>”,截取出的独立报文块为<independent-fragment-root>中“<”与</independent-fragment-root>中“>”之间的独立报文块,即添加至独立报文缓存区的独立报文块为<independent-fragment-root>中“<”与</independent-fragment-root>中“>”之间的独立报文块,然后解析线程进行解析。
可选的,对于不存在目标标识的节点,可以使用SAX方式进行解析,相应的处理可以如下:
使用SAX解析XML报文中未存在目标标识的节点的报文。
在实施中,数据接收端对于不存在目标标识的节点,可以获取这些节点的报文,按照SAX方式进行解析,也就是在这些节点的报文全部接收完毕后,可以在缓冲中逐行读取,并识别如下事件,如XML开始、XML结束、tag开始、tag结束,子串值、异常等,并在每个事件时触发解析处理。
可选的,如果XML报文中不存在目标标识,可以使用SAX方式进行解析XML报文, 相应的处理可以如下:
如果未检测到XML报文存在目标标识,则使用SAX解析XML报文。
在实施中,数据接收端在整个XML报文中均未检测到目标标识,则可以使用SAX解析XML报文,也就是在XML报文全部缓冲完之后,从缓冲中逐行读取,并识别如下事件,如XML开始、XML结束、tag开始、tag结束,子串值、异常等,并在每个事件时触发解析处理。
需要说明的是,本申请实施例中,上述报文解析的方法不仅可以应用于SDN网络中网络设备之间的报文接收,还可以用于任何基于XML语法承载报文的连个功能体之间的报文传输。例如,移动终端与云端服务器之间的数据同步,集群环境中不同业务节点之间的数据同步等。
本申请实施例中,数据发送端在创建XML报文时,可以在XML报文中添加目标标识用于指示XML报文中的独立报文块,独立报文块为独立的无上下文依赖的报文块,然后可以向数据接收端发送XML报文,数据接收端在接收XML报文的过程中,如果检测到XML报文存在目标标识,则可以从XML报文中截取目标标识对应的独立报文块,然后对截取出的独立报文块进行解析处理。这样,在接收XML报文的过程中,由于遇到独立报文块可以直接进行进行截取,然后进行解析处理,而不需要将整个XML报文都缓存到内存中,所以可以相对降低对内存的存储量的要求,可以适用于数据量大的报文的解析,所以提供了一种数据量大的报文的解析方式。
而且,由于本申请实施例可以节约内存,所以在有限内存的情景下,可以实现报文的快速解析和响应,从而可以快速的进行业务响应、用户界面(User Interface,UI)刷新等,也可以提升用户的体验。
图8是本申请实施例提供的报文解析的数据接收端的结构图。该数据接收端可以通过软件、硬件或者两者的结合实现成为终端中的部分或者全部。本申请实施例提供的报文解析的数据接收端可以实现本申请实施例图4的流程,该数据接收端包括:接收模块810、截取模块820和解析模块830,其中:
接收模块810,用于接收可扩展标记语言XML报文;
截取模块820,用于在接收所述XML报文的过程中,如果检测到所述XML报文存在目标标识,则从所述XML报文中截取所述目标标识对应的独立报文块;
解析模块830,用于对所述独立报文块进行解析处理。
可选的,所述解析模块830,还用于:
使用SAX解析所述XML报文中未存在目标标识的节点的报文块。
可选的,所述解析模块830,还用于:
如果未检测到所述XML报文存在目标标识,则使用SAX解析所述XML报文。
可选的,所述截取模块820,用于:
在所述XML报文中,从所述目标标识所在位置开始向左确定所述目标标识对应的独立报文块的起始点,并从所述目标标识所在位置开始向右确定所述目标标识对应的独立报文块的结束点;
根据所述起始点和所述结束点,从所述XML报文中截取所述目标标识对应的独立报文 块。
可选的,所述目标标识为节点的属性的属性值;
所述截取模块820,用于:
如果检测到所述XML报文中目标节点的属性的属性值为目标标识,则根据所述目标节点,从所述XML报文中截取所述目标标识对应的独立报文块。
可选的,所述截取模块820,用于:
如果所述目标节点不包括子节点,则从所述XML报文中截取所述目标节点对应的独立报文块,如果所述目标节点包括子节点,则从所述XML报文中截取所述目标节点及所述目标节点包括的子节点对应的独立报文块。
可选的,所述目标标识为父节点的节点名称;
所述截取模块820,用于:
如果检测到所述XML报文中存在节点名称为目标标识的父节点,则从所述XML报文中截取节点名称为所述目标标识的父节点所包括的子节点对应的独立报文块。
本申请实施例中,数据发送端在创建XML报文时,可以在XML报文中添加目标标识用于指示XML报文中的独立报文块,独立报文块为独立的无上下文依赖的报文块,然后可以向数据接收端发送XML报文,数据接收端在接收XML报文的过程中,如果检测到XML报文存在目标标识,则可以从XML报文中截取目标标识对应的独立报文块,然后对截取出的独立报文块进行解析处理。这样,在接收XML报文的过程中,由于遇到独立报文块可以直接进行进行截取,然后进行解析处理,而不需要将整个XML报文都缓存到内存中,所以可以相对降低对内存的存储量的要求,可以适用于数据量大的报文的解析,所以提供了一种数据量大的报文的解析方式。
需要说明的是:上述实施例提供的数据接收端在进行报文解析时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将数据接收端的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的数据接收端与报文解析的方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。
图9是本申请实施例提供的报文解析的数据发送端的结构图。该数据发送端可以通过软件、硬件或者两者的结合实现成为终端中的部分或者全部。本申请实施例提供的报文解析的数据发送端可以实现本申请实施例图4的流程,该数据发送端包括:创建模块910和发送模块920,其中:
创建模块910,用于创建可扩展标记语言XML报文时,在所述XML报文中添加目标标识用于指示所述XML报文中的独立报文块,其中,所述独立报文块为独立的无上下文依赖的报文块;
发送模块920,用于向数据接收端发送所述XML报文。
可选的,所述目标标识为节点的属性的属性值;
所述创建模块910,用于:
在所述XML报文中,确定所述XML报文中的独立报文块,将确定出的独立报文块所属节点的属性的属性值设置为所述目标标识。
可选的,所述目标标识为父节点的节点名称;
所述创建模块910,用于:
在所述XML报文中,确定所述XML报文中的独立报文块,为确定出的独立报文块所属节点添加父节点,其中,添加的父节点的节点名称为所述目标标识。
本申请实施例中,数据发送端在创建XML报文时,可以在XML报文中添加目标标识用于指示XML报文中的独立报文块,独立报文块为独立的无上下文依赖的报文块,然后可以向数据接收端发送XML报文,数据接收端在接收XML报文的过程中,如果检测到XML报文存在目标标识,则可以从XML报文中截取目标标识对应的独立报文块,然后对截取出的独立报文块进行解析处理。这样,在接收XML报文的过程中,由于遇到独立报文块可以直接进行进行截取,然后进行解析处理,而不需要将整个XML报文都缓存到内存中,所以可以相对降低对内存的存储量的要求,可以适用于数据量大的报文的解析,所以提供了一种数据量大的报文的解析方式。
需要说明的是:上述实施例提供的数据发送端在进行报文解析时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将数据发送端的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的数据发送端与报文解析的方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。
本申请实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质存储有指令,当所述计算机可读存储介质在数据接收端上运行时,使得所述数据接收端执行上述报文解析的方法步骤。
本申请实施例还提供了一种包含指令的计算机程序产品,当所述计算机程序产品在数据接收端上运行时,使得所述数据接收端执行上述报文解析的方法步骤。
本申请实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质存储有指令,当所述计算机可读存储介质在数据发送端上运行时,使得所述数据发送端执行上述报文解析的方法步骤。
本申请实施例还提供了一种包含指令的计算机程序产品,当所述计算机程序产品在数据发送端上运行时,使得所述数据发送端执行上述报文解析的方法步骤。。
本申请实施例还提供了一种报文解析的系统,所述系统包括数据发送端和数据接收端,其中:
所述数据发送端,如图8所述的数据发送端;所述数据接收端,如图9所述的数据接收端。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现,当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产 品包括一个或多个计算机指令,在网络设备上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴光缆、光纤、数字用户线)或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是网络设备能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质(如软盘、硬盘和磁带等),也可以是光介质(如数字视盘(Digital Video Disk,DVD)等),或者半导体介质(如固态硬盘等)。
以上所述仅为本申请的一种可行的实施例,并不用以限制本申请,凡在本申请的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。

Claims (25)

  1. 一种报文解析的方法,其特征在于,所述方法包括:
    接收可扩展标记语言XML报文;
    在接收所述XML报文的过程中,如果检测到所述XML报文存在目标标识,则从所述XML报文中截取所述目标标识对应的独立报文块;
    对所述独立报文块进行解析处理。
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    使用SAX解析所述XML报文中未存在目标标识的节点的报文块。
  3. 根据权利要求1或2所述的方法,其特征在于,所述方法还包括:
    如果未检测到所述XML报文存在目标标识,则使用SAX解析所述XML报文。
  4. 根据权利要求1至3任一所述的方法,其特征在于,所述从所述XML报文中截取所述目标标识对应的独立报文块,包括:
    在所述XML报文中,从所述目标标识所在位置开始向左确定所述目标标识对应的独立报文块的起始点,并从所述目标标识所在位置开始向右确定所述目标标识对应的独立报文块的结束点;
    根据所述起始点和所述结束点,从所述XML报文中截取所述目标标识对应的独立报文块。
  5. 根据权利要求1至4任一所述的方法,其特征在于,所述目标标识为节点的属性的属性值;
    所述如果检测到所述XML报文存在目标标识,则从所述XML报文中截取所述目标标识对应的独立报文块,包括:
    如果检测到所述XML报文中目标节点的属性的属性值为目标标识,则根据所述目标节点,从所述XML报文中截取所述目标标识对应的独立报文块。
  6. 根据权利要求5所述的方法,其特征在于,所述根据所述目标节点,从所述XML报文中截取所述目标标识对应的独立报文块,包括:
    如果所述目标节点不包括子节点,则从所述XML报文中截取所述目标节点对应的独立报文块,如果所述目标节点包括子节点,则从所述XML报文中截取所述目标节点及所述目标节点包括的子节点对应的独立报文块。
  7. 根据权利要求1至4任一所述的方法,其特征在于,所述目标标识为父节点的节点名称;
    所述如果检测到所述XML报文存在目标标识,则从所述XML报文中截取所述目标标识对应的独立报文块,包括:
    如果检测到所述XML报文中存在节点名称为目标标识的父节点,则从所述XML报文中截取节点名称为所述目标标识的父节点所包括的子节点对应的独立报文块。
  8. 一种报文解析的方法,其特征在于,所述方法包括:
    创建可扩展标记语言XML报文时,在所述XML报文中添加目标标识用于指示所述XML报文中的独立报文块,其中,所述独立报文块为独立的无上下文依赖的报文块;
    向数据接收端发送所述XML报文。
  9. 根据权利要求8所述的方法,其特征在于,所述目标标识为节点的属性的属性值;
    所述在所述XML报文中添加目标标识用于指示所述XML报文中的独立报文块,包括:
    在所述XML报文中,确定所述XML报文中的独立报文块;
    将确定出的独立报文块所属节点的属性的属性值设置为目标标识。
  10. 根据权利要求8所述的方法,其特征在于,所述目标标识为父节点的节点名称;
    所述在所述XML报文中添加目标标识用于指示所述XML报文中的独立报文块,包括:
    在所述XML报文中,确定所述XML报文中的独立报文块;
    为确定出的独立报文块所属节点添加父节点,其中,添加的父节点的节点名称为目标标识。
  11. 一种报文解析的数据接收端,其特征在于,所述数据接收端包括:
    接收模块,用于接收可扩展标记语言XML报文;
    截取模块,用于在接收所述XML报文的过程中,如果检测到所述XML报文存在目标标识,则从所述XML报文中截取所述目标标识对应的独立报文块;
    解析模块,用于对所述独立报文块进行解析处理。
  12. 根据权利要求11所述的数据接收端,其特征在于,所述解析模块,还用于:
    使用SAX解析所述XML报文中未存在目标标识的节点的报文块。
  13. 根据权利要求11或12所述的数据接收端,其特征在于,所述解析模块,还用于:
    如果未检测到所述XML报文存在目标标识,则使用SAX解析所述XML报文。
  14. 根据权利要求11至13任一所述的数据接收端,其特征在于,所述截取模块,用于:
    在所述XML报文中,从所述目标标识所在位置开始向左确定所述目标标识对应的独立报文块的起始点,并从所述目标标识所在位置开始向右确定所述目标标识对应的独立报文块的结束点;
    根据所述起始点和所述结束点,从所述XML报文中截取所述目标标识对应的独立报文块。
  15. 根据权利要求11至14任一所述的数据接收端,其特征在于,所述目标标识为节点的属性的属性值;
    所述截取模块,用于:
    如果检测到所述XML报文中目标节点的属性的属性值为目标标识,则根据所述目标节点,从所述XML报文中截取所述目标标识对应的独立报文块。
  16. 根据权利要求15所述的数据接收端,其特征在于,所述截取模块,用于:
    如果所述目标节点不包括子节点,则从所述XML报文中截取所述目标节点对应的独立报文块,如果所述目标节点包括子节点,则从所述XML报文中截取所述目标节点及所述目标节点包括的子节点对应的独立报文块。
  17. 根据权利要求11至14任一所述的数据接收端,其特征在于,所述目标标识为父节点的节点名称;
    所述截取模块,用于:
    如果检测到所述XML报文中存在节点名称为目标标识的父节点,则从所述XML报文中 截取节点名称为所述目标标识的父节点所包括的子节点对应的独立报文块。
  18. 一种报文解析的数据发送端,其特征在于,所述数据发送端包括:
    创建模块,用于创建可扩展标记语言XML报文时,在所述XML报文中添加目标标识用于指示所述XML报文中的独立报文块,其中,所述独立报文块为独立的无上下文依赖的报文块;
    发送模块,用于向数据接收端发送所述XML报文。
  19. 根据权利要求18所述的数据发送端,其特征在于,所述目标标识为节点的属性的属性值;
    所述创建模块,用于:
    在所述XML报文中,确定所述XML报文中的独立报文块;
    将确定出的独立报文块所属节点的属性的属性值设置为目标标识。
  20. 根据权利要求8所述的数据发送端,其特征在于,所述目标标识为父节点的节点名称;
    所述创建模块,用于:
    在所述XML报文中,确定所述XML报文中的独立报文块;
    为确定出的独立报文块所属节点添加父节点,其中,添加的父节点的节点名称为目标标识。
  21. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有指令,当所述计算机可读存储介质在数据接收端上运行时,使得所述数据接收端执行所述权利要求1-7中任一权利要求所述的方法。
  22. 一种包含指令的计算机程序产品,其特征在于,当所述计算机程序产品在数据接收端上运行时,使得所述数据接收端执行所述权利要求1-7中任一权利要求所述的方法。
  23. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有指令,当所述计算机可读存储介质在数据发送端上运行时,使得所述数据发送端执行所述权利要求8-10中任一权利要求所述的方法。
  24. 一种包含指令的计算机程序产品,其特征在于,当所述计算机程序产品在数据发送端上运行时,使得所述数据发送端执行所述权利要求8-10中任一权利要求所述的方法。
  25. 一种报文解析的系统,其特征在于,所述系统包括数据发送端和数据接收端,其中:
    所述数据发送端,如上述权利要求18-20任一所述的数据发送端;
    所述数据接收端,如上述权利要求11-17任一所述的数据接收端。
PCT/CN2019/075752 2019-02-21 2019-02-21 报文解析的方法、数据发送端、数据接收端和系统 WO2020168521A1 (zh)

Priority Applications (4)

Application Number Priority Date Filing Date Title
EP19916377.5A EP3913879A4 (en) 2019-02-21 2019-02-21 MESSAGE SYNTACSIS METHOD, DATA SENDING END, DATA RECEIVING END AND SYSTEM
PCT/CN2019/075752 WO2020168521A1 (zh) 2019-02-21 2019-02-21 报文解析的方法、数据发送端、数据接收端和系统
CN201980061022.XA CN112740635B (zh) 2019-02-21 2019-02-21 报文解析的方法、数据发送端、数据接收端和系统
US17/407,705 US11956337B2 (en) 2019-02-21 2021-08-20 Message parsing method, data transmit end, data receive end, and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/075752 WO2020168521A1 (zh) 2019-02-21 2019-02-21 报文解析的方法、数据发送端、数据接收端和系统

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US17/407,705 Continuation US11956337B2 (en) 2019-02-21 2021-08-20 Message parsing method, data transmit end, data receive end, and system

Publications (1)

Publication Number Publication Date
WO2020168521A1 true WO2020168521A1 (zh) 2020-08-27

Family

ID=72144827

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/075752 WO2020168521A1 (zh) 2019-02-21 2019-02-21 报文解析的方法、数据发送端、数据接收端和系统

Country Status (4)

Country Link
US (1) US11956337B2 (zh)
EP (1) EP3913879A4 (zh)
CN (1) CN112740635B (zh)
WO (1) WO2020168521A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101329665A (zh) * 2007-06-18 2008-12-24 国际商业机器公司 解析标记语言文档的方法和解析器
CN101976244A (zh) * 2010-09-30 2011-02-16 北京飞天诚信科技有限公司 对xml报文中的节点进行划分及其对其应用的方法
KR101553660B1 (ko) * 2014-08-18 2015-09-18 가천대학교 산학협력단 Xml 문서 파싱 시스템 및 방법
CN107301207A (zh) * 2017-06-02 2017-10-27 北京天融信网络安全技术有限公司 一种解析xml的方法及装置

Family Cites Families (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7134072B1 (en) * 1999-10-13 2006-11-07 Microsoft Corporation Methods and systems for processing XML documents
US20080141112A1 (en) * 2004-10-27 2008-06-12 Jumpei Aoki Document Processing Device and Document Processing Method
GB0428365D0 (en) * 2004-12-24 2005-02-02 Ibm Methods and apparatus for generating a parser and parsing a document
US7409636B2 (en) * 2005-07-29 2008-08-05 Microsoft Corporation Lightweight application program interface (API) for extensible markup language (XML)
US8549122B2 (en) * 2006-12-04 2013-10-01 Oracle International Corporation System and method for communication agent within a fully distributed network
FR2911200A1 (fr) * 2007-01-09 2008-07-11 Canon Kk Procede et dispositif de traitement de documents a partir de schemas enrichis et procede et dispositif de decodage correspondants
CN100489862C (zh) * 2007-06-22 2009-05-20 腾讯科技(深圳)有限公司 标记性语言文档的解析方法、解析模块和用户终端
JP5102067B2 (ja) * 2008-02-27 2012-12-19 株式会社リコー 情報処理装置、情報処理方法、プログラムおよび記録媒体
US8522136B1 (en) * 2008-03-31 2013-08-27 Sonoa Networks India (PVT) Ltd. Extensible markup language (XML) document validation
JP4688111B2 (ja) * 2008-11-28 2011-05-25 インターナショナル・ビジネス・マシーンズ・コーポレーション 情報処理装置、データベース・システム、情報処理方法、およびプログラム
US8255394B2 (en) * 2009-06-01 2012-08-28 International Business Machines Corporation Apparatus, system, and method for efficient content indexing of streaming XML document content
US20110320926A1 (en) * 2010-06-28 2011-12-29 Oracle International Corporation Generating xml schemas for xml document
US10515141B2 (en) * 2012-07-18 2019-12-24 Software Ag Usa, Inc. Systems and/or methods for delayed encoding of XML information sets
US10915575B2 (en) * 2012-09-28 2021-02-09 Oracle International Corporation Evaluating XML full text search
US9639631B2 (en) * 2013-02-27 2017-05-02 Cellco Partnership Converting XML to JSON with configurable output
US9098558B2 (en) * 2013-04-01 2015-08-04 Oracle International Corporation Enhanced flexibility for users to transform XML data to a desired format
CN104516927B (zh) * 2013-09-30 2017-09-12 腾讯科技(深圳)有限公司 文档处理方法、装置和终端
CN104753891B (zh) * 2013-12-31 2019-04-05 中国移动通信集团湖南有限公司 一种xml报文解析方法及装置
US9600596B2 (en) * 2014-04-08 2017-03-21 Sap Se Parser wrapper class
US9542502B2 (en) * 2014-09-08 2017-01-10 Siemens Product Lifecycle Management Software Inc. System and method for XML subdocument selection
US20190034392A1 (en) * 2017-07-31 2019-01-31 Ca, Inc. Correlation across hierarchical serialization boundaries

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101329665A (zh) * 2007-06-18 2008-12-24 国际商业机器公司 解析标记语言文档的方法和解析器
CN101976244A (zh) * 2010-09-30 2011-02-16 北京飞天诚信科技有限公司 对xml报文中的节点进行划分及其对其应用的方法
KR101553660B1 (ko) * 2014-08-18 2015-09-18 가천대학교 산학협력단 Xml 문서 파싱 시스템 및 방법
CN107301207A (zh) * 2017-06-02 2017-10-27 北京天融信网络安全技术有限公司 一种解析xml的方法及装置

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3913879A4 *

Also Published As

Publication number Publication date
CN112740635A (zh) 2021-04-30
US11956337B2 (en) 2024-04-09
US20210385309A1 (en) 2021-12-09
EP3913879A4 (en) 2022-01-19
CN112740635B (zh) 2022-04-05
EP3913879A1 (en) 2021-11-24

Similar Documents

Publication Publication Date Title
US11212335B2 (en) Network management interface
US20230319534A1 (en) Cross-resource subscription for m2m service layer
US11042546B2 (en) Normalization and extraction of log data
CN111258627B (zh) 一种接口文档生成方法和装置
US11929873B1 (en) OPC UA-based centralized user configuration method and system for time-sensitive network
WO2020062959A1 (zh) 配置数据的方法及装置
US20210224144A1 (en) Implicit push data transfer
CN109714408B (zh) 一种基于Handle标识的语义化工业网络服务接口系统
CN111490893A (zh) 一种网络转发模型的建立方法、装置及系统
WO2016201988A1 (zh) 配置数据推送方法及装置
WO2024060408A1 (zh) 网络攻击检测方法和装置、设备及存储介质
WO2016110070A1 (zh) 数据获取方法及装置、存储介质
US20230308348A1 (en) Server to support client data models from heterogeneous data sources
WO2015131523A1 (zh) 数据查询方法、系统及计算机存储介质
KR102226915B1 (ko) 소프트웨어 정의 네트워크에서 플로우 룰 데이터베이스를 운영하는 방법, 장치 및 컴퓨터 프로그램
WO2021097713A1 (zh) 分布式安全检测系统、方法、设备及存储介质
WO2020168521A1 (zh) 报文解析的方法、数据发送端、数据接收端和系统
CN113608778A (zh) 应用管理方法及装置、存储介质、电子设备
US11799750B1 (en) Systems and methods for HPACK table restoration
EP4322494A1 (en) Data transmission method, apparatus and system
WO2021147375A1 (zh) 数据管理方法、装置、设备、计算机可读存储介质及系统
CN112217919B (zh) 一种用于实现网络地址转换的方法及系统
US20230412466A1 (en) Managing cloud-native virtual network functions
CN115361264A (zh) 节点管理方法、装置、节点、系统及存储介质
CN115982285A (zh) 数据处理方法、设备及计算机可读存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19916377

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2019916377

Country of ref document: EP

Effective date: 20210817

NENP Non-entry into the national phase

Ref country code: DE