Jump to content

node order


mpsn

Recommended Posts

Hi, I think i'm ok, it's context specific: eg:

 

if I have email message:

<email>

  <to/>

  <from/>

  <message/>

</email>

*so it doesn't make sense if a user uses this XML and defines just a message first without a to and from field.

 

Anways, I really hope you can take a look at my other post, it's very simple so I don't know why I'm stuck: When a user logs out, it will timestamp the current date/time to a lastSession field in my db table users. When the same user logs in again, in my Index.php, it should output: "Last session: 2011-11-19", please I hope you can help me out! I'd appreciate it. **Just look at Reply #7**

 

http://www.phpfreaks.com/forums/index.php?topic=347908.0

Link to comment
Share on other sites

If this is your own structure, you can define the valid structure for the document, by defining a DTD for it.  This is a nice tutorial that takes you through the process:  http://www.xmlfiles.com/dtd/dtd_intro.asp

 

You may not want to create your own DTD, but the point is, that if you are writing parsing code, then the documents need to follow a convention, and based on your example, if you wrote something using simplexml for example that parsed those files, you would not be happy if you could not depend on using: $xml->email->to to get access to the to value, were it present.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.