Mgen object 744: shrinking text and XML rows

Source: Internet
Author: User

Object 744 can be configured to try to shrink rows in text or XML. This function is usually used to remove unnecessary spaces before each row.

Software Information:

Minimum Environment Supported languages
. Net 3.0 Chinese/English

 

Download the current version of the program and source code
Download Page
Note: the link is the Microsoft SkyDrive page. When downloading, use a browser to download it directly. Some download tools may not be available for downloading.
Program environment:. NET Framework 3.0
Source code environment: Microsoft Visual Studio express 2012 for Windows Desktop
Note: The Source Code does not contain the referenced external class library file: mgen fx17 project 3.2

 

Text operations are simple:

For example:

######

# Pai_^

######

To contract, copy and paste the preceding text to the interface, and set the search content to "#":

Then the text is reduced:

 

It's easy, right. The XML contraction function is similar to the text, except that XML cannot be split by row directly. Instead, XML selects the project to be shrunk through XPath. (Note: If an XML document contains declared entities, you must declare the entities in the DTD. Otherwise, an error occurs. Object 744 will only be added to the HTML & nbsp; object declaration by default ).

 

For example, the following HTML:

<Body>

<Div class = "mgen_code" style = "background-color: #262626; Border: 1px solid gray; margin: 12px; padding: 10px;">

<P>

<Span style = "color: # f1f2f3;"> & nbsp; </span>

<Span style = "color: #93c763;"> catch </span>

<Span style = "color: # f1f2f3;"> (</span>

<Span style = "color: #678cb1;"> exception </span>

<Span style = "color: # f1f2f3;"> ex) </span>

</P>

<P>

<Span style = "color: # f1f2f3;"> & nbsp; & nbsp ;{</span>

</P>

<P>

<Span style = "color: # f1f2f3;"> & nbsp; & nbsp; </span>

<Span style = "color: #678cb1;"> info </span>

<Span style = "color: # e8e2b7;">. </span>

<Span style = "color: # f1f2f3;"> errorbox (ex </span>

<Span style = "color: # e8e2b7;">. </span>

<Span style = "color: # f1f2f3;"> message); </span>

</P>

<P>

<Span style = "color: # f1f2f3;"> & nbsp; & nbsp ;}</span>

</P>

</Div>

</Body>

 

The following content is displayed in the HTML section:

Catch (exception ex)

{

Info. errorbox (ex. Message );

}

We can see that there are extra spaces (& nbsp; entity) in front of each line, so we can use the XML indent function to indent the above HTML.

 

XML contraction interface for object 744:

The XML text at the top is of course the above HTML content.

Search content is & nbsp;

XPath should select the content node for comparison and contraction. Note that the above HTML structure is: Multiple <p> nested in a <div> represents each row. A <p> contains multiple <span>, but you only need to select the first <span> because it represents the top content of each row, that is, the location where we need to contract. XPath is defined as follows:

// Div [@ class = 'mgen _ Code']/P/SPAN [1]

 

After the input is correct, the result is output:

 

The HTML preview result after successfully shrinking is:

Catch (exception ex)

{

Info. errorbox (ex. Message );

}

OK, no additional & nbsp;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

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

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