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'));
    }

Your suggestions appear reasonable.  It would be easier for me if you
could provide a prototype patch as the basis for discussion then I can
really get to understand and brush up against the problems first hand.
If you have an issue that you can't see a way to resolve you can
provide a patch that clearly states that this is not the solution,
even if it shows compile failures,  then I can help you search for the
solution.

Three are some issues with your test code.  First off is the way you
access xmlHelper.  Best practice is to create a new HelperContext with
the SDOUtil.createHelperContext methods.  If you really need to use
the default instances then you use HelperProvide.getDefaultContext().

The other issue is the way you get the symbol value.  If you are using
the existing simple.xsd then I think symbol is single valued, so I
think you can just do ...

String symbol = root.getString("symbol");
Kelvin

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to