I am working on some serialization sub procedures and am looking at how to
get the string representation of an XML document, for example I want to be
able to get the following.

<?xml version="1.0" encoding="UTF-8"?>
<Transaction>
 <Order id="12345" dateReceived="2002-05-14">
  <Item>
  </Item>
 </Order>
</Transaction>

After studying the API's it seems you must got to great lengths to get a
string representation of an XML document regardless of whether you use SAX
or DOM.  For instance here is some code to produce the 'id' attribute in
Order.

// You have to literally add each character including spaces.
...
QxmlXMLFormatter_streamoutXMLCh(gFormatter@: %ADDR(chSpace))   // Add Space

QxmlXMLFormatter_streamoutDOMString(gFormatter@: AttrName2@)   // Add
Attribute Name                            
QxmlXMLFormatter_streamoutXMLCh(gFormatter@: %ADDR(chEqual))   // Add the
equal sign                        
QxmlXMLFormatter_streamoutXMLCh(gFormatter@: %ADDR(chDoubleQuote)) //Start
the double quote                     
QxmlXMLFormatter_setEscapeFlags(gFormatter@: Qxml_AttrEscapes)   // not sure
yet                      
QxmlXMLFormatter_streamoutDOMString(gFormatter@: AttrVal2@)   // Add the
value of the Attribute                             
QxmlXMLFormatter_setEscapeFlags(gFormatter@: Qxml_NoEscapes) // not sure yet

QxmlXMLFormatter_streamoutXMLCh(gFormatter@: %ADDR(chDoubleQuote)) //End the
double quote
...

YIKES!  Is there an easier way with the provided API's?

If not I will start typing... or does somebody already have this done and
would like to donate some code?

Aaron Bartell

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.