Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
JSP - A mailing list about Java Server Pages specification and reference
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Oracle Connection Pooling in 3 2 2
Servlet : Session invalidate
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Tomcat and webapplication specific java library path
Running a Simple JMS Example
Mapping in workers2 properties
org apache jasper JasperException
Cannot find message resources under key org apache struts action
   MESSAGE
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
url string for connecting jboss to oracle
Value attribute of <html:checkbox
javax servlet ServletException: BeanUtils populate
HTTP Status 404 The requested resource is not available
5 0 18: Windows XP Pro vs Windows 2000
 
Newlines between attributes

Newlines between attributes

2006-03-21       - By Michael Kay

 Back
Reply:     1     2     3  

No XML serializers that I know of give you this much control over the
output. The Saxon serializer (which you could invoke to serialize the JDOM)
will put long attributes on separate lines, but using its own algorithm, not
yours. If you really want control at this level, you probably have to write
your own serializer.

Putting a newline as part of the attribute name is clearly doomed - you're
lucky it got stripped off rather than being rejected as an invalid name
character.

Michael Kay
http://www.saxonica.com/


 __ __  

From: jdom-interest-bounces@(protected) [mailto:jdom-interest-bounces@(protected)]
On Behalf Of David Patterson
Sent: 21 March 2006 18:09
To: jdom-interest@(protected)
Subject: [Norton AntiSpam] [jdom-interest] Newlines between attributes



I'm using JDOM and like it very much for its ease of use.



I'm now using JDOM to create a series of XML files where the attribute
values are long strings.  As a result, after 2-3 of them, the element
definition is very long. I know how to insert text objects between objects
to force line breaks, but what I have been so far unable to do is to specify
line breaks at known places between attributes in an element.



Is there a way to do this? Does it have to be done in a post-processing
task?



I tried doing:

       dmodule.setAttribute( "\nnoNamespaceSchemaLocation",

               "procedSchema.xsd", ns );



...but JDOM removed the leading NL character from the attribute name.



Dave Patterson

dpatterson@(protected)




<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:o =
"urn:schemas-microsoft-com:office:office" xmlns:w =
"urn:schemas-microsoft-com:office:word"><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2802" name=GENERATOR>
<STYLE>@(protected) Section1 {size: 8.5in 11.0in; margin: 1.0in 1.25in 1.0in 1.25in; }
P.MsoNormal {
  FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; COLOR: black; FONT-FAMILY: Arial
}
LI.MsoNormal {
  FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; COLOR: black; FONT-FAMILY: Arial
}
DIV.MsoNormal {
  FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; COLOR: black; FONT-FAMILY: Arial
}
A:link {
  COLOR: blue; TEXT-DECORATION: underline
}
SPAN.MsoHyperlink {
  COLOR: blue; TEXT-DECORATION: underline
}
A:visited {
  COLOR: purple; TEXT-DECORATION: underline
}
SPAN.MsoHyperlinkFollowed {
  COLOR: purple; TEXT-DECORATION: underline
}
SPAN.EmailStyle17 {
  FONT-WEIGHT: normal; COLOR: windowtext; FONT-STYLE: normal; FONT-FAMILY: Arial
; TEXT-DECORATION: none; mso-style-type: personal-compose
}
DIV.Section1 {
  page: Section1
}
</STYLE>
</HEAD>
<BODY lang=EN-US vLink=purple link=blue>
<DIV dir=ltr align=left><SPAN class=276431719-21032006><FONT face=Arial
color=#0000ff size=2>No XML serializers that I know of give you this much
control over the output. The Saxon serializer (which you could invoke to
serialize the JDOM) will put long attributes on separate lines, but using its
own algorithm, not yours. If you really want control at this level, you
probably
have to write your own serializer.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=276431719-21032006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=276431719-21032006><FONT face=Arial
color=#0000ff size=2>Putting a newline as part of the attribute name is clearly
doomed - you're lucky it got stripped off rather than being rejected as an
invalid name character.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=276431719-21032006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=276431719-21032006><FONT face=Arial
color=#0000ff size=2>Michael Kay</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=276431719-21032006><FONT face=Arial
color=#0000ff size=2><A
href="http://www.saxonica.com/">http://www.saxonica.com/</A></FONT></SPAN></DIV
><BR>
<BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid;
MARGIN-RIGHT: 0px">
 <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
 <HR tabIndex=-1>
 <FONT face=Tahoma size=2><B>From:</B> jdom-interest-bounces@(protected)
 [mailto:jdom-interest-bounces@(protected)] <B>On Behalf Of </B>David
 Patterson<BR><B>Sent:</B> 21 March 2006 18:09<BR><B>To:</B>
 jdom-interest@(protected)<BR><B>Subject:</B> [Norton AntiSpam] [jdom-interest]
 Newlines between attributes<BR></FONT><BR></DIV>
 <DIV></DIV>
 <DIV class=Section1>
 <P class=MsoNormal><FONT face=Arial color=black size=2><SPAN
 style="FONT-SIZE: 10pt; COLOR: windowtext">I&#8217;m using JDOM and like it
