1. For schema validation, use an XSD, not a DTD... DTD's are too basic and are hardly restrictive in terms of data typing. If you use a schema you'll be able to specify separate schemata for the Business child of the Services element and the Business child of the Businesses element.
2. I have a major disagreement over the use of CDATA in your case to hold the most important data. You cannot parse the elements within CDATA using any technology, be it JS or XSL. You can only retrieve the CDATA section as a block and performing some string operations, such as splitting the text, etc. It kinda defeats the purpose of storing your directory info in XML. On May 10, 10:08 pm, "Barry R. Dick" <[email protected]> wrote: > To be more specific... > > The content inside of Services -> Business is not going to be the same > as the one in Businesses -> Business, so my DTD keeps failing. > > <!DOCTYPE directory [ > <!ELEMENT directory ((services, businesses))> > <!ELEMENT services ((service+))> > <!ELEMENT service ((business))> > <!ATTLIST service > id NMTOKEN #REQUIRED > title CDATA #REQUIRED > > > <!ELEMENT business EMPTY> > <!ATTLIST business > id NMTOKENS #REQUIRED > > > <!ELEMENT businesses ((business+))> > <!ELEMENT business (#PCDATA)> > <!ATTLIST business > id NMTOKEN #REQUIRED > title CDATA #REQUIRED > > > ]> > > I guess simply because its being defined twice... > > Now, I can write javascript that'll print out the content, but when I > go to query it with javascript, that's where I get lost, so i was > hoping just to move the relevant data to a javascript array, and I was > hoping to get thoughts on that idea... Now I was hoping for the most > very basic, and I was even told not to use Javascript, and jump right > into XSL/XSLT. Now I'm only native PHP, but obviously this is a client > side application, so I don't know what to do exactly... JavaScript, at > first, I thought CDATA wouldn't work with it, but firefox and > IExplorer love it!! > > Any suggestions? > > On May 10, 2:39 am, Cerebrus <[email protected]> wrote: > > > > > Could you be more specific about what kind of suggestions you would > > like? > > > Your XML design looks okay (with regard to vocabulary), except for the > > fact that the most important information (the details of a Business) > > are enclosed along with presentational markup in a CDATA tag. This > > makes it nearly impossible to sort/index/search the data. Instead, I > > would have separate tags such as BusinessTitle, Description/Slogan/ > > Tagline, Address, Phone, Fax, ContactPerson, etc. as child tags in > > each Business tag.- Hide quoted text - > > - Show quoted text -
