[xml] Use of method SAX of the library LibXml2
- From: Rim msedi <msedirim gmail com>
- To: xml gnome org
- Subject: [xml] Use of method SAX of the library LibXml2
- Date: Mon, 24 Aug 2009 13:11:58 +0100
Hi ,
I read many the times the documents of Libxml2 and some links : http://julp.developpez.com/c/libxml2/?page=sax#L3.2.1
But, I do not
manage to find a solution with my problem because it is the first time
that I make the handling of file XML in a program C by using method SAX
of the library Iibxml2 . Moreover, the remainder of my work is based on
the result found in the solution of this problème. I want to use a
solution suggested by you like a function to call it in my program.
My work consists in making two things (two functions):
- the first
function makes it possible to extract information (which is character
strings) which exist between the beacon <intent> and < \
intent> concerning the last identifier <ID> < \ ID> of
the last beacon <concept> < \ concept>
this function gives us like a result a table or a file containing:
“d b a c”
In our case here, there will be only one line of the file or only one box of the table containing “d b a c”
-
The second function makes it possible to extract information (character
strings) which exists between the beacon <intent> and < \
intent> of all the identifiers <ID> < \ ID> except the
last identifier <ID> < \ ID>
and if the beacon
<intent> < \ intent> of the first identifier <ID>
< \ ID> is not empty then we put information between
<intent> < \ intent> in the result
If not if the
beacon <intent> < \ intent> of the first identifier
<ID> < \ ID> is empty as in our case then we do not put
information between <intent> < \ intent> in the result.
this function gives us like a result a table or a file containing the required character strings.
In our case here, there will be lines of the file or many boxes of the table containing:
"a"
"b"
"c"
"d"
"a c"
"b c"
"b d"
"c d"
"a b d"
Here my file XML complete named “essai.lat.xml”:
Code: XML
|
<Galicia_Document> <Lattice numberObj= " 5 " numberAtt= " 4 " numberCpt= " 11 " >
<Name>lattice (test) </Name>
<Object>3</Object> <Object>2</Object>
<Object>1</Object> <Object>5</Object> <Object>4</Object>
<Attribute>d</Attribute> <Attribute>b</Attribute> <Attribute>c</Attribute>
<Attribute>a</Attribute>
<Concept>
<ID> 1 </ID> <Extent>
<Object_Ref>3</Object_Ref> <Object_Ref>2</Object_Ref>
<Object_Ref>1</Object_Ref>
<Object_Ref>5</Object_Ref> <Object_Ref>4</Object_Ref> </Extent>
<Intent>
</Intent> <UpperCovers>
</UpperCovers> </Concept>
<Concept> <ID> 2 </ID>
<Extent> <Object_Ref>1</Object_Ref>
<Object_Ref>5</Object_Ref> </Extent> <Intent> <Attribute_Ref>a</Attribute_Ref>
</Intent>
<UpperCovers> <Concept_Ref>1</Concept_Ref> </UpperCovers>
</Concept> <Concept>
<ID> 5 </ID>
<Extent> <Object_Ref>2</Object_Ref>
<Object_Ref>5</Object_Ref> <Object_Ref>4</Object_Ref>
</Extent>
<Intent> <Attribute_Ref>b</Attribute_Ref> </Intent> <UpperCovers>
<Concept_Ref>1</Concept_Ref>
</UpperCovers> </Concept> <Concept>
<ID> 4 </ID> <Extent> <Object_Ref>3</Object_Ref>
<Object_Ref>1</Object_Ref>
<Object_Ref>4</Object_Ref> </Extent> <Intent> <Attribute_Ref>c</Attribute_Ref>
</Intent> <UpperCovers> <Concept_Ref>1</Concept_Ref> </UpperCovers>
</Concept> <Concept>
<ID> 3 </ID> <Extent> <Object_Ref>3</Object_Ref>
<Object_Ref>2</Object_Ref> <Object_Ref>5</Object_Ref>
</Extent>
<Intent> <Attribute_Ref>d</Attribute_Ref> </Intent> <UpperCovers>
<Concept_Ref>1</Concept_Ref>
</UpperCovers> </Concept> <Concept>
<ID> 8 </ID> <Extent> <Object_Ref>1</Object_Ref>
</Extent>
<Intent> <Attribute_Ref>c</Attribute_Ref> <Attribute_Ref>a</Attribute_Ref>
</Intent>
<UpperCovers> <Concept_Ref>2</Concept_Ref> <Concept_Ref>4</Concept_Ref>
</UpperCovers>
</Concept>
<Concept> <ID> 9 </ID> <Extent>
<Object_Ref>4</Object_Ref> </Extent>
<Intent>
<Attribute_Ref>b</Attribute_Ref>
<Attribute_Ref>c</Attribute_Ref> </Intent> <UpperCovers>
<Concept_Ref>5</Concept_Ref>
<Concept_Ref>4</Concept_Ref> </UpperCovers> </Concept> <Concept>
<ID> 6 </ID>
<Extent> <Object_Ref>2</Object_Ref> <Object_Ref>5</Object_Ref>
</Extent>
<Intent> <Attribute_Ref>d</Attribute_Ref>
<Attribute_Ref>b</Attribute_Ref>
</Intent> <UpperCovers>
<Concept_Ref>5</Concept_Ref> <Concept_Ref>3</Concept_Ref>
</UpperCovers> </Concept> <Concept>
<ID> 7 </ID> <Extent>
<Object_Ref>3</Object_Ref>
</Extent> <Intent> <Attribute_Ref>d</Attribute_Ref>
<Attribute_Ref>c</Attribute_Ref> </Intent>
<UpperCovers> <Concept_Ref>4</Concept_Ref>
<Concept_Ref>3</Concept_Ref>
</UpperCovers> </Concept>
<Concept>
<ID> 11 </ID> <Extent> <Object_Ref>5</Object_Ref>
</Extent>
<Intent>
<Attribute_Ref>d</Attribute_Ref> <Attribute_Ref>b</Attribute_Ref>
<Attribute_Ref>a</Attribute_Ref>
</Intent> <UpperCovers> <Concept_Ref>2</Concept_Ref>
<Concept_Ref>6</Concept_Ref>
</UpperCovers>
</Concept> <Concept>
<ID> 10 </ID> <Extent> </Extent>
<Intent> <Attribute_Ref>d</Attribute_Ref>
<Attribute_Ref>b</Attribute_Ref> <Attribute_Ref>c</Attribute_Ref>
<Attribute_Ref>a</Attribute_Ref>
</Intent> <UpperCovers> <Concept_Ref>10</Concept_Ref> <Concept_Ref>8</Concept_Ref>
<Concept_Ref>9</Concept_Ref>
<Concept_Ref>7</Concept_Ref> </UpperCovers>
</Concept> </Lattice>
</Galicia_Document>
|
I would be very grateful if you help me because I enormously need the solution to my problem.
Good work and good day.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]