[jdom-interest] Re: jdom-interest digest, Vol 1 #720 - 7 msgs

Peter.H.Roberts at bbh.com Peter.H.Roberts at bbh.com
Mon Oct 1 06:19:05 PDT 2001


In  response to:-
   2. How can I copy XML pieces(3-4 levels) to another XML file?? (Pedro Palomo)

Use the clone method if you want to copy or detach if you wish to move, then use addcontent to add to your new element:-

   // Get the database information from the Controller so we can add this to the users
   // xml...
  // report.getDatabase() pass back a jdom element which is a clone of the element that contains database info. ie:-
  //    Element dbClone = (Element)database.clone();
   Element dbClone = report.getDatabase();
   boolean databaseDebugFlag = report.databaseDebugFlag;
  user.xmlElement.addContent( dbClone );

Peter.



                                                                                                                  
                    jdom-interest-admi                                                                            
                    n at jdom.org               To:     jdom-interest at jdom.org                                       
                                             cc:                                                                  
                    09/29/2001 02:04         Subject:     jdom-interest digest, Vol 1 #720 - 7 msgs               
                    AM                                                                                            
                    Please respond to                                                                             
                    jdom-interest                                                                                 
                                                                                                                  
                                                                                                                  




Send jdom-interest mailing list submissions to
     jdom-interest at jdom.org

To subscribe or unsubscribe via the World Wide Web, visit
     http://lists.denveronline.net/mailman/listinfo/jdom-interest
or, via email, send a message with subject or body 'help' to
     jdom-interest-request at jdom.org

You can reach the person managing the list at
     jdom-interest-admin at jdom.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of jdom-interest digest..."


Today's Topics:

   1. Re: no getChildTextNormalize() ? (Laurent Bihanic)
   2. How can I copy XML pieces(3-4 levels) to another XML file?? (Pedro Palomo)
   3. RE: How can I copy XML pieces(3-4 levels) to another XML file?? (Terje Kvambe)
   4. Re: no getChildTextNormalize() ? (Kent Johnson)
   5. Validating an existing document (Steve Cohen)
   6. Re: Validating an existing document (Jason Hunter)
   7. XML document transfer performance (Dennis Sosnoski)

--__--__--

Message: 1
Date: Fri, 28 Sep 2001 09:09:15 +0200
From: Laurent Bihanic <laurent.bihanic at atosorigin.com>
To: jdom-interest at jdom.org
Subject: Re: [jdom-interest] no getChildTextNormalize() ?


Alex Rosen wrote:

> I'm always conflicted about convenience methods. They're so nice when you
> use them, but if you don't use them, they just clutter up the interface.
> I've always been thinking that all the getChildText() and the trimming and
> normalizing methods belong in helper classes, since they're only appropriate
> for one style of XML documents. Like:
>
>   String val = JDOMHelper.getChildTextNormalize(element, "childname");
>


+1 for a utility class as there are many such methods that would be useful: Allocation of a SAX parser, normalizeText() for any text (e.g. for comments), etc.




--__--__--

Message: 2
From: "Pedro Palomo" <ppalomo at hotpop.com>
To: <jdom-interest at jdom.org>
Date: Fri, 28 Sep 2001 12:08:13 +0200
Subject: [jdom-interest] How can I copy XML pieces(3-4 levels) to another XML file??

This is a multi-part message in MIME format.

------=_NextPart_000_000B_01C14816.3F367B20
Content-Type: text/plain;
     charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Good morning Friendst=A1=A1=A1 (In Spain)

I read some articles About JDOM to create,mutate and read XML files, but =
i have a doubt.

    I'm developing an application that copy XML pieces(3-4 levels) to =
another XML file, but i don't Know if JDOM have a function to copy( deep =
copy?? Can i use the clone function??) a big piece of XML to another XML =
file or I have to copy Element by Element and level by level??

    I wait for your expert tip=A1=A1=A1=A1=A1

    My best regard from M=E1laga(Spain)

    Pedro Palomo Pozo.
    ppalomo at hotpop.com
    pedropal at supercable.es


------=_NextPart_000_000B_01C14816.3F367B20
Content-Type: text/html;
     charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>
<DIV><FONT face=3DArial size=3D2>Good morning Friendst=A1=A1=A1 (In =
Spain)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I read some articles About JDOM to =
create,mutate=20
and read XML files, but i have a doubt.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; I'm developing an =
application=20
that copy XML pieces(3-4 levels) to another XML file, but i don't Know =
if JDOM=20
have a function to copy( deep copy?? Can i use the clone function??) a =
big piece=20
of XML to another XML file or I have to copy Element by Element and =
level by=20
level??</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; I wait for your =
expert=20
tip=A1=A1=A1=A1=A1</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT =
face=3DArial=20
size=3D2>My best regard from M=E1laga(Spain)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; Pedro Palomo =
Pozo.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; <A=20
href=3D"mailto:ppalomo at hotpop.com">ppalomo at hotpop.com</A></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; <A=20
href=3D"mailto:pedropal at supercable.es">pedropal at supercable.es</A></FONT><=
/DIV>
<DIV>&nbsp;</DIV></FONT></DIV></BODY></HTML>

------=_NextPart_000_000B_01C14816.3F367B20--



--__--__--

