473,385 Members | 1,356 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,385 software developers and data experts.

XML/DTD question, please help me out.

Hi,

I'm new in the XML world. I need to program a C++ application that
writes information of all directories and files on the harddisk to a
XML file. Now that's not really the problem.

I expect part of the XML file could look like this:

<FILELIST>
<DIRECTORY name="windows" date="09/23/2003">
<FILE>
<FILENAME>win.ini</FILENAME>
<FILESIZE>1128</FILESIZE>
<FILEDATE>09/23/2003</FILEDATE>
</FILE>
<DIRECTORY name="system" date="09/23/2003">
<FILE>
<FILENAME>keyboard.drv</FILENAME>
<FILESIZE>2000</FILESIZE>
<FILEDATE>09/23/2003</FILEDATE>
</FILE>
</DIRECTORY>
</DIRECTORY>
</FILELIST>

Correct me when I'm wrong.

And for the DTD file:

<!DOCTYPE FILELIST [

<!ELEMENT FILELIST (DIRECTORY*)>
<!ELEMENT DIRECTORY (DIRECTORYNAME, DIRECTORYDATE, FILE*)>
<!ELEMENT DIRECTORYNAME (#PCDATA)>
<!ELEMENT DIRECTORYDATE (#PCDATA)>
<!ELEMENT FILE (FILENAME, FILESIZE, FILEDATE)>
<!ELEMENT FILENAME (#PCDATA)>
<!ELEMENT FILESIZE (#PCDATA)>
<!ELEMENT FILEDATE (#PCDATA)>

<!ATTLIST DIRECTORY NAME CDATA #REQUIRED>
<!ATTLIST DIRECTORY DATE CDATA #REQUIRED>

]>

Now my question:

Directories can excist in directories wich can excist in directories,
etc.
How to solve this in the DTD file.

-Martijn
Jul 20 '05 #1
3 1575
"Martijn" <m_*******@hotmail.com> wrote in message
news:c9**************************@posting.google.c om
Hi,

I'm new in the XML world. I need to program a C++ application that
writes information of all directories and files on the harddisk to a
XML file. Now that's not really the problem.

[...]

And for the DTD file:

<!DOCTYPE FILELIST [

<!ELEMENT FILELIST (DIRECTORY*)>
<!ELEMENT DIRECTORY (DIRECTORYNAME, DIRECTORYDATE, FILE*)>
According to your samle XML, this is wrong. You should, but do not have
any DIRECTORYNAME or DIRECTORYDATE elements, you use attributes, as you
correctly denoted later. But you would have noticed, I guess. ;-)
Now my question:

Directories can excist in directories wich can excist in directories,
etc.
How to solve this in the DTD file.


<!ELEMENT DIRECTORY (DIRECTORY*, FILE*)>

What did you think? ;-) Self-referencing is allowed in DTDs.

Martin
Jul 20 '05 #2
"Martin Boehm" <ng********@arcor.de> wrote in message news:<3f***********************@newsread2.arcor-online.net>...
"Martijn" <m_*******@hotmail.com> wrote in message
news:c9**************************@posting.google.c om
Hi,

I'm new in the XML world. I need to program a C++ application that
writes information of all directories and files on the harddisk to a
XML file. Now that's not really the problem.

[...]

And for the DTD file:

<!DOCTYPE FILELIST [

<!ELEMENT FILELIST (DIRECTORY*)>
<!ELEMENT DIRECTORY (DIRECTORYNAME, DIRECTORYDATE, FILE*)>
According to your samle XML, this is wrong. You should, but do not have
any DIRECTORYNAME or DIRECTORYDATE elements, you use attributes, as you
correctly denoted later. But you would have noticed, I guess. ;-)

Stupid of me.
Now my question:

Directories can excist in directories wich can excist in directories,
etc.
How to solve this in the DTD file.


<!ELEMENT DIRECTORY (DIRECTORY*, FILE*)>

What did you think? ;-) Self-referencing is allowed in DTDs.


That's what I didn't know.
Martin


Thanks
Martijn
Jul 20 '05 #3
"Martin Boehm" <ng********@arcor.de> writes:
Now my question:

Directories can excist in directories wich can excist in directories,
etc.
How to solve this in the DTD file.


<!ELEMENT DIRECTORY (DIRECTORY*, FILE*)>

What did you think? ;-) Self-referencing is allowed in DTDs.


<!ELEMENT DIRECTORY (DIRECTORY | FILE)*>

Would allow intermixing between DIRECTORYs and FILEs.

-Micah
Jul 20 '05 #4

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

Similar topics

1
by: Katrin Tomanek | last post by:
Hi, I tried ioctl with SIOCGSTAMP in order to get a timestamp for a received tcp packet. I tried before and after reading on the socket. But always I get a ENOENT error. I googled for this...
3
by: Andrea Giudici | last post by:
I'm quite new to C developing, and I cannot understand how to print out not only ASCII characters but also some colorful lines and circles! I'm currently using Miracle C compiler for Windows. ...
12
by: Joe | last post by:
Hello All: I'm sure that one of you can quickly spot the error in my script. I am using a small javascript function to retrieve the text of a hyperlink in a datagrid column. Here is my...
10
by: Rider | last post by:
Hi, simple(?) question about asp.net configuration.. I've installed ASP.NET 2.0 QuickStart Sample successfully. But, When I'm first start application the follow message shown. ========= Server...
7
by: jwatson | last post by:
hey guys need help or some guidances please. Basically its a complicated looping and relational question. Write a program to calculate te percentage score of the mark of the students.The program...
11
by: Jack | last post by:
Hi, I was asked this question during an interview. It seems very simple but I don't know if there is a more efficient way. The question said, we have 2 arrays as follows A = B = As you...
4
by: =?Utf-8?B?Um9iIE1pbGxtYW4=?= | last post by:
I am developing a C# client app using VS 2008 that consumes a 3rd party web service. My question is how/where in my IDE/Debugging session can I visually see the actual XML message that is being...
3
by: wongjoekmeu | last post by:
Hello all, I have a C++ program ( I am not sure if this is the right place to post this question ), One of the function returns two unsigned integers which are referred to be TimestampLo and...
5
by: Dave | last post by:
I am new to Visual Web Developer 2005 Expres. I am using absolute positioning and every time I add a button control to my web form its width extends all the way to the edge of the page. IOW I...
2
by: Ken Fine | last post by:
I want to add the security question and answer security feature to the ChangePassword control. I am aware that this functionality is built into the PasswordRecovery tool. I have implemented the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.