jtemplate giving ; expected below is my code - jtemplates

My Code is:
<table border="1" rules="all" cellpadding="0" width="100%" cellspacing="1" id="table1" style="text-align:center">
<thead>
{var tmpchannelid = '0'}
{#foreach $T as ChannelRoomBind}
{#if $T.ChannelRoomBind.channelid neq ${tmpchannelid}}
<tr class="midhead2_calen">
<td>{$T.ChannelRoomBind.ChannelName }</td>
</tr>
{#/if}
{ tmpchannelid = {$T.ChannelRoomBind.channelId}}
{#/for}
</thead>
<tbody>
<tr>
</tr>
</tbody>
</table>

Related

itextpdf 5.5 and xmlworker 5.5 jar giving Runtimeworker exception in Java

I am getting the error below for itextpdf 5.5 jar in Chrome Version 79.0.3945.88 (Official Build) (64-bit) and IE browser.
html content that gives this error.
Caused by: com.itextpdf.tool.xml.exceptions.RuntimeWorkerException: Invalid nested tag span</td found, expected closing tag span.
at com.itextpdf.tool.xml.XMLWorker.endElement(XMLWorker.java:135)
at com.itextpdf.tool.xml.parser.XMLParser.endElement(XMLParser.java:396)
at com.itextpdf.tool.xml.parser.XMLParser.parse(XMLParser.java:175)
at com.app.bean.Main.createPDF(Main.java:1113)
... 36 more
html content:
<table ">
<tr>
<th style="font-weight:bold">Sl.No.</th>
..
</tr>
<tr>
..
<td width="65%" align="left">
<table border="0" cellspacing="0" cellpadding="3" align="left" style="border-collapse:collapse;" width="100%">
<tr>
..
<td width="65%" align="left">
<table border="0" cellspacing="0" cellpadding="3" align="left" style="border-collapse:collapse;" width="100%">
<tr>
<td align="left"><b>Missing in Comparison File : </b><span style="background-color:LIGHTCOROL;">IT1**1*EA*297**VC*5315114*N4*49502010102</span></td>
</tr>
<tr>
<td align="left"><b>Base File: </b>CTT*<span style="background-color:yellow;">2</span>*<span style="background-color:yellow;">1</span><br><br/><b>Comparison File: </b>CTT*<span style="background-color:yellow;">1</span>*<span style="background-color:yellow;">3</span><span style="background-color:yellow;">123</span</td>
</tr>
<tr>
<td align="left"><b>Base File: </b>SE*<span style="background-color:yellow;">9</span>*618600001<br><br/><b>Comparison File: </b>SE*<span style="background-color:yellow;">8</span>*618600000</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="65%" align="left">
<table border="0" cellspacing="0" cellpadding="3" align="left" style="border-collapse:collapse;" width="100%">
<tr>
</tr>
..
</table>
</td>
</tr>
</table>
In this line
<td align="left"><b>Base File: </b>CTT*[...]<span style="background-color:yellow;">123</span</td>
^^^^^^
you see that the last closing span is missing its final >.

Issue with table side-by-side only on Outlook software

I'm creating a HTML email, it works fine on all the mail clients I tested except on Outlook 2016 software (works fine on Outlook website)
I tried to use td side-by-side instead of table but it's breaking my responsiveness. Tables are supposed to side-by-side splitting the email in 2 parts. In Outlook software, there is a big gap above the second table making if shifted and not aligned with the first one.
Here is my code:
<tr>
<td align="center" bgcolor="#EEEEEE">
<table align="center" bgcolor="#FFFFFF" border="0" cellpadding="0" cellspacing="0" class="ee_element ee_textelement" data-title="Text" style="width: 700px; table-layout: auto;" width="700">
<tbody>
<tr>
<td align="center" valign="top">
<table align="center" border="0" cellpadding="0" cellspacing="0" class="em_wrapper" style="width:700px;table-layout: auto;" width="100%">
<tbody>
<tr>
<td align="left" valign="top">
<table align="left" border="0" cellpadding="0" cellspacing="0" class="em_wrapper" style="width:350px;table-layout: auto;" width="350">
<tbody>
<tr>
<td align="center" class="em_pad_top" valign="top">
<table align="center" bgcolor="#FFFFFF" border="0" cellpadding="0" cellspacing="0" class="sbs_block h_auto" style="width: 350px; background-color: rgb(255, 255, 255);table-layout: auto;height:400px" width="350">
<tbody>
<tr>
<td bgcolor="#00865B" class="col" style="vertical-align: middle;" width="350">
<table cellpadding="0" cellspacing="0" role="presentation" width="100%">
<tr>
<td>
<p style="color: #FFFFFF; margin: 0;font-size:16px">Lorem Ipsum</p>
</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<table align="left" border="0" cellpadding="0" cellspacing="0" class="em_wrapper" style="width:350px;table-layout: auto;" width="350">
<tbody>
<tr>
<td align="center" class="em_pad_top" valign="top">
<table align="center" bgcolor="#FFFFFF" border="0" cellpadding="0" cellspacing="0" class="sbs_block h_auto" style="width: 350px; background-color: rgb(255, 255, 255);table-layout: auto;height:400px" width="350">
<tbody>
<tr>
<td bgcolor="#00865B" class="col" style="vertical-align: middle;" width="350">
<table cellpadding="0" cellspacing="0" role="presentation" width="100%">
<tr>
<td>
<p style="color: #FFFFFF; margin: 0;font-size:16px">Lorem Ipsum</p>
</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</table>
I'm expecting to have my 2 tables properly aligned side-by-side like I have them on all other email clients.
welcome to SO!
To do this - you will need to place the following snippet between your 2 left aligned tables:
<!--[if mso]>
</td>
<td valign="top" align="center">
<![endif]-->
Due to the nature of MSO - it doesn't support table floating, so this effectively lies to MSO and turns them into 2 columns.
<td align="center" bgcolor="#EEEEEE">
<table align="center" bgcolor="#FFFFFF" border="0" cellpadding="0" cellspacing="0" class="ee_element ee_textelement" data-title="Text" style="width: 700px; table-layout: auto;" width="700">
<tbody>
<tr>
<td align="center" valign="top">
<table align="center" border="0" cellpadding="0" cellspacing="0" class="em_wrapper" style="width:700px;table-layout: auto;" width="100%">
<tbody>
<tr>
<td align="left" valign="top">
<table align="left" border="0" cellpadding="0" cellspacing="0" class="em_wrapper" style="width:350px;table-layout: auto;" width="350">
<tbody>
<tr>
<td align="center" class="em_pad_top" valign="top">
<table align="center" bgcolor="#FFFFFF" border="0" cellpadding="0" cellspacing="0" class="sbs_block h_auto" style="width: 350px; background-color: rgb(255, 255, 255);table-layout: auto;height:400px" width="350">
<tbody>
<tr>
<td bgcolor="#00865B" class="col" style="vertical-align: middle;" width="350">
<table cellpadding="0" cellspacing="0" role="presentation" width="100%">
<tr>
<td>
<p style="color: #FFFFFF; margin: 0;font-size:16px">Lorem Ipsum</p>
</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<!--[if mso]>
</td>
<td valign="top" align="center">
<![endif]-->
<table align="left" border="0" cellpadding="0" cellspacing="0" class="em_wrapper" style="width:350px;table-layout: auto;" width="350">
<tbody>
<tr>
<td align="center" class="em_pad_top" valign="top">
<table align="center" bgcolor="#FFFFFF" border="0" cellpadding="0" cellspacing="0" class="sbs_block h_auto" style="width: 350px; background-color: rgb(255, 255, 255);table-layout: auto;height:400px" width="350">
<tbody>
<tr>
<td bgcolor="#00865B" class="col" style="vertical-align: middle;" width="350">
<table cellpadding="0" cellspacing="0" role="presentation" width="100%">
<tr>
<td>
<p style="color: #FFFFFF; margin: 0;font-size:16px">Lorem Ipsum</p>
</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
Just one of the many quirks with mso :)

Perl XML::LibXML XPath 2.0 to XPath 1.0

I have the following XPath that works fine in XPath 2.0 (as tested in OxygenXML):
//h2[a[#id='start']]/following-sibling::*[not(preceding-sibling::*[self::div[#id='end']])]
but I'm getting different results when I use it with LibXML findnodes():
my #nodes = $source_doc->findnodes('//h2[a[#id="start"]]/following-sibling::*[not(preceding-sibling::*[self::div[#id="end"]])]');
After checking the LibXML documentation, it seems that LibXML supports XPath 1.0 only. How would I go about changing my XPath to something that works with XPath 1.0? Is it even possible to create a compatible path like this in XPath 1.0?
Since I've been asked to provide, I'm updating the post to include my sample data and the output I'm getting when I run the XPath I entered above:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="insn.css" />
<meta name="generator" content="encodingindex.xsl" />
<title>Index by Encoding</title>
</head>
<body><hr /><h1 class="topleveltable"><a name="top" id="top"></a>Top-level encodings</h1><div
class="regdiagram-32"></div><hr /><h2><a name="dp" id="start"></a>Data-processing and
miscellaneous instructions</h2><div class="decode_navigation">
<p>These instructions are under the top-level.</p>
</div><div class="regdiagram-32">
<table class="regdiagram">
<thead>
<tr>
<td>31</td>
<td>0</td>
</tr>
</thead>
<tbody>
<tr class="firstrow">
<td colspan="4" class="lr">!= 1111</td>
<td colspan="2" class="lr">00</td>
<td class="lr">op0</td>
<td colspan="5" class="lr">op1</td>
<td colspan="12" class="lr"></td>
<td class="lr">op2</td>
<td colspan="2" class="lr">op3</td>
<td class="lr">op4</td>
<td colspan="4" class="lr"></td>
</tr>
</tbody>
</table>
</div><div class="instructiontable">
<table class="instructiontable">
<tr>
<th colspan="5">Decode fields</th>
<th rowspan="2"> Instruction details </th>
</tr>
<tr>
<th class="bitfields">op0</th>
<th class="bitfields">op1</th>
<th class="bitfields">op2</th>
<th class="bitfields">op3</th>
<th class="bitfields">op4</th>
</tr>
<tr class="instructiontable">
<td class="bitfield"> 0 </td>
<td class="bitfield"> </td>
<td class="bitfield"> 1 </td>
<td class="bitfield"> != 00 </td>
<td class="bitfield"> 1 </td>
<td class="iformname">Extra load/store</td>
</tr>
<tr class="instructiontable">
<td class="bitfield"> 0 </td>
<td class="bitfield"> 0xxxx </td>
<td class="bitfield"> 1 </td>
<td class="bitfield"> 00 </td>
<td class="bitfield"> 1 </td>
<td class="iformname">Multiply and Accumulate</td>
</tr>
</table>
</div><hr /><h2><a name="sync" id="sync"></a>Synchronization primitives and
Load-Acquire/Store-Release</h2><div class="decode_navigation">
<p>These instructions are under <a href="#dp">Data-processing and miscellaneous
instructions</a>.</p>
</div><div class="regdiagram-32">
<table class="regdiagram">
<thead>
<tr>
<td>31</td>
<td>0</td>
</tr>
</thead>
<tbody>
<tr class="firstrow">
<td colspan="4" class="lr">!= 1111</td>
<td colspan="4" class="lr">0001</td>
<td class="lr">op0</td>
<td colspan="11" class="lr"></td>
<td colspan="2" class="lr">11</td>
<td colspan="2" class="lr"></td>
<td colspan="4" class="lr">1001</td>
<td colspan="4" class="lr"></td>
</tr>
</tbody>
</table>
</div><hr /><hr /><h2><a name="dpmisc" id="dpmisc"></a>Miscellaneous</h2><div
class="decode_navigation">
<p>These instructions are under <a href="#dp">Data-processing and miscellaneous
instructions</a>.</p>
</div><div class="regdiagram-32">
<table class="regdiagram">
<thead>
<tr>
<td>31</td>
<td>30</td>
<td>0</td>
</tr>
</thead>
<tbody>
<tr class="firstrow">
<td colspan="4" class="lr">!= 1111</td>
<td colspan="5" class="lr">00010</td>
<td colspan="2" class="lr">op0</td>
<td colspan="1" class="lr">0</td>
<td colspan="12" class="lr"></td>
<td colspan="1" class="lr">0</td>
<td colspan="3" class="lr">op1</td>
<td colspan="4" class="lr"></td>
</tr>
</tbody>
</table>
</div><div class="instructiontable">
<table class="instructiontable">
<tr>
<th colspan="2">Decode fields</th>
<th rowspan="2"> Instruction details </th>
</tr>
<tr>
<th class="bitfields">op0</th>
<th class="bitfields">op1</th>
</tr>
<tr class="instructiontable">
<td class="bitfield"> 01 </td>
<td class="bitfield"> 010 </td>
<td class="iformname">BXJ</td>
</tr>
<tr class="instructiontable">
<td class="bitfield"> 01 </td>
<td class="bitfield"> 011 </td>
<td class="iformname">BLX (register)</td>
</tr>
</table>
</div><div class="decode_navigation">
<p>These instructions are under <a href="#dp">Data-processing and miscellaneous
instructions</a>.</p>
</div><div class="regdiagram-32">
<table class="regdiagram">
<thead>
<tr>
<td>31</td>
<td>30</td>
<td>0</td>
</tr>
</thead>
<tbody>
<tr class="firstrow">
<td colspan="4" class="lr">!= 1111</td>
<td colspan="3" class="lr">000</td>
<td colspan="2" class="lr">op0</td>
<td colspan="2" class="lr"></td>
<td class="lr">op1</td>
<td colspan="15" class="lr"></td>
<td colspan="1" class="lr">0</td>
<td colspan="4" class="lr"></td>
</tr>
</tbody>
</table>
</div><div class="decode_constraints">
<p> The following constraints also apply to this encoding: op0:op1 != 100 </p>
</div><div class="instructiontable">
<table class="instructiontable">
<tr>
<th colspan="2">Decode fields</th>
<th rowspan="2"> Instruction details </th>
</tr>
<tr>
<th class="bitfields">op0</th>
<th class="bitfields">op1</th>
</tr>
<tr class="instructiontable">
<td class="bitfield"> 0x </td>
<td class="bitfield"> </td>
<td class="iformname"><a href="#intdp3reg_immsh">Integer Data Processing (three register,
immediate shift)</a></td>
</tr>
<tr class="instructiontable">
<td class="bitfield"> 10 </td>
<td class="bitfield"> 1 </td>
<td class="iformname"><a href="#intdp2reg_immsh">Integer Test and Compare (two register,
immediate shift)</a></td>
</tr>
<tr class="instructiontable">
<td class="bitfield"> 11 </td>
<td class="bitfield"> </td>
<td class="iformname"><a href="#logic3reg_immsh">Logical Arithmetic (three register,
immediate shift)</a></td>
</tr>
</table>
</div><hr /><div class="iclass" id="intdp3reg_immsh">
<a name="intdp3reg_immsh" id="intdp3reg_immsh"></a>
<h3 class="iclass">Integer Data Processing (three register, immediate shift)</h3>
<p>These instructions are under <a href="#dpregis">Data-processing register (immediate
shift)</a>.</p>
<div class="regdiagram-32">
<table class="regdiagram">
<thead>
<tr>
<td>31</td>
<td>0</td>
</tr>
</thead>
<tbody>
<tr class="firstrow">
<td colspan="4" class="lr">!= 1111</td>
<td class="l">0</td>
<td>0</td>
<td>0</td>
<td class="r">0</td>
<td colspan="3" class="lr">opc</td>
<td class="lr">S</td>
<td colspan="4" class="lr">Rn</td>
<td colspan="4" class="lr">Rd</td>
<td colspan="5" class="lr">imm5</td>
<td colspan="2" class="lr">type</td>
<td class="lr">0</td>
<td colspan="4" class="lr">Rm</td>
</tr>
<tr class="secondrow">
<td colspan="4" class="droppedname">cond</td>
<td colspan="4"></td>
<td colspan="3"></td>
<td></td>
<td colspan="4"></td>
<td colspan="4"></td>
<td colspan="5"></td>
<td colspan="2"></td>
<td></td>
<td colspan="4"></td>
</tr>
</tbody>
</table>
</div>
<div class="decode_constraints">
<p> The following constraints also apply to this encoding: cond != 1111 && cond !=
1111 </p>
</div>
<div class="instructiontable">
<table class="instructiontable" id="intdp3reg_immsh">
<thead class="instructiontable">
<tr>
<th class="bitfields-heading" rowspan="" colspan="3">Decode fields</th>
<th class="iformname" rowspan="2" colspan=""> Instruction Details </th>
</tr>
<tr>
<th class="bitfields" rowspan="" colspan="">opc</th>
<th class="bitfields" rowspan="" colspan="">S</th>
<th class="bitfields" rowspan="" colspan="">Rn</th>
</tr>
</thead>
<tbody>
<tr>
<td class="bitfield">000</td>
<td class="bitfield"></td>
<td class="bitfield"></td>
<td class="iformname"><a name="AND_r" href="and_r.html" id="AND_r">AND, ANDS
(register)</a></td>
</tr>
<tr>
<td class="bitfield">001</td>
<td class="bitfield"></td>
<td class="bitfield"></td>
<td class="iformname"><a name="EOR_r" href="eor_r.html" id="EOR_r">EOR, EORS
(register)</a></td>
</tr>
</tbody>
</table>
</div>
</div><div class="decode_constraints">
<p> The following constraints also apply to this encoding: op0:op1 != 100 </p>
</div><div class="instructiontable">
<table class="instructiontable">
<tr>
<th colspan="2">Decode fields</th>
<th rowspan="2"> Instruction details </th>
</tr>
<tr>
<th class="bitfields">op0</th>
<th class="bitfields">op1</th>
</tr>
<tr class="instructiontable">
<td class="bitfield"> 0x </td>
<td class="bitfield"> </td>
<td class="iformname"><a href="#intdp3reg_regsh">Integer Data Processing (three register,
register shift)</a></td>
</tr>
<tr class="instructiontable">
<td class="bitfield"> 10 </td>
<td class="bitfield"> 1 </td>
<td class="iformname"><a href="#intdp2reg_regsh">Integer Test and Compare (two register,
register shift)</a></td>
</tr>
</table>
</div><hr /><h2><a name="dpimm" id="dpimm"></a>Data-processing immediate</h2><div
class="decode_navigation">
<p>These instructions are under <a href="#dp">Data-processing and miscellaneous
instructions</a>.</p>
</div><div class="regdiagram-32">
<table class="regdiagram">
<thead>
<tr>
<td>31</td>
<td>0</td>
</tr>
</thead>
<tbody>
<tr class="firstrow">
<td colspan="4" class="lr">!= 1111</td>
<td colspan="3" class="lr">001</td>
<td colspan="2" class="lr">op0</td>
<td colspan="1" class="lr"></td>
<td colspan="2" class="lr">op1</td>
<td colspan="20" class="lr"></td>
</tr>
</tbody>
</table>
</div><div class="instructiontable">
<table class="instructiontable">
<tr>
<th colspan="2">Decode fields</th>
<th rowspan="2"> Instruction details </th>
</tr>
<tr>
<th class="bitfields">op0</th>
<th class="bitfields">op1</th>
</tr>
<tr class="instructiontable">
<td class="bitfield"> 0x </td>
<td class="bitfield"> </td>
<td class="iformname"><a href="#intdp2reg_imm">Integer Data Processing (two register and
immediate)</a></td>
</tr>
</table>
</div><hr /><div class="iclass" id="intdp2reg_imm">
<a name="intdp2reg_imm" id="intdp2reg_imm"></a>
</div><div class="iclass" id="end">
<a name="ldstimm" id="ldstimm"></a>
<h3 class="iclass">Load/Store Word, Unsigned Byte (immediate, literal)</h3>
<div class="regdiagram-32">
<table class="regdiagram">
<thead>
<tr>
<td>31</td>
<td>0</td>
</tr>
</thead>
<tbody>
<tr class="firstrow">
<td colspan="4" class="lr">!= 1111</td>
<td class="l">0</td>
<td>1</td>
<td class="r">0</td>
<td class="lr">P</td>
<td class="lr">U</td>
<td class="lr">o2</td>
<td class="lr">W</td>
<td class="lr">o1</td>
<td colspan="4" class="lr">Rn</td>
<td colspan="4" class="lr">Rt</td>
<td colspan="12" class="lr">imm12</td>
</tr>
<tr class="secondrow">
<td colspan="4" class="droppedname">cond</td>
<td colspan="3"></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td colspan="4"></td>
<td colspan="4"></td>
<td colspan="12"></td>
</tr>
</tbody>
</table>
</div>
<div class="decode_constraints">
<p> The following constraints also apply to this encoding: cond != 1111 && cond !=
1111 </p>
</div>
<div class="instructiontable">
<table class="instructiontable" id="ldstimm">
<thead class="instructiontable">
<tr>
<th class="bitfields-heading" rowspan="" colspan="4">Decode fields</th>
<th class="iformname" rowspan="2" colspan=""> Instruction Details </th>
</tr>
<tr>
<th class="bitfields" rowspan="" colspan="">P:W</th>
<th class="bitfields" rowspan="" colspan="">o2</th>
<th class="bitfields" rowspan="" colspan="">o1</th>
<th class="bitfields" rowspan="" colspan="">Rn</th>
</tr>
</thead>
<tbody>
<tr>
<td class="bitfield">!= 01</td>
<td class="bitfield">0</td>
<td class="bitfield">1</td>
<td class="bitfield">1111</td>
<td class="iformname"><a name="LDR_l" href="ldr_l.html" id="LDR_l">LDR
(literal)</a></td>
</tr>
<tr>
<td class="bitfield">!= 01</td>
<td class="bitfield">1</td>
<td class="bitfield">1</td>
<td class="bitfield">1111</td>
<td class="iformname"><a name="LDRB_l" href="ldrb_l.html" id="LDRB_l">LDRB
(literal)</a></td>
</tr>
</tbody>
</table>
</div>
</div></body>
</html>
Here's the output using the XPath given above:
<div class="decode_navigation">
<p>These instructions are under the top-level.</p>
</div>
Just to clarify, the output should include all of the divs in the sample HTML, about 400 lines in total.
I've also tried the XPath suggestions I've been given below, but they produced the same results.
Edit: Here's my code:
use strict;
use warnings;
use feature 'say';
use XML::LibXML;
my $encoding_index_file = q(C:\path\to\testfile.html);
my $source_doc = XML::LibXML->load_html(
location => $encoding_index_file,
recover => 1,
suppress_errors => 1,
);
my ($node) = $source_doc->findnodes('//h2[a[#id="start"]]/following-sibling::*[not(preceding-sibling::div[#id="end"])]');
say $node->toString;
Not only does that XPath conform to XPath 1.0, it works correctly in XML::LibXML.
use strict;
use warnings qw( all );
use feature qw( say );
use XML::LibXML qw( );
my $doc = XML::LibXML->new->parse_html_string(<<'__EOS__');
<html>
<h2><a id="start">Foo</a></h2>
<div id="pre1"><img></div>
<div id="pre2"><img></div>
<div id="end"><img></div>
<div id="post1"><img></div>
<div id="post2"><img></div>
</html>
__EOS__
# Select all the siblings of the starting h2 element that follow
# it and don't have <div id="end"/> as a preceding sibling.
for my $node ($doc->findnodes('//h2[a[#id="start"]]/following-sibling::*[not(preceding-sibling::*[self::div[#id="end"]])]')) {
my $name = $node->nodeName;
my $id = $node->getAttribute('id');
say $id ? sprintf("%s#%s", $name, $id) : $name;
}
Output:
div#pre1
div#pre2
div#end
By the way,
//h2[a[#id="start"]]/following-sibling::*[not(preceding-sibling::*[self::div[#id="end"]])]
is a weird way of writing
//h2[a[#id="start"]]/following-sibling::*[not(preceding-sibling::div[#id="end"])]
Maybe you wanted
//h2[a[#id="start"]]/following-sibling::*[not(self::div[#id="end"] or preceding-sibling::div[#id="end"])]
That would produce the following output:
div#pre1
div#pre2
I managed to get to the bottom of what was causing the problem: Every sibling found by the XPath is handled by LibXML as a separate node, so I needed to assign them to an array, not a simple scalar as I was doing. The not-weird XPath suggested by ikegami was also better than the one I was using, as mine was doubling up everything in the output.
Here's the code that produces the correct results:
use strict;
use warnings;
use feature 'say';
use XML::LibXML qw( );
my $encoding_index_file = q(C:\path\to\testfile.html);
my $source_doc = XML::LibXML->load_html(
location => $encoding_index_file,
recover => 1,
suppress_errors => 1,
);
my $contents = "";
my #nodes = $source_doc->findnodes('//h2[a[#id="start"]]/following-sibling::[not(preceding-sibling::div[#id="end"])]');
foreach my $node (#nodes) {
my ($str) = $node->toString;
$contents = $contents . $str;
}
print $contents;

zurb ink email wrapper doesnt span across full width

I'm having issues with Zurb Ink's email. So it looks fine in desktop, however it there is this gap when it hits the media queries and it seems to be doing it with the containers when its stacked on top of each other. I want it to span the whole width.
http://i.stack.imgur.com/xygNK.png
Here is my code:
<table class="container" id="hero-container">
<!-- hero logo -->
<tr>
<td>
<table class="row">
<tr>
<td class="wrapper last">
<table class="twelve columns">
<tr>
<td id="hero-logo"><img id="logoImage" src="images/hero-logo.png" alt="Hero In The News" /></td>
<td class="expander"></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<!-- /hero logo -->
<!-- hero image -->
<tr>
<td>
<table class="row">
<tr>
<td class="wrapper last">
<table class="twelve columns">
<tr>
<td><img id="headerImage" src="images/hero-img.png" alt="City of San Jose - Capital of Silicon Valley" /></td>
<td class="expander"></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<!-- /hero image -->
<!-- hero main article -->
<tr>
<td>
<table class="row">
<tr>
<td>
<div class="wrapper last">
<table class="twelve columns">
<tr>
<td class="heading1 text-pad">Residents can Pace Energy Use <br/>with New Program</td>
<td class="expander"></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table class="row">
<tr>
<td>
<div class="wrapper last">
<table class="twelve columns">
<tr>
<td class="text-pad"><p>The city of San Jose has implemented a program to help residents pace their water and energy consumption. </p></td>
<td class="expander"></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
</tr>
<!-- button -->
<tr>
<td>
<table class="row">
<tr>
<td>
<div class="wrapper last">
<table class="twelve columns">
<tr>
<td class="text-pad link"><p>Read Full Article</p></td>
<td class="expander"></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
</tr>
<!--/button -->
<!-- /hero main article -->
</table>
<!-- articles row 1 -->
<table class="container">
<tr>
<td>
<table class="row">
<tr>
<td class="wrapper">
<table class="six columns article">
<tr>
<td class="text-pad">
<h2>Energy Efficiency Program Ushers Green Jobs into Kern</h2>
<p>The green economy has arrived in Kern County, and not a moment...</p>
</td>
<td class="expander"></td>
</tr>
</table>
</td>
<td class="wrapper last">
<table class="six columns article">
<tr>
<td class="text-pad">
<h2>Stockton Gets a New “HERO”</h2>
<p>From insulation to more efficient air conditioning to solar panels to...</p>
</td>
<td class="expander"></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- /articles row 1-->
<!-- articles row 2 -->
<table class="container article-container">
<tr>
<td>
<table class="row">
<tr>
<td class="wrapper article-wrapper">
<table class="six columns article">
<tr>
<td class="text-pad">
<h2>Fresno estimates $56M from HERO program</h2>
<p>Officials with the City of Fresno expect to see more than $56 M...</p>
</td>
<td class="expander"></td>
</tr>
</table>
</td>
<td class="wrapper last article-wrapper-last">
<table class="six columns article">
<tr>
<td class="text-pad">
<h2>Lompoc City Council approves HERO Program</h2>
<p>A new program that helps homeowners make energy and...</p>
</td>
<td class="expander"></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
Caveat: I am new to Ink myself. What "jumps out" at me is that you're using a container on the outside and multiple rows inside. For full width, swap the row and container classes --> so that the table with class row contains a table with class container.

Create top labels for nodes using graphviz (dot)

I need to create a graph representing a extendable hashing structure. So far I have had success with creating graphs in graphviz (using the dot tool)... I am however having trouble making top labels representing the number of bits for each bucket... What I want to do is something similar to this:
What I cannot get done are the small 2's and 1's representing bits.. Can anybody explain how I would go around doing this?
My graph so far looks like this:
digraph G {
nodesep = 0.5;
rankdir = LR;
node [shape=record];
node0[label = "<f0>0 | <f1>1"];
node1[label = "0010 | |", toplabel="1"];
subgraph cluster_0 {
style=filled;
color=white;
node [style=filled,color=white];
node0;
label = "i = 1";
}
node0:f0->node1;}
You may consider using HTML-Like labels if you really must do this with graphviz.
I recreated the mentioned example from wikipedia:
rankdir = LR;
node [shape=none];
splines=false;
n1[label=<
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
<TR>
<TD CELLPADDING="2">2</TD>
<TD BORDER="0"></TD>
</TR>
<TR><TD COLSPAN="2" PORT="port00"> 00 </TD></TR>
<TR><TD COLSPAN="2" PORT="port01"> 01 </TD></TR>
<TR><TD COLSPAN="2" PORT="port10"> 10 </TD></TR>
<TR><TD COLSPAN="2" PORT="port11"> 11 </TD></TR>
</TABLE>>];
a[label=<
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
<TR>
<TD CELLPADDING="0" BORDER="0" COLSPAN="2">
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="2" FIXEDSIZE="TRUE" WIDTH="1" ALIGN="LEFT"><TR><TD>1</TD></TR></TABLE>
</TD>
</TR>
<TR>
<TD PORT="porta"> A </TD>
<TD>k2</TD>
</TR>
</TABLE>>];
b[label=<
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
<TR>
<TD CELLPADDING="2">2</TD>
<TD BORDER="0" COLSPAN="2"></TD>
</TR>
<TR>
<TD PORT="portb" COLSPAN="2"> B </TD>
<TD>k1</TD>
</TR>
</TABLE>>];
c[label=<
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
<TR>
<TD CELLPADDING="2">2</TD>
<TD BORDER="0" COLSPAN="2"></TD>
</TR>
<TR>
<TD PORT="portc" COLSPAN="2"> C </TD>
<TD>k3</TD>
</TR>
</TABLE>>];
n1:port00 -> a:porta;
n1:port01 -> a:porta;
n1:port10 -> b:portb;
n1:port11 -> c:portc;
As you can see, the code is not pretty... however, the result comes close:
http://graph.gafol.net/evEKgxwgj
Please note that there is a variation for the top label for demonstration purposes - node a uses a nested table.