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
https://forums.phpfreaks.com/topic/251297-node-order/#findComment-1288864
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
https://forums.phpfreaks.com/topic/251297-node-order/#findComment-1288868
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.