Some more questions-
8) are these the only ones? what should be int value to make it ON/OFF?
currently no matter what it is ON, like I put a \n in a attribute value and
loaded in DO and checked
the value there, it was always preserving \n
/**
* Line Break String such as "\n", "\r\n", "\r" and "", absence/null is
the default (line.separator System Property)
*/
final String XML_SAVE_LINE_BREAK = "LineBreak";
/**
* Indent String such as "\t", "", etc. absence/null is the default ("
")
*/
final String XML_SAVE_INDENT = "indent";
/**
* Margin String such as " ", "\t\t", etc. Absence/null/"" is the
default (no margin)
*/
final String XML_SAVE_MARGIN = "margin";
/**
* Attribute formatting that exceeds the specified width as Integer will
cause a line break so that formatting will continue indented on the next
line
*/
final String XML_SAVE_LINE_WIDTH = "LINE_WIDTH";
/**
* Boolean to save a doctype declaration
*/
final String XML_SAVE_DOCTYPE = "SAVE_DOCTYPE";
/**
* Boolean to process the schemaLocation/noNamespaceSchemaLocation
attributes occurring in the instance document to [EMAIL PROTECTED]
XSDHelper#define
convert XSD(s) to Types}
*/
final String XML_LOAD_SCHEMA = "ProcessSchemaLocations";
/**
* To tolerate malformed elements and attributes (default unless set by
System property XML.load.form.lax). 0 not to.
*/
final String XML_LOAD_LAX_FORM = "load malform";
Regards,
Amita
On 6/19/07, Amita Vadhavkar <[EMAIL PROTECTED]> wrote:
Hi,
In attempt to analyze JIRA-1317, I had some questions and would like to
get some
points clear.
1)Tuscany xmlHelperImpl have load() method where options can be passed in.
Why save() methods with
XMLDocument only have options supported and not for save() methods with
DataObject?
2)Why ResolvableImpl is in tuscany-sdo-lib, should it not be in
tuscany-sdo-impl? As this class is
in tuscany-sdo-lib and not tuscany-sdo-impl, it can not make use of
options implementation in tuscany-sdo-impl,
as these impl classes are not visible in tuscany-sdo-lib.
3)What is meaning of below code in XMLDocumentImpl?
if (options instanceof Map)
{
Class resourceFactoryClass =
(Class)((Map)options).get("GENERATED_LOADER");
if (resourceFactoryClass != null)
{
try
{
Object resourceFactory = resourceFactoryClass.newInstance();
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*",
resourceFactory);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
4)To provide code fix, code will change in (this is what I have thought so
far)
*HelperProviderBase->HelperProviderImpl->HelperContextImpl - constructor
to have options,
*XMLHelperImpl-to have member defaultOptions.
*tuscany-sdo-lib -SDOUtil code - SDOUtil.setDefaultXMLOptions(options)
A typical test case will look like -
public void testXMLOptions() throws IOException{
options = new HashMap();
options.put(SDOHelper.XMLOptions.XML_SAVE_LINE_BREAK, new
Integer(1));
((HelperProviderBase)HelperProvider.INSTANCE).createDefaultHelpers(options);
XMLHelper xmlHelper =
((HelperProviderBase)HelperProvider.INSTANCE).xmlHelper();
String xml="<?xml version=\"1.0\" encoding=\"ASCII\"?> " +
"<simple:stockQuote xmlns:simple=\"
www.example.com/simple\<http://www.example.com/simple/>">
" +
"<symbol>fbnt \n </symbol> " +
"<companyName>FlyByNightTechnology</companyName> " +
"<price>1000.0</price> " +
"<open1>1000.0</open1> " +
"<high>1000.0</high> " +
"<low>1000.0</low> " +
"<volume>1000.0</volume> " +
"<change1>1000.0</change1> " +
"<quotes> " +
"<price>2000.0</price> " +
"</quotes> " +
"</simple:stockQuote>";
XMLDocument xmlDoc = xmlHelper.load(new StringReader(xml), null,
null);
DataObject root = xmlDoc.getRootObject ();
List symbols = root.getList("symbol");
DataObject symbol = (DataObject)symbols.get(0);
String seqValue = (String)symbol.getSequence().getValue(0);
System.out.println("seqValue:"+seqValue+ "done");
System.out.println("index:"+seqValue.indexOf('\n'));
assertEquals(5, seqValue.indexOf('\n'));
}
5)When providing fix for this JIRA, when caller to load/save provides
options, these will override defaultOptions from XMLHelperImpl
6) What is being done in SDOXMLResourceImpl? How options are processed
here?
7) Why SDOUtil is lying in tuscany-sdo-impl and is used in many places?
Are new changes
supposed to be done only in tuscany-sdo-lib/SDOUtil?
Please let me know some details for above and I will be happy to ask more
questions :)
Regards,
Amita