<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Dec 1, 2009, at 15:55 , David Lichteblau wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Quoting Marco Antoniotti (<a href="mailto:marcoxa@cs.nyu.edu">marcoxa@cs.nyu.edu</a>):<br><blockquote type="cite">2 - since this is not CXML default behavior, is there a way to get<br></blockquote><blockquote type="cite">CXML to do the "obvious" thing?<br></blockquote><br>There is no single obvious thing.  You need to define which kind of<br>whitespace stripping you want.</div></blockquote><div><br></div><div>AFAIU the DTD specifies how to deal with whitespaces.  The examples in the documentation seem to say that.</div><div><br></div><blockquote type="cite"><div>  a. Strip all text nodes, including those that have non-whitespace in<br>     them?<br><br>  b. Strip all text nodes that are made up of whitespace exclusively?<br><br>  c. Take text nodes that have non-whitespace and whitespace, and remove<br>     the whitespace from them while keeping the non-whitespace?<br><br>  d. Same as c, but "compress" such whitespace rather than removing it<br>     entirely?<br><br>  e. Choose between c and d depending on what the parent element is?<br><br>  f. Do b only depending on what the parent element is?<br><br>Case study:<br><br>  - XSLT basically does b, with a couple of customization features.<br><br>  - HTML does e<br><br>  - the DTD-based thing is f<br><br><blockquote type="cite">I know that I could possibly remove the TEXT elements by hand, after<br></blockquote><blockquote type="cite">having built the internal structure; but it does not feel right.<br></blockquote><br>There are two technical approaches to normalize whitespace with cxml's APIs:<br>  - Do it on the fly, either in a SAX handler or a KLACKS source<br>  - Do it after the fact in the object model or application<br><br>The DTD-based thing is implemented as a SAX handler (first approach),<br>see cxml/xml/space-normalizer.lisp<br><br>XSLT-style normalization is available in Xuriella XSLT, implemented<br>using STP; see the function STRIP-STYLESHEET in xuriella/space.lisp.<br><br>Note that both implementation types I listed above are done entirely in<br>user code.  You don't need to change cxml to implement yet another<br>variety of whitespace stripping. <br><br>Just copy&paste the code and change it to suit your needs -- or rewrite<br>it.  STRIP-STYLESHEET is a total of 23 lines of code long, I think.<br><br></div></blockquote><br></div><div>Ok, that is a lot of work on my part AFAIAC.  I think I understand the mechanics of what you are saying, but you are not answering my question.</div><div><br></div><div>I gave you the first two lines of theSBML document.  SBML comes with a XSchema definition.  I am assuming that having the xsd will be equivalent to having the DTD (I think I am right on this) and therefore have the correct indication about what is what and how it should be parsed.</div><div><br></div><div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px;"><?xml version="1.0" encoding="UTF-8"?></span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px;"><sbml xmlns="<a href="http://www.sbml.org/sbml/level1">http://www.sbml.org/sbml/level1</a>" level="1" version="1"></span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px;">...</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px;"></sbml></span></font></div><div><br></div><div>is what I have.</div><div><br></div><div>Can XML be coerced into accessing the xmlns="<a href="http://www.sbml.org/sbml/level1">http://www.sbml.org/sbml/level1</a>" (with DRAKMA), understanding it and using it or not?  (Thus - hopefully - stripping the TEXT elements automatically?)</div><div><br></div><div>If yes, how?</div></div><div><br></div><div>IMHO, it would be quite a plus to be able to deal with a case like this automatically (i.e., SBML) without much user intervention, especially as a post-processing step.</div><div><br></div><div>Cheers</div><div><br></div><div><div><div>--</div><div>Marco Antoniotti</div></div><br></div><br></body></html>