Click to See Complete Forum and Search --> : C file searching


Seko
03-12-2004, 12:42 PM
Anyone knows any easy way to extract integers from a file that contains the following input:

<NETWORK-SPECIFICATION-FILE>

<N> 5
<M> 6

<NETWORK-NODES> 1 2 3 4 5

<NETWORK-LINKS>
<LINK> 1 2
<LINK> 2 3
<LINK> 2 4
<LINK> 2 5
<LINK> 4 5
<LINK> 3 5

<SOURCE-NODE> 1

<PATHS-FROM-SOURCE>
<LEN> 2 <PATH> 1 2
<LEN> 3 <PATH> 1 2 3

I would like to make int N = 5, int M = 6, int nodenums[] ={1,2,3,4,5} and so on...
<LEN> 3 <PATH> 1 2 4
<LEN> 3 <PATH> 1 2 5

hammer123
03-16-2004, 03:58 AM
libxml

bwkaz
03-16-2004, 09:52 PM
But there aren't any closing tags, so this isn't a well-formed XML document. I'm not sure whether libxml will be able to handle it.

Seko, could you insert closing tags? If so, and if you want to learn DTD as well, you could use libxml. Even without a DTD, you might be able to use the "XML subset parser" that's part of glib 2 -- but you'll definitely need closing tags for that too.

Seko
03-17-2004, 04:03 AM
have to handle the text file in C no xml no other external tools...thx for replys anyway...