nico_debeissat wrote: >> If you don't care about whitespaces you have to trim value anyway in > both >> (except that attribute values are normalized, but in a way which is more >> confusing then useful for many users). > > The problem is that if you ask for the text content of a markup which > has mixed content like the example given, you may have carriage > returns, tabs, both around and inside the result, depending on the > serializer you use.
You have been talking about storing values not mixed content -- and from that point there is no difference between <servlet> <servlet-name>YourServlet</servlet-name> ... and <servlet servlet-name="YourServlet"> ... >> In general, elements are much more flexible -- you can attach metadata >> to them, you can further extend them with subelements without breaking >> existing code, its easier to internationalize their content > (xml:lang, its:dir), ... > > I am often suspicious when people tell me that I have to do that > because "if, in the future, that may change, etc...", that is often a > lot of additional code for something which never happens :-). It is upon you to decide if for your case it is just enough to design schema somehow or you want to be prepared for future because you expect that schema will be used over long period and new requirements are likely to emerge. > You mean that I will not have to change my code if I change that : > <text> a text </text> > to > <text> > <article> > a > </article> > <noun>text > </noun> > </text> > The only way to do that is to ask text() on markup <text> and that I'm sorry I don't understand you there. If by text() you mean XPath node test then this is a bad way for reading text content of node. You should ask for string value of complete element node, see http://www.ibm.com/developerworks/xml/library/x-xsltmistakes/#nodetest (but this gets quite OT for RELAX NG list). > will bring me something I cannot really predict. You mean in terms of whitespace? If you design your schema with mixed content then you have to be very careful about whitespace in your instances -- but this is just matter of properly configured editing tool or self-discipline if you are using plain text editor. -- ------------------------------------------------------------------ Jirka Kosek e-mail: [email protected] http://xmlguru.cz ------------------------------------------------------------------ Professional XML consulting and training services DocBook customization, custom XSLT/XSL-FO document processing ------------------------------------------------------------------ OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 member ------------------------------------------------------------------
signature.asc
Description: OpenPGP digital signature
