home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
Development
General Development (no feature request here!)
Getting Data from the Web
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="James" data-source="post: 91040" data-attributes="member: 12681"><p>Templates explained (Part 2).</p><p></p><p>In this post I will cover the <*xxxx> and <Zxx> tags.</p><p></p><p>Starting first the <Zxx> tag.</p><p></p><p>This tag is used to make a template for a variable structure and deal with optional information. Some website add extra information by changing the html structure (ie adding extra table rows).</p><p></p><p>With this tag regex code can be used.</p><p></p><p>at <z> tag must also have an end tag </z>. This indicates the start and end of the area with is considered optional.</p><p></p><p>Example:</p><p></p><p>[CODE]</p><p></p><p><tr></p><p><td><#START></td> </p><p><td><#TITLE></td> </p><p><z(><td><#OPTIONAL></td></z)?></p><p></tr></p><p></p><p>[/CODE]</p><p></p><p>In this example the simple regex ( )? is used to indicate that this part is optional. </p><p></p><p>In regex ? is the same as (){0,1} 0 or 1 times. At the moment the system has problems with any number greater then 1, as it causes an imblance between the template and the source. (If realy required, I can look into fixing this).</p><p></p><p>I have not needed/tried other regex code. It will except any valid regex code, but weather it parses or not if another question.</p><p></p><p>For more details on regex try this site: <a href="http://www.regular-expressions.info/" target="_blank">http://www.regular-expressions.info/</a></p><p></p><p>This can be used in the test program.</p><p></p><p></p><p>Next the <*xxx> tags. There are currenly only 2 <*> tags: <*MATCH> and <*VALUE>. These tags must be used as a pair.</p><p></p><p>These tags require an extra list with is passed into the HtmlParser class with the template if required.</p><p></p><p>This list has a Match value and a Field value, both strings.</p><p></p><p>This tag set is used as follows:</p><p></p><p>[CODE]</p><p></p><p>Template:</p><p><table></p><p><z(></p><p><tr></p><p><td><*MATCH></td> </p><p><td><*VALUE></td></p><p></tr></p><p></z)?></p><p><z(></p><p><tr></p><p><td><*MATCH></td> </p><p><td><*VALUE></td></p><p></tr></p><p></z)?></p><p></p><p>List:</p><p>MATCH FIELD</p><p>Time #TIME</p><p>Date #DATE</p><p>[/CODE]</p><p></p><p>In this case the parser will try to match the text located by the <*MATCH> tag with the list of match strings and the store the text located by the following <*VALUE> tag into the corresponding field.</p><p></p><p>At the moment it is not possible to test this in the test program, because it has no way for providing the required list.</p><p></p><p>Please feed back any problems or improvements.</p><p></p><p>Cheers,</p><p></p><p>/James</p></blockquote><p></p>
[QUOTE="James, post: 91040, member: 12681"] Templates explained (Part 2). In this post I will cover the <*xxxx> and <Zxx> tags. Starting first the <Zxx> tag. This tag is used to make a template for a variable structure and deal with optional information. Some website add extra information by changing the html structure (ie adding extra table rows). With this tag regex code can be used. at <z> tag must also have an end tag </z>. This indicates the start and end of the area with is considered optional. Example: [CODE] <tr> <td><#START></td> <td><#TITLE></td> <z(><td><#OPTIONAL></td></z)?> </tr> [/CODE] In this example the simple regex ( )? is used to indicate that this part is optional. In regex ? is the same as (){0,1} 0 or 1 times. At the moment the system has problems with any number greater then 1, as it causes an imblance between the template and the source. (If realy required, I can look into fixing this). I have not needed/tried other regex code. It will except any valid regex code, but weather it parses or not if another question. For more details on regex try this site: [url]http://www.regular-expressions.info/[/url] This can be used in the test program. Next the <*xxx> tags. There are currenly only 2 <*> tags: <*MATCH> and <*VALUE>. These tags must be used as a pair. These tags require an extra list with is passed into the HtmlParser class with the template if required. This list has a Match value and a Field value, both strings. This tag set is used as follows: [CODE] Template: <table> <z(> <tr> <td><*MATCH></td> <td><*VALUE></td> </tr> </z)?> <z(> <tr> <td><*MATCH></td> <td><*VALUE></td> </tr> </z)?> List: MATCH FIELD Time #TIME Date #DATE [/CODE] In this case the parser will try to match the text located by the <*MATCH> tag with the list of match strings and the store the text located by the following <*VALUE> tag into the corresponding field. At the moment it is not possible to test this in the test program, because it has no way for providing the required list. Please feed back any problems or improvements. Cheers, /James [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
Development
General Development (no feature request here!)
Getting Data from the Web
Contact us
RSS
Top
Bottom