|
From: <pe...@us...> - 2003-12-11 16:16:08
|
Update of /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml
In directory sc8-pr-cvs1:/tmp/cvs-serv1004/src/java/org/neuclear/xml
Modified Files:
AbstractElementProxy.java
Log Message:
Some changes to make the xml a bit more readable.
Also added some helper methods in AbstractElementProxy to make it easier to build objects.
Index: AbstractElementProxy.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/AbstractElementProxy.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** AbstractElementProxy.java 10 Dec 2003 23:57:05 -0000 1.4
--- AbstractElementProxy.java 11 Dec 2003 16:16:05 -0000 1.5
***************
*** 2,5 ****
--- 2,9 ----
* $Id$
* $Log$
+ * Revision 1.5 2003/12/11 16:16:05 pelle
+ * Some changes to make the xml a bit more readable.
+ * Also added some helper methods in AbstractElementProxy to make it easier to build objects.
+ *
* Revision 1.4 2003/12/10 23:57:05 pelle
* Did some cleaning up in the builders
***************
*** 121,133 ****
}
! protected final void addElement(final AbstractElementProxy child) throws XMLException {
addElement(child.getElement());
}
! protected final void addElement(final Element child) throws XMLException {
element.add(child);
! element.addText("\n");
}
public final QName getQName() {
return new QName(getTagName(), getNS());
--- 125,183 ----
}
! /**
! * Adds another AbstractElementProxy as a child element to this Element
! * @param child
! */
! protected final Element addElement(final AbstractElementProxy child) {
addElement(child.getElement());
+ return child.getElement();
}
! /**
! * Adds another Element as a child element to this Element
! * @param child
! */
! protected final Element addElement(final Element child) {
element.add(child);
! addLineBreak();
! return element;
! }
! /**
! * Adds another Element with the given QName to this Element
! * @param child
! */
! protected final Element addElement(final QName child) {
! Element element = DocumentHelper.createElement(child);
! addElement(element);
! return element;
! }
! /**
! * Adds another Element with the given name and the same Namespace as this element to this element.
! * @param child
! */
! protected final Element addElement(final String child) {
! Element element = DocumentHelper.createElement(createQName(child));
! addElement(element);
! return element;
! }
!
! /**
! * Creates a QName in this object namespace
! * @param child
! * @return
! */
! protected QName createQName(final String child) {
! return DocumentHelper.createQName(child,this.element.getNamespace());
}
+ /**
+ * Adds a linebreak to the xml, making it easier to read for humans
+ */
+ protected final void addLineBreak(){
+ element.addText("\n");
+ }
+ protected final void createAttribute(String name,String value){
+ element.addAttribute(createQName(name),value);
+ }
public final QName getQName() {
return new QName(getTagName(), getNS());
|