very
 much for its ease of use.<o:p></o:p></SPAN></FONT></P>
 <P class=MsoNormal><FONT face=Arial color=black size=2><SPAN
 style="FONT-SIZE: 10pt; COLOR: windowtext"><o:p>&nbsp;</o:p></SPAN></FONT></P>
 <P class=MsoNormal><FONT face=Arial color=black size=2><SPAN
 style="FONT-SIZE: 10pt; COLOR: windowtext">I&#8217;m now using JDOM to create
a
 series of XML files where the attribute values are long strings.&nbsp; As a
 result, after 2-3 of them, the element definition is very long. I know how to
 insert text objects between objects to force line breaks, but what I have
been
 so far unable to do is to specify line breaks at known places between
 attributes in an element.<o:p></o:p></SPAN></FONT></P>
 <P class=MsoNormal><FONT face=Arial color=black size=2><SPAN
 style="FONT-SIZE: 10pt; COLOR: windowtext"><o:p>&nbsp;</o:p></SPAN></FONT></P>
 <P class=MsoNormal><FONT face=Arial color=black size=2><SPAN
 style="FONT-SIZE: 10pt; COLOR: windowtext">Is there a way to do this? Does it
 have to be done in a post-processing task? <o:p></o:p></SPAN></FONT></P>
 <P class=MsoNormal><FONT face=Arial color=black size=2><SPAN
 style="FONT-SIZE: 10pt; COLOR: windowtext"><o:p>&nbsp;</o:p></SPAN></FONT></P>
 <P class=MsoNormal><FONT face=Arial color=black size=2><SPAN
 style="FONT-SIZE: 10pt; COLOR: windowtext">I tried
 doing:<o:p></o:p></SPAN></FONT></P>
 <P class=MsoNormal><FONT face=Arial color=black size=2><SPAN
 style="FONT-SIZE: 10pt; COLOR: windowtext">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;
 dmodule.setAttribute( "\nnoNamespaceSchemaLocation",
 <o:p></o:p></SPAN></FONT></P>
 <P class=MsoNormal><FONT face=Arial color=black size=2><SPAN
 style="FONT-SIZE: 10pt; COLOR: windowtext">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 "procedSchema.xsd", ns );<o:p></o:p></SPAN></FONT></P>
 <P class=MsoNormal><FONT face=Arial color=black size=2><SPAN
 style="FONT-SIZE: 10pt; COLOR: windowtext"><o:p>&nbsp;</o:p></SPAN></FONT></P>
 <P class=MsoNormal><FONT face=Arial color=black size=2><SPAN
 style="FONT-SIZE: 10pt; COLOR: windowtext">&nbsp;...but JDOM removed the
 leading NL character from the attribute name.<o:p></o:p></SPAN></FONT></P>
 <P class=MsoNormal><FONT face=Arial color=black size=2><SPAN
 style="FONT-SIZE: 10pt; COLOR: windowtext"><o:p>&nbsp;</o:p></SPAN></FONT></P>
 <DIV>
 <P class=MsoNormal><FONT face=Arial color=black size=2><SPAN
 style="FONT-SIZE: 10pt">Dave Patterson</SPAN></FONT><o:p></o:p></P>
 <P class=MsoNormal><EM><I><FONT face=Arial color=black size=2><SPAN
 style="FONT-SIZE: 10pt; FONT-STYLE: normal; FONT-FAMILY: Arial">dpatterson@(protected)
-a-i.com</SPAN></FONT></I></EM><o:p></o:p></P></DIV>
 <P class=MsoNormal><FONT face=Arial color=black size=3><SPAN
 style="FONT-SIZE: 12pt"><o:p>&nbsp;</o:p></SPAN></FONT></P></DIV></BLOCKQUOTE
></BODY></HTML>

__ ____ ____ ____ ____ ____ ____ ____ ____ ____
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.