Indenting (false)If true, then the serializer will add indents at each level and wrap lines that exceed the maximum line width. If false it won't. The number of spaces to indent is set by the indent property, and the column to wrap at is set by the line width property.

Indent (4)The number of spaces to indent each level if indenting is true.

public void setIndent(int indent);public int getIndent();

Line width (72)The maximum number of characters in a line when indenting is true. Setting this to zero turns off line wrapping completely.

public void setLineWidth(int width);public int getLineWidth();

So, we can set a line width, set indenting to true and give an indent value. The best way is this i think. I read "Creating DOMWriters" section too and it does not solve this problem either. (it just can select which nodes can be printed)

That is similar to what I did (see top of thread), but it doesn't solve the problem of adding new lines after attributes, it only does elements. As I don't think this isn't a standard way of formatting XML data, I suspect we may have to roll our own.

I'm using it for a project at work, and it works _extremely_ well. As one of my colleagues said recently, it's probably the only third-party product we've ever used that we haven't complained about a single time yet :-)

Well, read the tutorial. You have my guarantee that it really does work as nicely as the article proposes - at least for XML parsing, I haven't yet tried it for generating XML documents. However, it does have some output formatting capability, so I guess it's fine for this too.

As planned before, i tried to implement "save/save as" in jphyswiz and test xode exporting feature.

Here are the problems i found:

1. I need to clone XODEObjects for copy/pasting operations. When i clone a node and tried to add that node under a container (using addChild method) i get an XODEException, since setParent(..) method in XODEObject does not allow to to change parent if you have one already. So we need to modify something there. What are your thoughts?

2. I looked at XODERoot but can not find getDocument method for exporting. Are you sure that you commited the changes?

3. It seems that "adding ability to add/remove child XODEObjects from XODEContainers ..." is in todo list. Isn't this already implemented? This is also a very important requirement for jphyswiz now.

As planned before, i tried to implement "save/save as" in jphyswiz and test xode exporting feature.

Here are the problems i found:

1. I need to clone XODEObjects for copy/pasting operations. When i clone a node and tried to add that node under a container (using addChild method) i get an XODEException, since setParent(..) method in XODEObject does not allow to to change parent if you have one already. So we need to modify something there. What are your thoughts?

EDIT: see my next post

Quote

2. I looked at XODERoot but can not find getDocument method for exporting. Are you sure that you commited the changes?

It's called "buildDocument" and it's there, I got it in my CVS commit email.

if you can't see it, do a "cvs update -d"

Quote

3. It seems that "adding ability to add/remove child XODEObjects from XODEContainers ..." is in todo list. Isn't this already implemented? This is also a very important requirement for jphyswiz now.

It is on the TODO list as it is not implemented. It is a trivial change though, and I realise this is very important for you (hence the reason it is on the TODO list). I will try to do it today.

... The clone method would have to exist in the XODEObject (or an extension of that class) so it is able to call the protected XODEObject.setParent method passing 'null' (the use of that method is explicitally not recommended unless one is very aware of the implications of using it, which in this case we are and it is the correct thing to do).

It seems that i should implement clone() method of XODEObject. I should add a method to XODEUtil class (i could not remember its name now and i do not have the source now) to clone objects using serialization (i gave the reference for alternative serialization method before) and use that method in XODEObject's clone method plus setting the parent null.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org