|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
need basic help - listing suggestions
hello,
i am very new to XML and am confused by the way i should list some info. I have a tree that flows like this: <AllArticles> <CompanyName>Name</CompanyName> <ArticleCount>1</ArticleCount> <rArticlesPath> <![CDATA[ActLib]]> </rArticlesPath> <Categories> <Category> <CategoryName>Cat 1</CategoryName> <CategoryID>107</CategoryID> <Articles> <Article> <ArticleID>416</ArticleID> <JobNumber>416-1</JobNumber> <Subject> <![CDATA[416 title]]> </Subject> <OriginalFile> <![CDATA[ST 8-3]]> </OriginalFile> <ArticleSorts> <Material>sugar</Material> <Material>sand</Material> <Industry>Food</Industry> <MachineType>Single Deck</MachineType> </ArticleSorts> <Materials> <Material>sugar</Material> <Material>sand</Material> </Materials> <Industries> <Industry>Food</Industry> </Industries> <MachineTypes> <MachineType>Single Deck</MachineType> </MachineTypes> </Article> </Articles> </Category> </Categories> </AllArticles> I need to be able to add a varying amount of Materials, Industries, and Machine Types to each Article. How shoudl the structure be set up to accomidate this? I have it in two ways right now that i am testing: <ArticleSorts> <Material>sugar</Material> <Material>sand</Material> <Industry>Food</Industry> <MachineType>Single Deck</MachineType> </ArticleSorts> <Materials> <Material>sugar</Material> <Material>sand</Material> </Materials> <Industries> <Industry>Food</Industry> </Industries> <MachineTypes> <MachineType>Single Deck</MachineType> </MachineTypes> I cant seem to understand which of these ways is correct. Also, I will need to be able to choose the articles later by sorting them by the different elements (Machine Type, Industries, etc..) and the variable passed to them (Material = sand, etc..) I hope this makes sense. I am using PHP. thank you for any guidance. |
|
#2
|
|||
|
|||
|
I think i know you: but anyway.
The second way that you have it is better. Code:
<articlesorts>
<materials>
<material>sugar</material>
<material>salt</material>
</materials>
<industries>
<industry>Food</industry>
<industry>
</articlesorts>
or you could do something like Code:
<articleproperties>
<property name="material" value="sugar"/>
<property name="material" value="salt"/>
<property name="industyr" value="food"/>
</articleproperties>
personally i think the first is the better way to go though. but whatever wat you are more comfortable with. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > need basic help - listing suggestions |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|