473,396 Members | 2,037 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Unnest tag ?

Hello,

i am looking for an idea on how to handle un-nesting tags.

i know i can use something build on top of a htmltidy, but i'm rather
wondering if this could be done using only python standard library. my
input tags can not be crossed (i mean "<a> w1 <b> w2 </a> w3 </b>" is
impossible from my input)

actually i had produced some data with :

some input : (line number / content)

0 <a>
1 <b>
2 <c>
3 w1
4 w2
5 </a>
6 w3
7 <d>
8 w4
9 </b>
10 </d>
11 </c>

where in fact i should i have :

0 <b>
1 <c>
2 <a>
3 w1
4 w2
5 </a>
6 w3
7 <d>
8 w4
9 </d>
10 </c>
11 </b>

i am wondering how i can repair that.

i had built a small script which already do that, but as i know there
are clever brains here, may be i will get some better suggestions...

(i need to clean/rewrite my code, but here is how it works : it first
find paired opening/closing tags, their width and positions, then from
the smallest to the largest, it encloses the previous text inside the
current tag and build a text that will be the next one to be enclosed
and so on.)

Sep 5 '05 #1
0 792

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: John | last post by:
Hi, We have XML files (and its XSD) that are dump of our tree-like data structure in memory. These XML files may potentially have unlimited levels of nesting because some elements can contain...
1
by: LazyAnt | last post by:
Does DB2 process "ALL" subquery by "nested iteration" strategy, or using its own special algorithm? For example, assume r(A, B, C) and s(D, E, F) are two relations, consider the following query:...
0
by: Ryan | last post by:
I am trying to use transactions in Access97 and SQL Server 2000. A simplified version of the program I am writing in Access is as follows: Begin Transaction Begin Transaction Import File in...
9
by: MariusI | last post by:
Consider the following class layout public class Order { public ProductOrder AddProductOrder(/* variables required to create a product order */) { /* Check if the product order can be added...
38
by: sopranos2 | last post by:
Dear IBM DB2 support, I wish CLP would have been more functional. Without living the command line I would like to get sql return code explanations, scalar function definitions etc.. Looking...
8
by: jabernet | last post by:
Is it possible in the new DB2 9.5 to use the content of an array in an IN expression? Say we have the ddl: CREATE TYPE Numbers AS Integer ARRAY; CREATE tab1 AS ( id integer, numbers...
2
aas4mis
by: aas4mis | last post by:
I have a query that works fine when ordered by the puller id (cf.op.id). The problem comes when I try to order by the sum of the boxes (sum(cf.qq)). I have read "UniVerse SQL Reference" and...
1
by: Knut Stolze | last post by:
Hi, Let's assume I have a namespace that contains a class definition. Now I would like to add a template specialization for std::numeric_limits for the new class. I want to have this...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.