Hello,

Thanks to read this post. I will try to put all the info to help you to help
me. I use castor1.2 from castor's official web site. My problem is that
castor create a new line character while marshalling my own objects when a
size of content is reached :

...
                <tag>SWI_meaning = &apos;DBCODE_5;leaf;José Maria
                    Paredes Rojas&apos;;</tag>
...

I'm using "org.exolab.castor.indent=true" in my castor properties file. If I
put it to false, I don't have the problem but I have all the file on the
same line. So I want it indented but without the new lines added in tag
contents.
______________________________________________________________________

The way I marshall my object is:

FileWriter writer = null;
                
try {
        writer = new FileWriter(grammarPath);
} catch (IOException e) {
        throw new GrammarGenerationFailedException(e);
}
                
// Load Mapping
Mapping mapping = null;
try {
        mapping = new Mapping(getClass().getClassLoader()); 
        mapping.loadMapping(mappingPath);
} catch (IOException e) {
        throw new GrammarGenerationFailedException(e);
} catch (MappingException e) {
        throw new GrammarGenerationFailedException(e);
}               

try {
        Marshaller marshaller = new Marshaller(writer);
        marshaller.setSchemaLocation(grammar.getXsiSchemaLocation());
        marshaller.setMapping(mapping);
        marshaller.setEncoding(MyClass.GRAMMAR_DEFAULT_ENCODING);
        marshaller.marshal(grammar);
} catch (MarshalException e) {
        throw new GrammarGenerationFailedException(e);
} catch (ValidationException e) {
        throw new GrammarGenerationFailedException(e);
} catch (IOException e) {
        throw new GrammarGenerationFailedException(e);
} catch (MappingException e) {
        throw new GrammarGenerationFailedException(e);
}
______________________________________________________________________

Mapping File:


<?xml version="1.0" encoding="ISO-8859-1"?>
<mapping>
        <description>Description of the mapping</description>
        <class name="myPackage.Grammar">
                <map-to xml="grammar"/>
                <field name="ruleList"
                        type="myPackage.Rule"
                        collection="arraylist">
                        <bind-xml name="rule"/>
                </field>
                <field name="version"
                        type="java.lang.String">
                        <bind-xml name="version" node="attribute"/>
                </field>
                <field name="xmlns"
                        type="java.lang.String">
                        <bind-xml name="xmlns" node="attribute"/>
                </field>
                <field name="xmlLang"
                        type="java.lang.String">
                        <bind-xml name="xml:lang" node="attribute"/>
                </field>
                <field name="mode"
                        type="java.lang.String">
                        <bind-xml name="mode" node="attribute"/>
                </field>
                <field name="root"
                        type="java.lang.String">
                        <bind-xml name="root" node="attribute"/>
                </field>                                 
        </class>
        <class name="myPackage.Rule">
                <map-to xml="rule"/>
                <field name="id"
                        type="java.lang.String">
                        <bind-xml name="id" node="attribute"/>
                </field>                
                <field name="oneOf"
                        type="myPackage.OneOf">
                        <bind-xml name="one-of"/>
                </field>
        </class>
        <class name="myPackage.OneOf">
                <map-to xml="one-of"/>
                <field name="itemList"
                        type="myPackage.Item"
                        collection="arraylist">
                        <bind-xml name="item"/>
                </field>
        </class>
        <class name="myPackage.Item">
                <map-to xml="item"/>
                <field name="oneOf"
                        type="myPackage.OneOf">
                        <bind-xml name="one-of"/>
                </field>
                <field name="value" type="java.lang.String">
                        <bind-xml name="item" node="text"/>
                </field>
                <field name="ruleRef" type="myPackage.RuleRef">
                        <bind-xml name="ruleref" />
                </field>
                <field name="tag" type="java.lang.String">
                        <bind-xml name="tag" />
                </field>                                                        
        </class>
        <class name="myPackage.RuleRef">
                <map-to xml="ruleref"/>
                <field name="uri"
                        type="java.lang.String">
                        <bind-xml name="uri" node="attribute"/>
                </field>                
        </class>        
</mapping>

______________________________________________________________________

How can be set the max size of tag content? Could it be set to unlimited?

Thanks,

Mateo.


-- 
View this message in context: 
http://www.nabble.com/Castor-add-new-line-in-my-tag%27s-content-tp17620341p17620341.html
Sent from the Castor - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to