Message: 3
From: Terje Kvambe <Terje.Kvambe at multimedialab.tv>
To: "'Pedro Palomo'" <ppalomo at hotpop.com>, jdom-interest at jdom.org
Subject: RE: [jdom-interest] How can I copy XML pieces(3-4 levels) to another XML file??
Date: Fri, 28 Sep 2001 14:58:50 +0200

I'm not one of the real JDOM experts, but I would say that the answer to
your question is yes. You can use the clone method to take a deep copy of an
element. See javadoc from jdom.org below. If you want to cut&paste the
element, you can use the detach method instead.

clone
public Object clone()
This returns a deep clone of this element. The new element is detached from
its parent, and getParent() on the clone will return null.
Overrides:
clone in class Object
Returns:
the clone of this element

detach
public Element detach()
This detaches the element from its parent, or does nothing if the element
has no parent.
Returns:
Element - this Element modified.

Best regards,
Terje Kvambe
Accenture

-----Original Message-----
From: Pedro Palomo [mailto:ppalomo at hotpop.com]
Sent: 28. september 2001 12:08
To: jdom-interest at jdom.org
Subject: [jdom-interest] How can I copy XML pieces(3-4 levels) to another
XML file??


Good morning Friendst¡¡¡ (In Spain)

I read some articles About JDOM to create,mutate and read XML files, but i
have a doubt.

    I'm developing an application that copy XML pieces(3-4 levels) to
another XML file, but i don't Know if JDOM have a function to copy( deep
copy?? Can i use the clone function??) a big piece of XML to another XML
file or I have to copy Element by Element and level by level??

    I wait for your expert tip¡¡¡¡¡

    My best regard from Mᬡga(Spain)

    Pedro Palomo Pozo.
    ppalomo at hotpop.com
    pedropal at supercable.es

--__--__--

Message: 4
Date: Fri, 28 Sep 2001 10:30:34 -0500 (CDT)
From: Kent Johnson <kentj at rsn.hp.com>
To: Laurent Bihanic <laurent.bihanic at atosorigin.com>
Cc: jdom-interest at jdom.org
Subject: Re: [jdom-interest] no getChildTextNormalize() ?

+1 also.  In fact, I could start on this JDOMHelper class this weekend,
and add all the text handling methods, if y'all agree it's a good idea.

-Kent

On Fri, 28 Sep 2001, Laurent Bihanic wrote:

>
> Alex Rosen wrote:
>
> > I'm always conflicted about convenience methods. They're so nice when you
> > use them, but if you don't use them, they just clutter up the interface.
> > I've always been thinking that all the getChildText() and the trimming and
> > normalizing methods belong in helper classes, since they're only appropriate
> > for one style of XML documents. Like:
> >
> >   String val = JDOMHelper.getChildTextNormalize(element, "childname");
> >
>
>
> +1 for a utility class as there are many such methods that would be useful:
> Allocation of a SAX parser, normalizeText() for any text (e.g. for
> comments, etc.
>
>
>
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
>
>


--__--__--

Message: 5
Date: Fri, 28 Sep 2001 14:37:06 -0500
From: Steve Cohen <stevec at ignitesports.com>
To: jdom-interest at jdom.org
Subject: [jdom-interest] Validating an existing document

When building a JDOM document from scratch containing a DTD reference,
what is the best way to validate that document before outputting it?

In other words, given an org.jdom.Document, is there an API that
validates it against its DTD?  Or must you somehow "build" it from
itself just so that you can get access the validation functionality that
is available to the parser classes.

Steve Cohen
Sr. Software Engineer
Ignite Sports, LLC
stevec at ignitesports.com


--__--__--

Message: 6
Date: Fri, 28 Sep 2001 12:50:28 -0700
From: Jason Hunter <jhunter at collab.net>
To: Steve Cohen <stevec at ignitesports.com>
CC: jdom-interest at jdom.org
Subject: Re: [jdom-interest] Validating an existing document

The best way is for someone (you?) to take on the TODO item to write
such a validator.  :-)  You'd be a popular man if you wrote it.

-jh-

Steve Cohen wrote:
>
> When building a JDOM document from scratch containing a DTD reference,
> what is the best way to validate that document before outputting it?
>
> In other words, given an org.jdom.Document, is there an API that
> validates it against its DTD?  Or must you somehow "build" it from
> itself just so that you can get access the validation functionality that
> is available to the parser classes.
>
> Steve Cohen
> Sr. Software Engineer
> Ignite Sports, LLC
> stevec at ignitesports.com
>
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com

--__--__--

Message: 7
Date: Fri, 28 Sep 2001 14:55:57 -0700
From: Dennis Sosnoski <dms at sosnoski.com>
Organization: Sosnoski Software Solutions, Inc.
To: "jdom-interest at jdom.org" <jdom-interest at jdom.org>
Subject: [jdom-interest] XML document transfer performance

I've published open source code and format definitions for a project I developed
called "XML Serial Encoding". This provides far better performance for sending
documents between programs than either text or Java serialization. The code
comes with adapters for use with both dom4j and JDOM.

The main page for this project is at
http://www.sosnoski.com/opensrc/xmls/index.html, and the test results are at
http://www.sosnoski.com/opensrc/xmls/results.html. It'll probably be going
through some fairly minor changes over the next couple of months before the 1.0
release, but should be usable with most types of documents now.

Hope people find it of use!

  - Dennis





--__--__--

_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com

End of jdom-interest Digest






More information about the jdom-interest mailing list