<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>j-users@xerces.apache.org Archives</title>
<link rel="self" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/?format=atom"/>
<link href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/"/>
<id>http://mail-archives.apache.org/mod_mbox/xerces-j-users/</id>
<updated>2009-12-07T14:31:48Z</updated>
<entry>
<title>Re: Special characters problem while writing XML files using JAXP DOM	Parser</title>
<author><name>Benson Margulies &lt;bimargulies@gmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200912.mbox/%3c61b5d9410912040753m5f2431bbwad2d41ec32812183@mail.gmail.com%3e"/>
<id>urn:uuid:%3c61b5d9410912040753m5f2431bbwad2d41ec32812183@mail-gmail-com%3e</id>
<updated>2009-12-04T15:53:29Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
I (mis?)understood the original poster to have a strong opinion on the
lexical surface form of the XML.

On Fri, Dec 4, 2009 at 8:23 AM, Michael Glavassevich
&lt;mrglavas@ca.ibm.com&gt; wrote:
&gt; Sure, lexically but CDATA is just syntactic sugar. An entity reference
&gt; (&amp;lt;) or character reference (&amp;#60; or &amp;#x3C;) would also work fine.
&gt;
&gt; Michael Glavassevich
&gt; XML Parser Development
&gt; IBM Toronto Lab
&gt; E-mail: mrglavas@ca.ibm.com
&gt; E-mail: mrglavas@apache.org
&gt;
&gt; Benson Margulies &lt;bimargulies@gmail.com&gt; wrote on 12/04/2009 07:13:06 AM:
&gt;
&gt;&gt; If you need a less than, you need to put it all in a CDATA.
&gt;&gt;
&gt;&gt;
&gt;&gt; On Fri, Dec 4, 2009 at 12:25 AM, nagineni &lt;naganirangen_r@yahoo.com&gt;
&gt;&gt; wrote:
&gt;&gt; &gt;
&gt;&gt; &gt; Hi,
&gt;&gt; &gt;
&gt;&gt; &gt; I'm creating xml file using JAXP DOM parser.While writing text data to a
&gt;&gt; &gt; node parser is writing special characters.Below is the example.
&gt;&gt; &gt;
&gt;&gt; &gt; &lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
&gt;&gt; &gt; &lt;template&gt;
&gt;&gt; &gt; Â  Â  Â  Â  Â &lt;name&gt;naga&lt;/name&gt;
&gt;&gt; &gt; Â  Â  Â  Â  Â &lt;expr&gt;for(int i=0;i&amp;lt20;i++)&lt;/expr&gt;
&gt;&gt; &gt; &lt;/template&gt;
&gt;&gt; &gt;
&gt;&gt; &gt; I want to my XML file output for(int i=0;i&lt;20;i++) inside &lt;expr&gt;
&gt;&gt; &gt; element.Is
&gt;&gt; &gt; there any solution around it ?
&gt;&gt; &gt; Can any one suggest me the solution for this problem ?Thanks in advance.
&gt;&gt; &gt;
&gt;&gt; &gt; Regards,
&gt;&gt; &gt; Naga.
&gt;&gt; &gt;
&gt;&gt; &gt;
&gt;&gt; &gt; -----
&gt;&gt; &gt; Regards,
&gt;&gt; &gt; Naga.
&gt;&gt; &gt; --
&gt;&gt; &gt; View this message in context: http://old.nabble.com/Special-
&gt;&gt; characters-problem-while-writing-XML-files-using-JAXP-DOM-Parser-
&gt;&gt; tp26635769p26635769.html
&gt;&gt; &gt; Sent from the Xerces - J - Users mailing list archive at Nabble.com.
&gt;&gt; &gt;
&gt;&gt; &gt;
&gt;&gt; &gt; ---------------------------------------------------------------------
&gt;&gt; &gt; To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
&gt;&gt; &gt; For additional commands, e-mail: j-users-help@xerces.apache.org
&gt;&gt; &gt;
&gt;&gt; &gt;
&gt;&gt;
&gt;&gt; ---------------------------------------------------------------------
&gt;&gt; To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
&gt;&gt; For additional commands, e-mail: j-users-help@xerces.apache.org
&gt;

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Special characters problem while writing XML files using JAXP DOM 	Parser</title>
<author><name>keshlam@us.ibm.com</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200912.mbox/%3cOFFA6B663F.0E36EDFC-ON85257682.004999CE-85257682.0049E5AE@lotus.com%3e"/>
<id>urn:uuid:%3cOFFA6B663F-0E36EDFC-ON85257682-004999CE-85257682-0049E5AE@lotus-com%3e</id>
<updated>2009-12-04T13:29:53Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Or, better, escape the individual troublesome character by expressing it 
as  &amp;lt;

XML also considers &gt; and &amp; to be reserved characters; they should be 
expressed as &amp;gt; and &amp;amp;.

&lt;[[CDATA[]]&gt; sections, which provide a block-escaping mechanism, are 
sometimes useful for hand-generated XML; less so for machine-generated. I 
generally discourage their use.

______________________________________
"... Three things see no end: A loop with exit code done wrong,
A semaphore untested, And the change that comes along. ..."
  -- "Threes" Rev 1.1 - Duane Elms / Leslie Fish (
http://www.ovff.org/pegasus/songs/threes-rev-11.html)



Benson Margulies &lt;bimargulies@gmail.com&gt; 
12/04/2009 07:13 AM
Please respond to
j-users@xerces.apache.org


To
j-users@xerces.apache.org
cc

Subject
Re: Special characters problem while writing XML files using JAXP DOM 
Parser






If you need a less than, you need to put it all in a CDATA.


On Fri, Dec 4, 2009 at 12:25 AM, nagineni &lt;naganirangen_r@yahoo.com&gt; 
wrote:
&gt;
&gt; Hi,
&gt;
&gt; I'm creating xml file using JAXP DOM parser.While writing text data to a
&gt; node parser is writing special characters.Below is the example.
&gt;
&gt; &lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
&gt; &lt;template&gt;
&gt;          &lt;name&gt;naga&lt;/name&gt;
&gt;          &lt;expr&gt;for(int i=0;i&amp;lt20;i++)&lt;/expr&gt;
&gt; &lt;/template&gt;
&gt;
&gt; I want to my XML file output for(int i=0;i&lt;20;i++) inside &lt;expr&gt; 
element.Is
&gt; there any solution around it ?
&gt; Can any one suggest me the solution for this problem ?Thanks in advance.
&gt;
&gt; Regards,
&gt; Naga.
&gt;
&gt;
&gt; -----
&gt; Regards,
&gt; Naga.
&gt; --
&gt; View this message in context: 
http://old.nabble.com/Special-characters-problem-while-writing-XML-files-using-JAXP-DOM-Parser-tp26635769p26635769.html

&gt; Sent from the Xerces - J - Users mailing list archive at Nabble.com.
&gt;
&gt;
&gt; ---------------------------------------------------------------------
&gt; To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
&gt; For additional commands, e-mail: j-users-help@xerces.apache.org
&gt;
&gt;

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org




</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Special characters problem while writing XML files using JAXP DOM 	Parser</title>
<author><name>Michael Glavassevich &lt;mrglavas@ca.ibm.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200912.mbox/%3cOF39801EAC.5A39A289-ON85257682.0048F42A-85257682.00499B3C@ca.ibm.com%3e"/>
<id>urn:uuid:%3cOF39801EAC-5A39A289-ON85257682-0048F42A-85257682-00499B3C@ca-ibm-com%3e</id>
<updated>2009-12-04T13:23:58Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Content-type: text/plain; charset=ISO-8859-1
Content-transfer-encoding: quoted-printable


Sure, lexically but CDATA is just syntactic sugar. An entity reference
(&amp;lt;) or character reference (&amp;#60; or &amp;#x3C;) would also work fine.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Benson Margulies &lt;bimargulies@gmail.com&gt; wrote on 12/04/2009 07:13:06 A=
M:

&gt; If you need a less than, you need to put it all in a CDATA.
&gt;
&gt;
&gt; On Fri, Dec 4, 2009 at 12:25 AM, nagineni &lt;naganirangen_r@yahoo.com&gt;
wrote:
&gt; &gt;
&gt; &gt; Hi,
&gt; &gt;
&gt; &gt; I'm creating xml file using JAXP DOM parser.While writing text data=
 to
a
&gt; &gt; node parser is writing special characters.Below is the example.
&gt; &gt;
&gt; &gt; &lt;?xml version=3D"1.0" encoding=3D"UTF-8" standalone=3D"no"?&gt;
&gt; &gt; &lt;template&gt;
&gt; &gt; =A0 =A0 =A0 =A0 =A0&lt;name&gt;naga&lt;/name&gt;
&gt; &gt; =A0 =A0 =A0 =A0 =A0&lt;expr&gt;for(int i=3D0;i&amp;lt20;i++)&lt;/expr&gt;
&gt; &gt; &lt;/template&gt;
&gt; &gt;
&gt; &gt; I want to my XML file output for(int i=3D0;i&lt;20;i++) inside &lt;expr&gt;
element.Is
&gt; &gt; there any solution around it ?
&gt; &gt; Can any one suggest me the solution for this problem ?Thanks in
advance.
&gt; &gt;
&gt; &gt; Regards,
&gt; &gt; Naga.
&gt; &gt;
&gt; &gt;
&gt; &gt; -----
&gt; &gt; Regards,
&gt; &gt; Naga.
&gt; &gt; --
&gt; &gt; View this message in context: http://old.nabble.com/Special-
&gt; characters-problem-while-writing-XML-files-using-JAXP-DOM-Parser-
&gt; tp26635769p26635769.html
&gt; &gt; Sent from the Xerces - J - Users mailing list archive at Nabble.com=
.
&gt; &gt;
&gt; &gt;
&gt; &gt; -------------------------------------------------------------------=
--
&gt; &gt; To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
&gt; &gt; For additional commands, e-mail: j-users-help@xerces.apache.org
&gt; &gt;
&gt; &gt;
&gt;
&gt; ---------------------------------------------------------------------=

&gt; To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
&gt; For additional commands, e-mail: j-users-help@xerces.apache.org=


</pre>
</div>
</content>
</entry>
<entry>
<title>Re: External entity in XML causing null pointer exception during DocumentBuilder.parse</title>
<author><name>Michael Glavassevich &lt;mrglavas@ca.ibm.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200912.mbox/%3cOF83CEDAE7.10142D34-ON85257682.0045E4D3-85257682.004631B3@ca.ibm.com%3e"/>
<id>urn:uuid:%3cOF83CEDAE7-10142D34-ON85257682-0045E4D3-85257682-004631B3@ca-ibm-com%3e</id>
<updated>2009-12-04T12:46:41Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Content-type: text/plain; charset=US-ASCII

I already responded to you. See [1].

[1] http://markmail.org/message/2qzf4yeeg5iy5o7e.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

sri kumar &lt;sri_kumar_4u@yahoo.co.in&gt; wrote on 12/04/2009 07:18:28 AM:

&gt; I was trying to parse a XML Document using DOM Parser.
&gt;
&gt; I got null pointer exception while executing doc = builder.parse
&gt; (xmlDataFile);
&gt;
&gt; There were few entities in the XML data file. On removing a
&gt; particular entity, i was able to parse the file successfully
&gt;
&gt; The entity was some thing like this
&gt;
&gt; &lt;!ENTITY SAMPLE.TIF SYSTEM "SAMPLE.TIF" NDATA TIF&gt;
&gt;
&gt; What could be the reason?
&gt;
&gt; EDIT:
&gt;
&gt; Here is the code:
&gt;
&gt;         DocumentBuilderFactory aFactory =
&gt; DocumentBuilderFactory.newInstance();
&gt;         aFactory.setValidating(false);
&gt;         aFactory.setFeature("http://xml.org/sax/features/namespaces",
false);
&gt;         aFactory.setFeature
("http://apache.org/xml/features/validation/schema
&gt; ", false);
&gt;         aFactory.setIgnoringComments(true);
&gt;         builder = aFactory.newDocumentBuilder();
&gt;         doc = builder.parse(xmlDataFile);
&gt; This is the trace:
&gt;
&gt;  at
&gt; com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl.setChunkIndex
&gt; (DeferredDocumentImpl.java:1944)
&gt;     at
&gt; com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl.appendChild
&gt; (DeferredDocumentImpl.java:644)
&gt;     at
&gt; com.sun.org.apache.xerces.internal.parsers.AbstractDOMParser.characters
&gt; (AbstractDOMParser.java:1191)
&gt;     at
&gt; com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.characters
&gt; (XMLDTDValidator.java:862)
&gt;     at
&gt;
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument

&gt; (XMLDocumentFragmentScannerImpl.java:463)
&gt;     at
&gt; com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse
&gt; (XML11Configuration.java:807)
&gt;     at
&gt; com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse
&gt; (XML11Configuration.java:737)
&gt;     at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse
&gt; (XMLParser.java:107)
&gt;     at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse
&gt; (DOMParser.java:225)
&gt;     at
&gt; com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse
&gt; (DocumentBuilderImpl.java:283)
&gt;     at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:180)
&gt;     at XMLParser.Parse(XMLParser.java:89)
&gt;     at Main.main(Main.java:116)
&gt;
&gt;
&gt; 89 line number points to -&gt; doc = builder.parse(xmlDataFile);
&gt;
&gt; i was able to find the workaround  if i add this code
&gt;
&gt;  aFactory.setFeature
("http://apache.org/xml/features/dom/defer-node-expansion
&gt; ", false);
&gt;
&gt; the issue is resolved. But i need to know the cause of this problem.
&gt; Was the entity the cause?
&gt;
&gt; Thanks
&gt; Sri kumar

</pre>
</div>
</content>
</entry>
<entry>
<title>External entity in XML causing null pointer exception during DocumentBuilder.parse</title>
<author><name>sri kumar &lt;sri_kumar_4u@yahoo.co.in&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200912.mbox/%3c622593.64873.qm@web8702.mail.in.yahoo.com%3e"/>
<id>urn:uuid:%3c622593-64873-qm@web8702-mail-in-yahoo-com%3e</id>
<updated>2009-12-04T12:18:28Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
I was trying to parse a XML Document using DOM Parser. 

I got null pointer exception while executing doc = builder.parse(xmlDataFile); 

There were few entities in the XML data file. On removing a particular entity, i was able
to parse the file successfully 

The entity was some thing like this 

&lt;!ENTITY SAMPLE.TIF SYSTEM "SAMPLE.TIF" NDATA TIF&gt; 

What could be the reason? 

EDIT: 

Here is the code: 

        DocumentBuilderFactory aFactory = DocumentBuilderFactory.newInstance(); 
        aFactory.setValidating(false); 
        aFactory.setFeature("http://xml.org/sax/features/namespaces", false); 
        aFactory.setFeature("http://apache.org/xml/features/validation/schema", false); 
        aFactory.setIgnoringComments(true); 
        builder = aFactory.newDocumentBuilder(); 
        doc = builder.parse(xmlDataFile); 
This is the trace: 

 at com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl.setChunkIndex(DeferredDocumentImpl.java:1944)

    at com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl.appendChild(DeferredDocumentImpl.java:644)

    at com.sun.org.apache.xerces.internal.parsers.AbstractDOMParser.characters(AbstractDOMParser.java:1191)

    at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.characters(XMLDTDValidator.java:862)

    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:463)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)

    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)

    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107) 
    at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:225) 
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283)

    at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:180) 
    at XMLParser.Parse(XMLParser.java:89) 
    at Main.main(Main.java:116) 


89 line number points to -&gt; doc = builder.parse(xmlDataFile);


i was able to find the workaround  if i add this code

 aFactory.setFeature("http://apache.org/xml/features/dom/defer-node-expansion", false);

the issue is resolved. But i need to know the cause of this problem. Was the entity the cause?

Thanks
Sri kumar


      The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. http://in.yahoo.com/

</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Special characters problem while writing XML files using JAXP DOM	Parser</title>
<author><name>Benson Margulies &lt;bimargulies@gmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200912.mbox/%3c61b5d9410912040413l4216f97em59e69610cc1fed4d@mail.gmail.com%3e"/>
<id>urn:uuid:%3c61b5d9410912040413l4216f97em59e69610cc1fed4d@mail-gmail-com%3e</id>
<updated>2009-12-04T12:13:06Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
If you need a less than, you need to put it all in a CDATA.


On Fri, Dec 4, 2009 at 12:25 AM, nagineni &lt;naganirangen_r@yahoo.com&gt; wrote:
&gt;
&gt; Hi,
&gt;
&gt; I'm creating xml file using JAXP DOM parser.While writing text data to a
&gt; node parser is writing special characters.Below is the example.
&gt;
&gt; &lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
&gt; &lt;template&gt;
&gt; Â  Â  Â  Â  Â &lt;name&gt;naga&lt;/name&gt;
&gt; Â  Â  Â  Â  Â &lt;expr&gt;for(int i=0;i&amp;lt20;i++)&lt;/expr&gt;
&gt; &lt;/template&gt;
&gt;
&gt; I want to my XML file output for(int i=0;i&lt;20;i++) inside &lt;expr&gt; element.Is
&gt; there any solution around it ?
&gt; Can any one suggest me the solution for this problem ?Thanks in advance.
&gt;
&gt; Regards,
&gt; Naga.
&gt;
&gt;
&gt; -----
&gt; Regards,
&gt; Naga.
&gt; --
&gt; View this message in context: http://old.nabble.com/Special-characters-problem-while-writing-XML-files-using-JAXP-DOM-Parser-tp26635769p26635769.html
&gt; Sent from the Xerces - J - Users mailing list archive at Nabble.com.
&gt;
&gt;
&gt; ---------------------------------------------------------------------
&gt; To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
&gt; For additional commands, e-mail: j-users-help@xerces.apache.org
&gt;
&gt;

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Special characters problem while writing XML files using JAXP DOM	Parser</title>
<author><name>Mukul Gandhi &lt;mukulg@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200912.mbox/%3c7870f82e0912032140q570e1480sbb826a8010c94364@mail.gmail.com%3e"/>
<id>urn:uuid:%3c7870f82e0912032140q570e1480sbb826a8010c94364@mail-gmail-com%3e</id>
<updated>2009-12-04T05:40:21Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
it seems, you are not writing the built in entity reference for
character, "&lt;" appropriately.
you are not writing a semicolon, after &amp;lt.

The parsing of the document you have posted, would likely fail with
this particular error.

The Xerces-J sax.Counter sample gives following error, while parsing
the XML document you have posted:

[Fatal Error] test.xml:4:35: The entity "lt20" was referenced, but not declared.

On Fri, Dec 4, 2009 at 10:55 AM, nagineni &lt;naganirangen_r@yahoo.com&gt; wrote:
&gt;
&gt; Hi,
&gt;
&gt; I'm creating xml file using JAXP DOM parser.While writing text data to a
&gt; node parser is writing special characters.Below is the example.
&gt;
&gt; &lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
&gt; &lt;template&gt;
&gt; Â  Â  Â  Â  Â &lt;name&gt;naga&lt;/name&gt;
&gt; Â  Â  Â  Â  Â &lt;expr&gt;for(int i=0;i&amp;lt20;i++)&lt;/expr&gt;
&gt; &lt;/template&gt;
&gt;
&gt; I want to my XML file output for(int i=0;i&lt;20;i++) inside &lt;expr&gt; element.Is
&gt; there any solution around it ?
&gt; Can any one suggest me the solution for this problem ?Thanks in advance.
&gt;
&gt; Regards,
&gt; Naga.


-- 
Regards,
Mukul Gandhi

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Special characters problem while writing XML files using JAXP DOM Parser</title>
<author><name>nagineni &lt;naganirangen_r@yahoo.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200912.mbox/%3c26635769.post@talk.nabble.com%3e"/>
<id>urn:uuid:%3c26635769-post@talk-nabble-com%3e</id>
<updated>2009-12-04T05:25:08Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>

Hi,

I'm creating xml file using JAXP DOM parser.While writing text data to a
node parser is writing special characters.Below is the example.

&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
&lt;template&gt;
          &lt;name&gt;naga&lt;/name&gt;
          &lt;expr&gt;for(int i=0;i&amp;lt20;i++)&lt;/expr&gt;
&lt;/template&gt;

I want to my XML file output for(int i=0;i&lt;20;i++) inside &lt;expr&gt; element.Is
there any solution around it ?
Can any one suggest me the solution for this problem ?Thanks in advance.

Regards,
Naga.


-----
Regards,
Naga.
-- 
View this message in context: http://old.nabble.com/Special-characters-problem-while-writing-XML-files-using-JAXP-DOM-Parser-tp26635769p26635769.html
Sent from the Xerces - J - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>=?UTF-8?B?UmU6IE51bGwgcG9pbnRlciBleGNlcHRpb24gZHVyaW5n?= =?UTF-8?B?IERvY3VtZW50QnVpbGRlci5wYXJzZSg=?= =?ISO-8859-1?Q?=3F?= =?UTF-8?B?ZmlsZQ==?= =?ISO-8859-1?Q?=3F?= =?UTF-8?B?KTs=?=</title>
<author><name>Michael Glavassevich &lt;mrglavas@ca.ibm.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200912.mbox/%3cOFE14853F9.A9D91059-ON85257681.003B1EA4-85257681.003BB6F1@ca.ibm.com%3e"/>
<id>urn:uuid:%3cOFE14853F9-A9D91059-ON85257681-003B1EA4-85257681-003BB6F1@ca-ibm-com%3e</id>
<updated>2009-12-03T10:52:14Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: quoted-printable


This is a bug [1] that was fixed in Xerces-J back in 2007.

However, you are using Sun's implementation, not Apache Xerces-J. We ca=
nnot
do anything about the problem you're having with this implementation as=
 we
have no influence over its codebase. You need to pursue this with the J=
DK
vendor if you want a fix there.

Thanks.,

[1] https://issues.apache.org/jira/browse/XERCESJ-977

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

sri kumar &lt;sri_kumar_4u@yahoo.co.in&gt; wrote on 12/03/2009 04:50:50 AM:

&gt; Hello All,
&gt;
&gt; I got null pointer exception while executing doc =3D builder.parse
(xmlDataFile);
&gt;
&gt; There were few entities in the XML data file. On removing a
&gt; particular entity, i was able to parse the file successfully
&gt;
&gt; The entity was some thing like this
&gt;
&gt; &lt;!ENTITY SAMPLE.TIF SYSTEM "SAMPLE.TIF" NDATA TIF&gt;
&gt;
&gt; What could be the reason?
&gt;
&gt; Here is the code:
&gt;
&gt; DocumentBuilderFactory aFactory =3D DocumentBuilderFactory.newInstanc=
e();
&gt; aFactory.setValidating(false);
&gt; aFactory.setFeature("http://xml.org/sax/features/namespaces", false);=

&gt; aFactory.setFeature("http://apache.org/xml/features/validation/schema=

&gt; ", false);
&gt; aFactory.setIgnoringComments(true);
&gt; builder =3D aFactory.newDocumentBuilder();
&gt; doc =3D builder.parse(xmlDataFile);
&gt;
&gt;
&gt;
&gt; This is the trace:
&gt;
&gt; at
&gt; com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl.setChunkI=
ndex
&gt; (DeferredDocumentImpl.java:1944)
&gt; at
&gt; com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl.appendChi=
ld
&gt; (DeferredDocumentImpl.java:644)
&gt; at
&gt; com.sun.org.apache.xerces.internal.parsers.AbstractDOMParser.characte=
rs
&gt; (AbstractDOMParser.java:1191)
&gt; at
&gt; com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.character=
s
&gt; (XMLDTDValidator.java:862)
&gt; at
&gt;
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.=
scanDocument

&gt; (XMLDocumentFragmentScannerImpl.java:463)
&gt; at
&gt; com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse
&gt; (XML11Configuration.java:807)
&gt; at
&gt; com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse
&gt; (XML11Configuration.java:737)
&gt; at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse
&gt; (XMLParser.java:107)
&gt; at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse
&gt; (DOMParser.java:225)
&gt; at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse
&gt; (DocumentBuilderImpl.java:283)
&gt; at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:180)
&gt; at XMLParser.Parse(XMLParser.java:89)
&gt; at Main.main(Main.java:116)
&gt;
&gt;
&gt;
&gt; 89 line number points to -&gt; doc =3D builder.parse(xmlDataFile);=


</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Loosing significant space in LSSerializer</title>
<author><name>Chris Simmons &lt;cps@corefiling.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200911.mbox/%3c4B0E4FCC.3040702@corefiling.com%3e"/>
<id>urn:uuid:%3c4B0E4FCC-3040702@corefiling-com%3e</id>
<updated>2009-11-26T09:52:12Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Stanimir Stamenkov wrote:
&gt; Mon, 23 Nov 2009 11:20:23 +0000, /Chris Simmons/:
&gt;
&gt;&gt; I raised a bug (which included a patch) over two
&gt;&gt; years ago due to different behaviour between the Xerces/Xalan
&gt;&gt; LSSerializer but it has seemingly been ignored.
&gt;&gt;
&gt;&gt; https://issues.apache.org/jira/browse/XALANJ-2409
&gt;&gt;
&gt;&gt; I wonder if LSSerializer bugs are falling between the cracks?
&gt;
&gt; Have you tried whether registering an LSSerializerFilter and filtering 
&gt; out xmlns:xml attributes works around the problem?
&gt;
We just built a patched version of the serializer jar as it seemed the 
most robust fix.  I can't recall whether we tried a filter.  I suppose 
it should work as long as the filter is after the namespace fix-up in 
the serializer's pipeline.

Chris.

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Loosing significant space in LSSerializer</title>
<author><name>Stanimir Stamenkov &lt;s7an10@netscape.net&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200911.mbox/%3c4B0DA1C6.9070608@netscape.net%3e"/>
<id>urn:uuid:%3c4B0DA1C6-9070608@netscape-net%3e</id>
<updated>2009-11-25T21:29:42Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Mon, 23 Nov 2009 11:20:23 +0000, /Chris Simmons/:

&gt; I raised a bug (which included a patch) over two
&gt; years ago due to different behaviour between the Xerces/Xalan
&gt; LSSerializer but it has seemingly been ignored.
&gt;
&gt; https://issues.apache.org/jira/browse/XALANJ-2409
&gt;
&gt; I wonder if LSSerializer bugs are falling between the cracks?

Have you tried whether registering an LSSerializerFilter and 
filtering out xmlns:xml attributes works around the problem?

-- 
Stanimir

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: xs:any namespace resolution</title>
<author><name>Michael Glavassevich &lt;mrglavas@ca.ibm.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200911.mbox/%3cOF456BA30A.405504DE-ON85257679.002132CE-85257679.00227B40@ca.ibm.com%3e"/>
<id>urn:uuid:%3cOF456BA30A-405504DE-ON85257679-002132CE-85257679-00227B40@ca-ibm-com%3e</id>
<updated>2009-11-25T06:16:37Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: quoted-printable


Hi Ajay,

The Validator knows what kind of Schema it was created with. It will on=
ly
call the LSResourceResolver if the Schema was created with
SchemaFactory.newSchema() (the one with no parameters). Whatever it loa=
ds
dynamically does get cached [1] (though might get flushed out at some p=
oint
in the future due to demand for memory).

Thanks.

[1]
http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/ja=
xp/validation/SoftReferenceGrammarPool.java?revision=3D699892&amp;view=3Dma=
rkup.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

ajay bhadauria &lt;abhadauria@yahoo.com&gt; wrote on 11/24/2009 05:30:58 PM:

&gt; Michael,
&gt;
&gt; Thanks a lot, it works. I have a question for you.
&gt;
&gt; Is Validator smart enough to figure out when LSResourceResolver is
&gt; giving compiled schema or uncompiled schema just to avoid compiling
&gt; of schema at runtime ?
&gt;
&gt; Thanks
&gt; Ajay=


</pre>
</div>
</content>
</entry>
<entry>
<title>Re: xs:any namespace resolution</title>
<author><name>ajay bhadauria &lt;abhadauria@yahoo.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200911.mbox/%3c871272.55674.qm@web111510.mail.gq1.yahoo.com%3e"/>
<id>urn:uuid:%3c871272-55674-qm@web111510-mail-gq1-yahoo-com%3e</id>
<updated>2009-11-24T22:30:58Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Michael,

Thanks a lot, it works. I have a question for you.

Is Validator smart enough to figure out when LSResourceResolver is giving compiled schema
or uncompiled schema just to avoid compiling of schema at runtime ?

Thanks
Ajay   

--- On Fri, 11/20/09, Michael Glavassevich &lt;mrglavas@ca.ibm.com&gt; wrote:

&gt; From: Michael Glavassevich &lt;mrglavas@ca.ibm.com&gt;
&gt; Subject: Re: xs:any namespace resolution
&gt; To: j-users@xerces.apache.org
&gt; Date: Friday, November 20, 2009, 3:14 AM
&gt; 
&gt; Ajay,
&gt; 
&gt; 
&gt; 
&gt; If you want schemas to be dynamically loaded by the
&gt; validator you need to use the SchemaFactory.newSchema()
&gt; method [1] (the one with no parameters). JAXP doesn't
&gt; let you mix that with pre-loading of schemas. See [2][3] in
&gt; the mailing list archives for more details.
&gt; 
&gt; 
&gt; 
&gt; Thanks.
&gt; 
&gt; 
&gt; 
&gt; [1] http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/validation/SchemaFactory.html#newSchema()
&gt; 
&gt; [2] http://markmail.org/message/5xe4u5njgxkiosk7
&gt; 
&gt; [3] http://markmail.org/message/4nhwp7ggi6fytqfg
&gt; 
&gt; 
&gt; 
&gt; Michael Glavassevich
&gt; 
&gt; XML Parser Development
&gt; 
&gt; IBM Toronto Lab
&gt; 
&gt; E-mail: mrglavas@ca.ibm.com
&gt; 
&gt; E-mail: mrglavas@apache.org
&gt; 
&gt; 
&gt; 
&gt; ajay bhadauria &lt;abhadauria@yahoo.com&gt; wrote on
&gt; 11/19/2009 12:25:17 PM:
&gt; 
&gt; 
&gt; 
&gt; &gt; Michael,
&gt; 
&gt; &gt; 
&gt; 
&gt; &gt; Sorry. I was over excited. I was doing the same way as
&gt; you suggested
&gt; 
&gt; &gt; but my LSResourceResolver is not getting called which
&gt; means that I 
&gt; 
&gt; &gt; am missing something which I am not aware of it. 
&gt; 
&gt; &gt; 
&gt; 
&gt; &gt; The Test2.xml which I attached in the previous mail,
&gt; the tag 
&gt; 
&gt; &gt; "ns1:Document" contains namespace
&gt; xmlns:ns1="urn:swift:xsd:$xtsn.
&gt; 
&gt; &gt; 998.001.01" which is on the 2.xsd.
&gt; 
&gt; &gt; 
&gt; 
&gt; &gt; Please find the attached Code where I set
&gt; LSresourceResolver to Validator.
&gt; 
&gt; &gt; 
&gt; 
&gt; &gt; Thanks
&gt; 
&gt; &gt; Ajay 
&gt; 
&gt; &gt; --- On Thu, 11/19/09, Michael Glavassevich
&gt; &lt;mrglavas@ca.ibm.com&gt; wrote:
&gt; 
&gt; &gt; 
&gt; 
&gt; &gt; &gt; From: Michael Glavassevich
&gt; &lt;mrglavas@ca.ibm.com&gt;
&gt; 
&gt; &gt; &gt; Subject: Re: xs:any namespace resolution
&gt; 
&gt; &gt; &gt; To: j-users@xerces.apache.org
&gt; 
&gt; &gt; &gt; Date: Thursday, November 19, 2009, 8:32 PM
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; (Ajay, patience. In the future, please don't
&gt; 
&gt; &gt; &gt; post the same message over and over again to the
&gt; list. We
&gt; 
&gt; &gt; &gt; heard you the first time.)
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; Try writing an LSResourceResolver (which you
&gt; would
&gt; 
&gt; &gt; &gt; register with the validator) and have that return
&gt; the 2nd
&gt; 
&gt; &gt; &gt; schema document on the request with its target
&gt; 
&gt; &gt; &gt; namespace.
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; Thanks.
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; Michael Glavassevich
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; XML Parser Development
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; IBM Toronto Lab
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; E-mail: mrglavas@ca.ibm.com
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; E-mail: mrglavas@apache.org
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; ajay bhadauria &lt;abhadauria@yahoo.com&gt; wrote
&gt; on
&gt; 
&gt; &gt; &gt; 11/19/2009 09:15:03 AM:
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; Hi,
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; I do knot know much about xs:any construct
&gt; and I
&gt; 
&gt; &gt; &gt;  am new to this and
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; I read it but I do not know how I can tell
&gt; the
&gt; 
&gt; &gt; &gt; validator to use 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; namespace (only runtime) which is defined in
&gt; the
&gt; 
&gt; &gt; &gt; different schema.
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt;  
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; Using  
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &lt;xs:any
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt;  namespace="##any"
&gt; 
&gt; &gt; &gt; processContents="strict"/&gt;
&gt; construct, 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; I am vlidating xml instance with Validator
&gt; which has a
&gt; 
&gt; &gt; &gt; main schema 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; but validator does not know second schema.
&gt;  
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; Now,  how I can tell the validator during
&gt; 
&gt; &gt; &gt; validation time about the 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; second schema to which some elements belong
&gt; to the
&gt; 
&gt; &gt; &gt; namespace which 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; is defined in the second schema.   
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; Thanks
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; ajay
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; --- On Thu, 11/19/09, ajay bhadauria
&gt; 
&gt; &gt; &gt; &lt;abhadauria@yahoo.com&gt; wrote:
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; From: ajay bhadauria
&gt; 
&gt; &gt; &gt; &lt;abhadauria@yahoo.com&gt;
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; Subject: Re: xs:any namespace
&gt; resolution
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; To: j-users@xerces.apache.org
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; Date: Thursday, November 19, 2009, 6:38
&gt; AM
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; Hi,
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; I am using &lt;xs:any
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt; namespace="##any"
&gt; 
&gt; &gt; &gt; processContents="strict"/&gt; and I
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; am validating xml instance which is
&gt; having
&gt; 
&gt; &gt; &gt; elements which
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; belong to the different namespace and
&gt; 
&gt; &gt; &gt; corresponding to this
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; namespace, schema is not pre-loaded. I
&gt; mean yhat
&gt; 
&gt; &gt; &gt; external
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; schema is not pre-loaded.
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; How do I tell Java Validator about this
&gt; external
&gt; 
&gt; &gt; &gt; schema so
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; that xml instance is validated
&gt; successfully ?
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; Is there any way I can tell the
&gt; validator at the
&gt; 
&gt; &gt; &gt; time of
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; validation only about external schema
&gt; which is
&gt; 
&gt; &gt; &gt; not
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; pre-loaded with main schema?
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; Help me in understanding whether it can
&gt; be done
&gt; 
&gt; &gt; &gt; ???
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; Thanks
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; Ajay 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; --- On Thu, 11/19/09, ajay bhadauria
&gt; 
&gt; &gt; &gt; &lt;abhadauria@yahoo.com&gt;
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; wrote:
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt; From: ajay bhadauria
&gt; 
&gt; &gt; &gt; &lt;abhadauria@yahoo.com&gt;
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt; Subject: xs:any namespace
&gt; resolution
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt; To: j-users@xerces.apache.org
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt; Date: Thursday, November 19, 2009,
&gt; 12:48 AM
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt; Hi,
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt; I have schema file 1.xsd which has
&gt; xs:any
&gt; 
&gt; &gt; &gt; schema
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; construct
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt;  
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt; &lt;xs:complexType
&gt; 
&gt; &gt; &gt; name="ExtensionEnvelope"&gt;
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt;     
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt;    &lt;xs:sequence&gt;
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt;         
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt;    &lt;xs:any
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt; namespace="##any"
&gt; 
&gt; &gt; &gt; processContents="strict"/&gt;
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt;     
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt;    &lt;/xs:sequence&gt;
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt;     &lt;/xs:complexType&gt;
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt; And I try to validate xml instance
&gt; (
&gt; 
&gt; &gt; &gt; test2.xml )
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; against
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt; this schema, it gave the following
&gt; error
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt;      cvc-complex-type.2.4.c:
&gt; The
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt; matching wildcard is strict, but
&gt; no
&gt; 
&gt; &gt; &gt; declaration can be
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; found
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt; for element
&gt; 'ns1:Document'.
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt; However, the namespace which the
&gt; Validator
&gt; 
&gt; &gt; &gt; is looking
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; for
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt; is in other xsd file (2.xsd). 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt; How do I tell Validator the
&gt; location of
&gt; 
&gt; &gt; &gt; 2.xsd file
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; during
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt; validation ? 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt; The test.xml has some elements
&gt; which belong
&gt; 
&gt; &gt; &gt; to the
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt; namespace
&gt; urn:swift:xsd:$xtsn.998.001.01
&gt; 
&gt; &gt; &gt; which is
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; defined in
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt; the 2.xsd file.
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt;       
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt;
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt;
&gt; 
&gt; &gt; &gt;
&gt; ---------------------------------------------------------------------
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt; To unsubscribe, e-mail:
&gt; 
&gt; &gt; &gt; j-users-unsubscribe@xerces.apache.org
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; &gt; For additional commands, e-mail:
&gt; 
&gt; &gt; &gt; j-users-help@xerces.apache.org
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt;       
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt;
&gt; 
&gt; &gt; &gt;
&gt; ---------------------------------------------------------------------
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; To unsubscribe, e-mail:
&gt; 
&gt; &gt; &gt; j-users-unsubscribe@xerces.apache.org
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; &gt; For additional commands, e-mail:
&gt; 
&gt; &gt; &gt; j-users-help@xerces.apache.org
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt;       
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt;
&gt; 
&gt; &gt; &gt;
&gt; ---------------------------------------------------------------------
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; To unsubscribe, e-mail:
&gt; 
&gt; &gt; &gt; j-users-unsubscribe@xerces.apache.org
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; For additional commands, e-mail:
&gt; 
&gt; &gt; &gt; j-users-help@xerces.apache.org
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt;
&gt; 
&gt; &gt; 
&gt; 
&gt; &gt; 
&gt; 
&gt; &gt;       [attachment
&gt; "SchemaReader.java" deleted by Michael 
&gt; 
&gt; &gt; Glavassevich/Toronto/IBM] 
&gt; 
&gt; &gt;
&gt; ---------------------------------------------------------------------
&gt; 
&gt; &gt; To unsubscribe, e-mail:
&gt; j-users-unsubscribe@xerces.apache.org
&gt; 
&gt; &gt; For additional commands, e-mail:
&gt; j-users-help@xerces.apache.org


      

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: doctype?</title>
<author><name>Michael Glavassevich &lt;mrglavas@ca.ibm.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200911.mbox/%3cOF6B846778.1BCFFD3E-ON85257678.00640090-85257678.0064AB53@ca.ibm.com%3e"/>
<id>urn:uuid:%3cOF6B846778-1BCFFD3E-ON85257678-00640090-85257678-0064AB53@ca-ibm-com%3e</id>
<updated>2009-11-24T18:19:34Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: quoted-printable


Michael Ludwig &lt;milu71@gmx.de&gt; wrote on 11/24/2009 12:20:15 PM:

&gt; Michael Glavassevich schrieb am 24.11.2009 um 12:02:29 (-0500):
&gt; &gt;
&gt; &gt; A DOCTYPE can be specified programmatically [1][2][3], so you don't=

&gt; &gt; need to write a stylesheet.
&gt;
&gt; True, thanks. But I assumed the OP had already written one, as he wro=
te:
&gt;
&gt; &gt; &gt; &gt; &gt; I use the usual TraX call. No doctype lands in the output. I'=
m
&gt; &gt; &gt; &gt; &gt; very carefully using Xerces for the DOM and Xalan for TraX.
&gt;
&gt; I might be wrong, but the first of the three references you gave is
&gt; probably not related to specifying the DOCTYPE.

Good catch. I meant to post a link to setOutputProperty():

http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/transform/Tra=
nsformer.html#setOutputProperty
(java.lang.String,%20java.lang.String)

&gt; &gt; [1] http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/
&gt; transform/Transformer.html#setParameter
(java.lang.String,%20java.lang.Object)
&gt;
&gt; Best,
&gt;
&gt; --
&gt; Michael Ludwig
&gt;
&gt; ---------------------------------------------------------------------=

&gt; To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
&gt; For additional commands, e-mail: j-users-help@xerces.apache.org

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org=


</pre>
</div>
</content>
</entry>
<entry>
<title>Re: doctype?</title>
<author><name>Michael Ludwig &lt;milu71@gmx.de&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200911.mbox/%3c20091124172015.GB2912@wladimir%3e"/>
<id>urn:uuid:%3c20091124172015-GB2912@wladimir%3e</id>
<updated>2009-11-24T17:20:15Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Michael Glavassevich schrieb am 24.11.2009 um 12:02:29 (-0500):
&gt; 
&gt; A DOCTYPE can be specified programmatically [1][2][3], so you don't
&gt; need to write a stylesheet.

True, thanks. But I assumed the OP had already written one, as he wrote:

&gt; &gt; &gt; &gt; I use the usual TraX call. No doctype lands in the output. I'm
&gt; &gt; &gt; &gt; very carefully using Xerces for the DOM and Xalan for TraX.

I might be wrong, but the first of the three references you gave is
probably not related to specifying the DOCTYPE.

&gt; [1] http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/transform/Transformer.html#setParameter(java.lang.String,%20java.lang.Object)

Best,

-- 
Michael Ludwig

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: doctype?</title>
<author><name>Michael Glavassevich &lt;mrglavas@ca.ibm.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200911.mbox/%3cOF62A4CFFE.B96B95ED-ON85257678.005D1628-85257678.005D9CD0@ca.ibm.com%3e"/>
<id>urn:uuid:%3cOF62A4CFFE-B96B95ED-ON85257678-005D1628-85257678-005D9CD0@ca-ibm-com%3e</id>
<updated>2009-11-24T17:02:29Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: quoted-printable


A DOCTYPE can be specified programmatically [1][2][3], so you don't nee=
d to
write a stylesheet. Note that either approach only works if the
DocumentType node has no internal subset. If it has one it will still b=
e
lost if you do this.

Thanks.

[1]
http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/transform/Tra=
nsformer.html#setParameter
(java.lang.String,%20java.lang.Object)
[2]
http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/transform/Out=
putKeys.html#DOCTYPE_PUBLIC
[3]
http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/transform/Out=
putKeys.html#DOCTYPE_SYSTEM

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Michael Ludwig &lt;milu71@gmx.de&gt; wrote on 11/24/2009 08:22:31 AM:

&gt; Michael Glavassevich schrieb am 30.10.2009 um 12:45:44 (-0400):
&gt;
&gt; &gt; Benson Margulies &lt;bimargulies@gmail.com&gt; wrote on 10/30/2009 10:59:=
27
&gt; &gt; AM:
&gt; &gt;
&gt; &gt; &gt; I'm not sure if I should be consulting Xerces, Xalan, or a beer.
&gt; &gt; &gt;
&gt; &gt; &gt; I've got a DOM tree with a doctype on it.
&gt; &gt; &gt;
&gt; &gt; &gt; I want to serialize it.
&gt; &gt; &gt;
&gt; &gt; &gt; I use the usual TraX call. No doctype lands in the output. I'm ve=
ry
&gt; &gt; &gt; carefully using Xerces for the DOM and Xalan for TraX.
&gt;
&gt; You can set a DOCTYPE from XSLT using xsl:output/@doctype-system and
&gt; xsl:output/@doctype-public:
&gt;
&gt; &lt;xsl:stylesheet version=3D"1.0"
&gt;   xmlns:xsl=3D"http://www.w3.org/1999/XSL/Transform"&gt;
&gt;
&gt;   &lt;xsl:output doctype-public=3D"eins zwei drei"
&gt;     doctype-system=3D"http://eins.de/zwei/drei"/&gt;
&gt;
&gt;   &lt;xsl:template match=3D"@*|node()"&gt;
&gt;     &lt;xsl:copy&gt;
&gt;       &lt;xsl:apply-templates select=3D"@*|node()"/&gt;
&gt;     &lt;/xsl:copy&gt;
&gt;   &lt;/xsl:template&gt;
&gt; &lt;/xsl:stylesheet&gt;
&gt;
&gt; --
&gt; Michael Ludwig
&gt;
&gt; ---------------------------------------------------------------------=

&gt; To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
&gt; For additional commands, e-mail: j-users-help@xerces.apache.org=


</pre>
</div>
</content>
</entry>
<entry>
<title>Re: doctype?</title>
<author><name>Michael Ludwig &lt;milu71@gmx.de&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200911.mbox/%3c20091124132231.GA2912@wladimir%3e"/>
<id>urn:uuid:%3c20091124132231-GA2912@wladimir%3e</id>
<updated>2009-11-24T13:22:31Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Michael Glavassevich schrieb am 30.10.2009 um 12:45:44 (-0400):

&gt; Benson Margulies &lt;bimargulies@gmail.com&gt; wrote on 10/30/2009 10:59:27
&gt; AM:
&gt; 
&gt; &gt; I'm not sure if I should be consulting Xerces, Xalan, or a beer.
&gt; &gt;
&gt; &gt; I've got a DOM tree with a doctype on it.
&gt; &gt;
&gt; &gt; I want to serialize it.
&gt; &gt;
&gt; &gt; I use the usual TraX call. No doctype lands in the output. I'm very
&gt; &gt; carefully using Xerces for the DOM and Xalan for TraX.

You can set a DOCTYPE from XSLT using xsl:output/@doctype-system and
xsl:output/@doctype-public:

&lt;xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;

  &lt;xsl:output doctype-public="eins zwei drei"
    doctype-system="http://eins.de/zwei/drei"/&gt;

  &lt;xsl:template match="@*|node()"&gt;
    &lt;xsl:copy&gt;
      &lt;xsl:apply-templates select="@*|node()"/&gt;
    &lt;/xsl:copy&gt;
  &lt;/xsl:template&gt;
&lt;/xsl:stylesheet&gt;

-- 
Michael Ludwig

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Loosing significant space in LSSerializer</title>
<author><name>Michael Glavassevich &lt;mrglavas@ca.ibm.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200911.mbox/%3cOF4009AE26.AE5407F0-ON85257677.004F7E8A-85257677.0054676A@ca.ibm.com%3e"/>
<id>urn:uuid:%3cOF4009AE26-AE5407F0-ON85257677-004F7E8A-85257677-0054676A@ca-ibm-com%3e</id>
<updated>2009-11-23T15:21:54Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: quoted-printable


Chris Simmons &lt;cps@corefiling.com&gt; wrote on 11/23/2009 06:20:23 AM:

&gt; &gt; It is in Xalan. Their serializer started as a copy of the Xerces on=
e
&gt; &gt; (even has similar package names: org.apache.xml.serialize vs.
&gt; &gt; org.apache.xml.serializer). We didn't want to duplicate the effort
&gt; &gt; anymore and decided to combine forces and the Xalan one was chosen =
as
&gt; &gt; the common codebase because it was better maintained and was making=

&gt; &gt; significant improvements to performance. Its LSSerializer
&gt; &gt; implementation was written by a Xerces committer and I have made
&gt; &gt; improvements and fixes to it too where I've found issues, so it's
&gt; &gt; being jointly maintained, though in a different project. This is th=
e
&gt; &gt; alternative. It *is* an LSSerializer and there is no reason that it=

&gt; &gt; can't be updated / fixed to have similar behaviour, but that's only=

&gt; &gt; likely to happen if users report the problems they're having (patch=
es
&gt; &gt; are welcome), preferably in JIRA.
&gt; &gt;
&gt; If only that were true.  I raised a bug (which included a patch) over=

&gt; two years ago due to different behaviour between the Xerces/Xalan
&gt; LSSerializer but it has seemingly been ignored.
&gt;
&gt; https://issues.apache.org/jira/browse/XALANJ-2409
&gt;
&gt; I wonder if LSSerializer bugs are falling between the cracks?

Xalan has been relatively dormant the last couple years (developers bus=
y at
their day jobs and elsewhere), so yes it's been awhile since things hav=
e
moved but there's recently been interest in revitalizing the project an=
d
potentially two new committers who seem eager to get things rolling aga=
in.
b
&gt; Chris Simmons.
&gt;
&gt; ---------------------------------------------------------------------=

&gt; To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
&gt; For additional commands, e-mail: j-users-help@xerces.apache.org

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org=


</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Loosing significant space in LSSerializer</title>
<author><name>Chris Simmons &lt;cps@corefiling.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200911.mbox/%3c4B0A6FF7.2060202@corefiling.com%3e"/>
<id>urn:uuid:%3c4B0A6FF7-2060202@corefiling-com%3e</id>
<updated>2009-11-23T11:20:23Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>

&gt; It is in Xalan. Their serializer started as a copy of the Xerces one 
&gt; (even has similar package names: org.apache.xml.serialize vs. 
&gt; org.apache.xml.serializer). We didn't want to duplicate the effort 
&gt; anymore and decided to combine forces and the Xalan one was chosen as 
&gt; the common codebase because it was better maintained and was making 
&gt; significant improvements to performance. Its LSSerializer 
&gt; implementation was written by a Xerces committer and I have made 
&gt; improvements and fixes to it too where I've found issues, so it's 
&gt; being jointly maintained, though in a different project. This is the 
&gt; alternative. It *is* an LSSerializer and there is no reason that it 
&gt; can't be updated / fixed to have similar behaviour, but that's only 
&gt; likely to happen if users report the problems they're having (patches 
&gt; are welcome), preferably in JIRA.
&gt;
If only that were true.  I raised a bug (which included a patch) over 
two years ago due to different behaviour between the Xerces/Xalan 
LSSerializer but it has seemingly been ignored.

https://issues.apache.org/jira/browse/XALANJ-2409

I wonder if LSSerializer bugs are falling between the cracks?

Chris Simmons.

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Loosing significant space in LSSerializer</title>
<author><name>Michael Glavassevich &lt;mrglavas@ca.ibm.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200911.mbox/%3cOFF462A0C4.0B9E2D72-ON85257676.007A4B44-85257676.007BD264@ca.ibm.com%3e"/>
<id>urn:uuid:%3cOFF462A0C4-0B9E2D72-ON85257676-007A4B44-85257676-007BD264@ca-ibm-com%3e</id>
<updated>2009-11-22T22:32:27Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Content-type: text/plain; charset=US-ASCII

Right, that's exactly how it works:

    public LSSerializer createLSSerializer() {
        try {
            Class serializerClass = ObjectFactory.findProviderClass(
                "org.apache.xml.serializer.dom3.LSSerializerImpl",
                ObjectFactory.findClassLoader(), true);
            return (LSSerializer) serializerClass.newInstance();
        }
        catch (Exception e) {}
        // Fall back to Xerces' deprecated serializer if
        // the Xalan based serializer is unavailable.
        return new DOMSerializerImpl();
    }

Was hoping to put a warning in there if it takes the fallback path but
there's no DOMErrorHandler to report it to at this point.

FYI: If you don't have Xerces on the classpath but instead try to access
the JDK version [1] you may not get very far.

Thanks.

[1] http://markmail.org/message/e6rlhwymr43p4u4v

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Dick Deneer &lt;dick.deneer@donkeydevelopment.com&gt; wrote on 11/22/2009
04:06:06 PM:

&gt; Hi Benson,
&gt;
&gt; As Michael notes, Xerces is now shipped with the serializer.jar
&gt; (which contains the xalan serializer). If you have this on your
&gt; classpath it will be used.
&gt; If you leave it out, then xerces will fall back to it's own (deprecated)
one.
&gt;
&gt; regards
&gt; Dick Deneer
&gt; Op 22-nov-2009, om 21:54 heeft Benson Margulies het volgende geschreven:
&gt;
&gt; Hi Michael,
&gt;
&gt; So, if I put Xerces and not Xalan into classpath, and ask a document
&gt; for it's implementation, and ask that for the DOMImplementationLS,
&gt; what do I get? Whatever Sun tossed into the pot? And if I then add
&gt; Xalan, do I get the right one?
&gt;
&gt; --benson
&gt;

&gt; On Sat, Nov 21, 2009 at 10:24 PM, Michael Glavassevich
&lt;mrglavas@ca.ibm.com
&gt; &gt; wrote:
&gt; Hi Benson,
&gt;
&gt; We're talking about two different implementations of the DOM Level 3
&gt; LSSerializer, the more recently developed one in Xalan
&gt; (serializer.jar which Xerces now ships and shares with Xalan) and
&gt; the much older deprecated one in Xerces. If you're curious about the
&gt; history on that, there's an FAQ [1] on the website.
&gt;
&gt; Some users have decided to keep using Xerces' deprecated serializer
&gt; due to some quirks and issues with the currently available one from
&gt; Xalan. Folks really should be opening JIRA issues [2] against Xalan,
&gt; so those problems get addressed there. There's no intention to do
&gt; any further development or fixes to the one in Xerces.
&gt;
&gt; Thanks.
&gt;
&gt; [1] http://xerces.apache.org/xerces2-j/faq-general.html#faq-6
&gt; [2] https://issues.apache.org/jira/browse/XALANJ
&gt;
&gt;
&gt; Michael Glavassevich
&gt; XML Parser Development
&gt; IBM Toronto Lab
&gt; E-mail: mrglavas@ca.ibm.com
&gt; E-mail: mrglavas@apache.org

&gt; Benson Margulies &lt;bimargulies@gmail.com&gt; wrote on 11/21/2009 02:17:49 PM:
&gt;
&gt;
&gt; &gt; Could I please ask for a bit of clarification? The only LSSerializer
&gt; &gt; I'm aware of is the DOM level 3 stuff, which, I thought, was the
&gt; &gt; opposite of obsolete. As someone pointed out here, unlike TraX, it
&gt; &gt; will serialize doctypes and do other handy things. In general, I'm
&gt; &gt; beginning to prefer the DOMImplementationLS to JAXP and TraX.
&gt;
&gt; &gt; On Sat, Nov 21, 2009 at 2:07 PM, Michael Glavassevich
&lt;mrglavas@ca.ibm.com
&gt; &gt; &gt; wrote:
&gt; &gt; You should also be able to control whether spaces are preserved by
&gt; &gt; registering an LSSerializerFilter.
&gt; &gt;
&gt; &gt; When I added one to your test program:
&gt; &gt;
&gt; &gt;         if (useXerces)
&gt; &gt;         {
&gt; &gt;             domWriter = new DOMSerializerImpl();
&gt; &gt;             domWriter.setFilter(new LSSerializerFilter() {
&gt; &gt;                 public int getWhatToShow() {
&gt; &gt;                     return LSSerializerFilter.SHOW_ALL;
&gt; &gt;                 }
&gt; &gt;                 public short acceptNode(Node n) {
&gt; &gt;                     return LSSerializerFilter.FILTER_ACCEPT;
&gt; &gt;                 }});
&gt; &gt;         }
&gt; &gt;
&gt; &gt; the output I get is:
&gt; &gt;
&gt; &gt;
&gt; &gt; Program started
&gt; &gt; Xerces serializer will be used
&gt; &gt; &lt;?xml version="1.0" encoding="UTF-16"?&gt;
&gt; &gt; &lt;root&gt;
&gt; &gt; &lt;child1&gt;text&lt;/child1&gt;
&gt; &gt; &lt;child2&gt; &lt;/child2&gt;
&gt; &gt;
&gt; &gt; &lt;/root&gt;
&gt; &gt;
&gt; &gt; Xalan serializer will be used
&gt; &gt; &lt;?xml version="1.0" encoding="UTF-16"?&gt;&lt;root&gt;
&gt; &gt; &lt;child1&gt;text&lt;/child1&gt;
&gt; &gt; &lt;child2&gt; &lt;/child2&gt;
&gt; &gt; &lt;/root&gt;
&gt;
&gt; &gt; which I believe is what you were expecting.
&gt; &gt;
&gt; &gt; Thanks.
&gt; &gt;
&gt; &gt; Michael Glavassevich
&gt; &gt; XML Parser Development
&gt; &gt; IBM Toronto Lab
&gt; &gt; E-mail: mrglavas@ca.ibm.com
&gt; &gt; E-mail: mrglavas@apache.org
&gt; &gt;
&gt; &gt; Dick Deneer &lt;dick.deneer@donkeydevelopment.com&gt; wrote on 11/21/2009
&gt; &gt; 01:19:27 PM:
&gt; &gt;
&gt; &gt;
&gt; &gt; &gt; Hi Jake,
&gt; &gt; &gt;
&gt; &gt; &gt;
&gt; &gt; &gt; I just tried your suggestion and the spaces are indeed preserved.
&gt; &gt; &gt; But still, I woud prefer another solution. I do not have any clue
&gt; &gt; &gt; about the xml (I use xerces in a xml editor) and I do not want to
&gt; &gt; &gt; change the xml.
&gt; &gt; &gt; And also I would like to stay with the LSSerializer (it also
&gt; &gt; &gt; serilalizes doctype nodes).
&gt; &gt; &gt; If there is another way please let me know.
&gt; &gt; &gt;
&gt; &gt; &gt; Thanks
&gt; &gt; &gt; Dick Deneer
&gt; &gt; &gt;
&gt; &gt; &gt;
&gt; &gt; &gt;
&gt; &gt; &gt; Op 21-nov-2009, om 19:03 heeft Jacob Kjome het volgende geschreven:
&gt; &gt; &gt;
&gt; &gt; &gt; &gt; Have you tried xml:space="preserve"?
&gt; &gt; &gt; &gt;
&gt; &gt; &gt; &gt; Jake
&gt; &gt; &gt; &gt;
&gt; &gt; &gt; &gt; On 11/20/2009 4:36 PM, Dick Deneer wrote:
&gt; &gt; &gt; &gt;&gt; I am still using the deprecated LSSerializer because the xalan
&gt; &gt; &gt; &gt;&gt; serializer has issues with the pretty print.
&gt; &gt; &gt; &gt;&gt; But when I have simple elements with only space, the serializer
&gt; &gt; &gt; &gt;&gt; produces
&gt; &gt; &gt; &gt;&gt; empty elements. Is there a tweak to keep the spaces in this
elements?
&gt; &gt; &gt; &gt;&gt;
&gt; &gt; &gt; &gt;&gt; Sample xml:
&gt; &gt; &gt; &gt;&gt; &lt;root&gt;&lt;child1&gt;text&lt;/child1&gt;&lt;child2&gt; &lt;/child2&gt;&lt;/root&gt;
&gt; &gt; &gt; &gt;&gt; I attached a simple test program, that you can just run to see the

&gt; &gt; &gt; &gt;&gt; results:
&gt; &gt; &gt; &gt;&gt;
&gt; &gt; &gt; &gt;&gt; Program started
&gt; &gt; &gt; &gt;&gt; Xerces serializer will be used
&gt; &gt; &gt; &gt;&gt; &lt;?xml version="1.0" encoding="UTF-16"?&gt;
&gt; &gt; &gt; &gt;&gt; &lt;root&gt;
&gt; &gt; &gt; &gt;&gt; &lt;child1&gt;text&lt;/child1&gt;
&gt; &gt; &gt; &gt;&gt; &lt;child2/&gt;
&gt; &gt; &gt; &gt;&gt; &lt;/root&gt;
&gt; &gt; &gt; &gt;&gt;
&gt; &gt; &gt; &gt;&gt; Xalan serializer will be used
&gt; &gt; &gt; &gt;&gt; &lt;?xml version="1.0" encoding="UTF-16"?&gt;&lt;root&gt;
&gt; &gt; &gt; &gt;&gt; &lt;child1&gt;text&lt;/child1&gt;
&gt; &gt; &gt; &gt;&gt; &lt;child2&gt; &lt;/child2&gt;
&gt; &gt; &gt; &gt;&gt; &lt;/root&gt;
&gt; &gt; &gt; &gt;&gt;
&gt; &gt; &gt; &gt;&gt; Regards
&gt; &gt; &gt; &gt;&gt; Dick Deneer
&gt; &gt; &gt; &gt;&gt;
&gt; &gt; &gt; &gt;&gt;
---------------------------------------------------------------------
&gt; &gt; &gt; &gt;&gt; ---
&gt; &gt; &gt; &gt;&gt;
&gt; &gt; &gt; &gt;
&gt; &gt; &gt; &gt;
---------------------------------------------------------------------
&gt; &gt; &gt; &gt; To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
&gt; &gt; &gt; &gt; For additional commands, e-mail: j-users-help@xerces.apache.org
&gt; &gt; &gt; &gt;
&gt; &gt; &gt;
&gt; &gt; &gt;
&gt; &gt; &gt; ---------------------------------------------------------------------
&gt; &gt; &gt; To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
&gt; &gt; &gt; For additional commands, e-mail: j-users-help@xerces.apache.org

</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Loosing significant space in LSSerializer</title>
<author><name>Dick Deneer &lt;dick.deneer@donkeydevelopment.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200911.mbox/%3cA6DF95FC-9A44-43EA-B9AC-D2CCCBF2B6B2@donkeydevelopment.com%3e"/>
<id>urn:uuid:%3cA6DF95FC-9A44-43EA-B9AC-D2CCCBF2B6B2@donkeydevelopment-com%3e</id>
<updated>2009-11-22T21:06:06Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Hi Benson,

As Michael notes, Xerces is now shipped with the serializer.jar  
(which contains the xalan serializer). If you have this on your  
classpath it will be used.
If you leave it out, then xerces will fall back to it's own  
(deprecated) one.

regards
Dick Deneer
Op 22-nov-2009, om 21:54 heeft Benson Margulies het volgende geschreven:

&gt; Hi Michael,
&gt;
&gt; So, if I put Xerces and not Xalan into classpath, and ask a  
&gt; document for it's implementation, and ask that for the  
&gt; DOMImplementationLS, what do I get? Whatever Sun tossed into the  
&gt; pot? And if I then add Xalan, do I get the right one?
&gt;
&gt; --benson
&gt;
&gt;
&gt; On Sat, Nov 21, 2009 at 10:24 PM, Michael Glavassevich  
&gt; &lt;mrglavas@ca.ibm.com&gt; wrote:
&gt; Hi Benson,
&gt;
&gt; We're talking about two different implementations of the DOM Level  
&gt; 3 LSSerializer, the more recently developed one in Xalan  
&gt; (serializer.jar which Xerces now ships and shares with Xalan) and  
&gt; the much older deprecated one in Xerces. If you're curious about  
&gt; the history on that, there's an FAQ [1] on the website.
&gt;
&gt; Some users have decided to keep using Xerces' deprecated serializer  
&gt; due to some quirks and issues with the currently available one from  
&gt; Xalan. Folks really should be opening JIRA issues [2] against  
&gt; Xalan, so those problems get addressed there. There's no intention  
&gt; to do any further development or fixes to the one in Xerces.
&gt;
&gt; Thanks.
&gt;
&gt; [1] http://xerces.apache.org/xerces2-j/faq-general.html#faq-6
&gt; [2] https://issues.apache.org/jira/browse/XALANJ
&gt;
&gt;
&gt;
&gt; Michael Glavassevich
&gt; XML Parser Development
&gt; IBM Toronto Lab
&gt; E-mail: mrglavas@ca.ibm.com
&gt; E-mail: mrglavas@apache.org
&gt;
&gt; Benson Margulies &lt;bimargulies@gmail.com&gt; wrote on 11/21/2009  
&gt; 02:17:49 PM:
&gt;
&gt;
&gt; &gt; Could I please ask for a bit of clarification? The only LSSerializer
&gt; &gt; I'm aware of is the DOM level 3 stuff, which, I thought, was the
&gt; &gt; opposite of obsolete. As someone pointed out here, unlike TraX, it
&gt; &gt; will serialize doctypes and do other handy things. In general, I'm
&gt; &gt; beginning to prefer the DOMImplementationLS to JAXP and TraX.
&gt;
&gt; &gt; On Sat, Nov 21, 2009 at 2:07 PM, Michael Glavassevich  
&gt; &lt;mrglavas@ca.ibm.com
&gt; &gt; &gt; wrote:
&gt; &gt; You should also be able to control whether spaces are preserved by
&gt; &gt; registering an LSSerializerFilter.
&gt; &gt;
&gt; &gt; When I added one to your test program:
&gt; &gt;
&gt; &gt;         if (useXerces)
&gt; &gt;         {
&gt; &gt;             domWriter = new DOMSerializerImpl();
&gt; &gt;             domWriter.setFilter(new LSSerializerFilter() {
&gt; &gt;                 public int getWhatToShow() {
&gt; &gt;                     return LSSerializerFilter.SHOW_ALL;
&gt; &gt;                 }
&gt; &gt;                 public short acceptNode(Node n) {
&gt; &gt;                     return LSSerializerFilter.FILTER_ACCEPT;
&gt; &gt;                 }});
&gt; &gt;         }
&gt; &gt;
&gt; &gt; the output I get is:
&gt; &gt;
&gt; &gt;
&gt; &gt; Program started
&gt; &gt; Xerces serializer will be used
&gt; &gt; &lt;?xml version="1.0" encoding="UTF-16"?&gt;
&gt; &gt; &lt;root&gt;
&gt; &gt; &lt;child1&gt;text&lt;/child1&gt;
&gt; &gt; &lt;child2&gt; &lt;/child2&gt;
&gt; &gt;
&gt; &gt; &lt;/root&gt;
&gt; &gt;
&gt; &gt; Xalan serializer will be used
&gt; &gt; &lt;?xml version="1.0" encoding="UTF-16"?&gt;&lt;root&gt;
&gt; &gt; &lt;child1&gt;text&lt;/child1&gt;
&gt; &gt; &lt;child2&gt; &lt;/child2&gt;
&gt; &gt; &lt;/root&gt;
&gt;
&gt; &gt; which I believe is what you were expecting.
&gt; &gt;
&gt; &gt; Thanks.
&gt; &gt;
&gt; &gt; Michael Glavassevich
&gt; &gt; XML Parser Development
&gt; &gt; IBM Toronto Lab
&gt; &gt; E-mail: mrglavas@ca.ibm.com
&gt; &gt; E-mail: mrglavas@apache.org
&gt; &gt;
&gt; &gt; Dick Deneer &lt;dick.deneer@donkeydevelopment.com&gt; wrote on 11/21/2009
&gt; &gt; 01:19:27 PM:
&gt; &gt;
&gt; &gt;
&gt; &gt; &gt; Hi Jake,
&gt; &gt; &gt;
&gt; &gt; &gt;
&gt; &gt; &gt; I just tried your suggestion and the spaces are indeed preserved.
&gt; &gt; &gt; But still, I woud prefer another solution. I do not have any clue
&gt; &gt; &gt; about the xml (I use xerces in a xml editor) and I do not want to
&gt; &gt; &gt; change the xml.
&gt; &gt; &gt; And also I would like to stay with the LSSerializer (it also
&gt; &gt; &gt; serilalizes doctype nodes).
&gt; &gt; &gt; If there is another way please let me know.
&gt; &gt; &gt;
&gt; &gt; &gt; Thanks
&gt; &gt; &gt; Dick Deneer
&gt; &gt; &gt;
&gt; &gt; &gt;
&gt; &gt; &gt;
&gt; &gt; &gt; Op 21-nov-2009, om 19:03 heeft Jacob Kjome het volgende  
&gt; geschreven:
&gt; &gt; &gt;
&gt; &gt; &gt; &gt; Have you tried xml:space="preserve"?
&gt; &gt; &gt; &gt;
&gt; &gt; &gt; &gt; Jake
&gt; &gt; &gt; &gt;
&gt; &gt; &gt; &gt; On 11/20/2009 4:36 PM, Dick Deneer wrote:
&gt; &gt; &gt; &gt;&gt; I am still using the deprecated LSSerializer because the xalan
&gt; &gt; &gt; &gt;&gt; serializer has issues with the pretty print.
&gt; &gt; &gt; &gt;&gt; But when I have simple elements with only space, the serializer
&gt; &gt; &gt; &gt;&gt; produces
&gt; &gt; &gt; &gt;&gt; empty elements. Is there a tweak to keep the spaces in this  
&gt; elements?
&gt; &gt; &gt; &gt;&gt;
&gt; &gt; &gt; &gt;&gt; Sample xml:
&gt; &gt; &gt; &gt;&gt; &lt;root&gt;&lt;child1&gt;text&lt;/child1&gt;&lt;child2&gt; &lt;/child2&gt;&lt;/root&gt;
&gt; &gt; &gt; &gt;&gt; I attached a simple test program, that you can just run to  
&gt; see the
&gt; &gt; &gt; &gt;&gt; results:
&gt; &gt; &gt; &gt;&gt;
&gt; &gt; &gt; &gt;&gt; Program started
&gt; &gt; &gt; &gt;&gt; Xerces serializer will be used
&gt; &gt; &gt; &gt;&gt; &lt;?xml version="1.0" encoding="UTF-16"?&gt;
&gt; &gt; &gt; &gt;&gt; &lt;root&gt;
&gt; &gt; &gt; &gt;&gt; &lt;child1&gt;text&lt;/child1&gt;
&gt; &gt; &gt; &gt;&gt; &lt;child2/&gt;
&gt; &gt; &gt; &gt;&gt; &lt;/root&gt;
&gt; &gt; &gt; &gt;&gt;
&gt; &gt; &gt; &gt;&gt; Xalan serializer will be used
&gt; &gt; &gt; &gt;&gt; &lt;?xml version="1.0" encoding="UTF-16"?&gt;&lt;root&gt;
&gt; &gt; &gt; &gt;&gt; &lt;child1&gt;text&lt;/child1&gt;
&gt; &gt; &gt; &gt;&gt; &lt;child2&gt; &lt;/child2&gt;
&gt; &gt; &gt; &gt;&gt; &lt;/root&gt;
&gt; &gt; &gt; &gt;&gt;
&gt; &gt; &gt; &gt;&gt; Regards
&gt; &gt; &gt; &gt;&gt; Dick Deneer
&gt; &gt; &gt; &gt;&gt;
&gt; &gt; &gt; &gt;&gt;  
&gt; ---------------------------------------------------------------------
&gt; &gt; &gt; &gt;&gt; ---
&gt; &gt; &gt; &gt;&gt;
&gt; &gt; &gt; &gt;
&gt; &gt; &gt; &gt;  
&gt; ---------------------------------------------------------------------
&gt; &gt; &gt; &gt; To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
&gt; &gt; &gt; &gt; For additional commands, e-mail: j-users-help@xerces.apache.org
&gt; &gt; &gt; &gt;
&gt; &gt; &gt;
&gt; &gt; &gt;
&gt; &gt; &gt;  
&gt; ---------------------------------------------------------------------
&gt; &gt; &gt; To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
&gt; &gt; &gt; For additional commands, e-mail: j-users-help@xerces.apache.org
&gt;



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Loosing significant space in LSSerializer</title>
<author><name>Benson Margulies &lt;bimargulies@gmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200911.mbox/%3c61b5d9410911221254u1c801f5fhbec2d335b8637f2e@mail.gmail.com%3e"/>
<id>urn:uuid:%3c61b5d9410911221254u1c801f5fhbec2d335b8637f2e@mail-gmail-com%3e</id>
<updated>2009-11-22T20:54:37Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Hi Michael,

So, if I put Xerces and not Xalan into classpath, and ask a document for
it's implementation, and ask that for the DOMImplementationLS, what do I
get? Whatever Sun tossed into the pot? And if I then add Xalan, do I get the
right one?

--benson


On Sat, Nov 21, 2009 at 10:24 PM, Michael Glavassevich
&lt;mrglavas@ca.ibm.com&gt;wrote:

&gt; Hi Benson,
&gt;
&gt; We're talking about two different implementations of the DOM Level 3
&gt; LSSerializer, the more recently developed one in Xalan (serializer.jar which
&gt; Xerces now ships and shares with Xalan) and the much older deprecated one in
&gt; Xerces. If you're curious about the history on that, there's an FAQ [1] on
&gt; the website.
&gt;
&gt; Some users have decided to keep using Xerces' deprecated serializer due to
&gt; some quirks and issues with the currently available one from Xalan. Folks
&gt; really should be opening JIRA issues [2] against Xalan, so those problems
&gt; get addressed there. There's no intention to do any further development or
&gt; fixes to the one in Xerces.
&gt;
&gt; Thanks.
&gt;
&gt; [1] http://xerces.apache.org/xerces2-j/faq-general.html#faq-6
&gt; [2] https://issues.apache.org/jira/browse/XALANJ
&gt;
&gt;
&gt; Michael Glavassevich
&gt; XML Parser Development
&gt; IBM Toronto Lab
&gt; E-mail: mrglavas@ca.ibm.com
&gt; E-mail: mrglavas@apache.org
&gt;
&gt; Benson Margulies &lt;bimargulies@gmail.com&gt; wrote on 11/21/2009 02:17:49 PM:
&gt;
&gt;
&gt; &gt; Could I please ask for a bit of clarification? The only LSSerializer
&gt; &gt; I'm aware of is the DOM level 3 stuff, which, I thought, was the
&gt; &gt; opposite of obsolete. As someone pointed out here, unlike TraX, it
&gt; &gt; will serialize doctypes and do other handy things. In general, I'm
&gt; &gt; beginning to prefer the DOMImplementationLS to JAXP and TraX.
&gt;
&gt; &gt; On Sat, Nov 21, 2009 at 2:07 PM, Michael Glavassevich &lt;
&gt; mrglavas@ca.ibm.com
&gt; &gt; &gt; wrote:
&gt; &gt; You should also be able to control whether spaces are preserved by
&gt; &gt; registering an LSSerializerFilter.
&gt; &gt;
&gt; &gt; When I added one to your test program:
&gt; &gt;
&gt; &gt;         if (useXerces)
&gt; &gt;         {
&gt; &gt;             domWriter = new DOMSerializerImpl();
&gt; &gt;             domWriter.setFilter(new LSSerializerFilter() {
&gt; &gt;                 public int getWhatToShow() {
&gt; &gt;                     return LSSerializerFilter.SHOW_ALL;
&gt; &gt;                 }
&gt; &gt;                 public short acceptNode(Node n) {
&gt; &gt;                     return LSSerializerFilter.FILTER_ACCEPT;
&gt; &gt;                 }});
&gt; &gt;         }
&gt; &gt;
&gt; &gt; the output I get is:
&gt; &gt;
&gt; &gt;
&gt; &gt; Program started
&gt; &gt; Xerces serializer will be used
&gt; &gt; &lt;?xml version="1.0" encoding="UTF-16"?&gt;
&gt; &gt; &lt;root&gt;
&gt; &gt; &lt;child1&gt;text&lt;/child1&gt;
&gt; &gt; &lt;child2&gt; &lt;/child2&gt;
&gt; &gt;
&gt; &gt; &lt;/root&gt;
&gt; &gt;
&gt; &gt; Xalan serializer will be used
&gt; &gt; &lt;?xml version="1.0" encoding="UTF-16"?&gt;&lt;root&gt;
&gt; &gt; &lt;child1&gt;text&lt;/child1&gt;
&gt; &gt; &lt;child2&gt; &lt;/child2&gt;
&gt; &gt; &lt;/root&gt;
&gt;
&gt; &gt; which I believe is what you were expecting.
&gt; &gt;
&gt; &gt; Thanks.
&gt; &gt;
&gt; &gt; Michael Glavassevich
&gt; &gt; XML Parser Development
&gt; &gt; IBM Toronto Lab
&gt; &gt; E-mail: mrglavas@ca.ibm.com
&gt; &gt; E-mail: mrglavas@apache.org
&gt; &gt;
&gt; &gt; Dick Deneer &lt;dick.deneer@donkeydevelopment.com&gt; wrote on 11/21/2009
&gt; &gt; 01:19:27 PM:
&gt; &gt;
&gt; &gt;
&gt; &gt; &gt; Hi Jake,
&gt; &gt; &gt;
&gt; &gt; &gt;
&gt; &gt; &gt; I just tried your suggestion and the spaces are indeed preserved.
&gt; &gt; &gt; But still, I woud prefer another solution. I do not have any clue
&gt; &gt; &gt; about the xml (I use xerces in a xml editor) and I do not want to
&gt; &gt; &gt; change the xml.
&gt; &gt; &gt; And also I would like to stay with the LSSerializer (it also
&gt; &gt; &gt; serilalizes doctype nodes).
&gt; &gt; &gt; If there is another way please let me know.
&gt; &gt; &gt;
&gt; &gt; &gt; Thanks
&gt; &gt; &gt; Dick Deneer
&gt; &gt; &gt;
&gt; &gt; &gt;
&gt; &gt; &gt;
&gt; &gt; &gt; Op 21-nov-2009, om 19:03 heeft Jacob Kjome het volgende geschreven:
&gt; &gt; &gt;
&gt; &gt; &gt; &gt; Have you tried xml:space="preserve"?
&gt; &gt; &gt; &gt;
&gt; &gt; &gt; &gt; Jake
&gt; &gt; &gt; &gt;
&gt; &gt; &gt; &gt; On 11/20/2009 4:36 PM, Dick Deneer wrote:
&gt; &gt; &gt; &gt;&gt; I am still using the deprecated LSSerializer because the xalan
&gt; &gt; &gt; &gt;&gt; serializer has issues with the pretty print.
&gt; &gt; &gt; &gt;&gt; But when I have simple elements with only space, the serializer
&gt; &gt; &gt; &gt;&gt; produces
&gt; &gt; &gt; &gt;&gt; empty elements. Is there a tweak to keep the spaces in this
&gt; elements?
&gt; &gt; &gt; &gt;&gt;
&gt; &gt; &gt; &gt;&gt; Sample xml:
&gt; &gt; &gt; &gt;&gt; &lt;root&gt;&lt;child1&gt;text&lt;/child1&gt;&lt;child2&gt; &lt;/child2&gt;&lt;/root&gt;
&gt; &gt; &gt; &gt;&gt; I attached a simple test program, that you can just run to see the
&gt; &gt; &gt; &gt;&gt; results:
&gt; &gt; &gt; &gt;&gt;
&gt; &gt; &gt; &gt;&gt; Program started
&gt; &gt; &gt; &gt;&gt; Xerces serializer will be used
&gt; &gt; &gt; &gt;&gt; &lt;?xml version="1.0" encoding="UTF-16"?&gt;
&gt; &gt; &gt; &gt;&gt; &lt;root&gt;
&gt; &gt; &gt; &gt;&gt; &lt;child1&gt;text&lt;/child1&gt;
&gt; &gt; &gt; &gt;&gt; &lt;child2/&gt;
&gt; &gt; &gt; &gt;&gt; &lt;/root&gt;
&gt; &gt; &gt; &gt;&gt;
&gt; &gt; &gt; &gt;&gt; Xalan serializer will be used
&gt; &gt; &gt; &gt;&gt; &lt;?xml version="1.0" encoding="UTF-16"?&gt;&lt;root&gt;
&gt; &gt; &gt; &gt;&gt; &lt;child1&gt;text&lt;/child1&gt;
&gt; &gt; &gt; &gt;&gt; &lt;child2&gt; &lt;/child2&gt;
&gt; &gt; &gt; &gt;&gt; &lt;/root&gt;
&gt; &gt; &gt; &gt;&gt;
&gt; &gt; &gt; &gt;&gt; Regards
&gt; &gt; &gt; &gt;&gt; Dick Deneer
&gt; &gt; &gt; &gt;&gt;
&gt; &gt; &gt; &gt;&gt;
&gt; ---------------------------------------------------------------------
&gt; &gt; &gt; &gt;&gt; ---
&gt; &gt; &gt; &gt;&gt;
&gt; &gt; &gt; &gt;
&gt; &gt; &gt; &gt; ---------------------------------------------------------------------
&gt; &gt; &gt; &gt; To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
&gt; &gt; &gt; &gt; For additional commands, e-mail: j-users-help@xerces.apache.org
&gt; &gt; &gt; &gt;
&gt; &gt; &gt;
&gt; &gt; &gt;
&gt; &gt; &gt; ---------------------------------------------------------------------
&gt; &gt; &gt; To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
&gt; &gt; &gt; For additional commands, e-mail: j-users-help@xerces.apache.org
&gt;


</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Loosing significant space in LSSerializer</title>
<author><name>Michael Glavassevich &lt;mrglavas@ca.ibm.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200911.mbox/%3cOF6D78CBA1.E93F2A55-ON85257676.005575B6-85257676.0055A442@ca.ibm.com%3e"/>
<id>urn:uuid:%3cOF6D78CBA1-E93F2A55-ON85257676-005575B6-85257676-0055A442@ca-ibm-com%3e</id>
<updated>2009-11-22T15:35:25Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Content-type: text/plain; charset=US-ASCII

(Copying xalan-j-users to this thread.)

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Michael Glavassevich &lt;mrglavas@ca.ibm.com&gt; wrote on 11/22/2009 10:30:49 AM:

&gt; Dick Deneer &lt;dick.deneer@donkeydevelopment.com&gt; wrote on 11/22/2009
&gt; 06:33:28 AM:
&gt;
&gt; &gt; Michael,
&gt; &gt;
&gt; &gt; Thank you for this suggestion.
&gt; &gt; I can use this. Before I call the serializer I will strip off all
&gt; &gt; whitespace in "whitespace-only" complex nodes because otherwise I do
&gt; &gt; not get a pretty-print:
&gt; &gt; For example:
&gt; &gt; String xml = "&lt;root&gt;" +
&gt; &gt; "                                  &lt;child1&gt;text&lt;/child1&gt;&lt;child2&gt;
&gt; &gt; &lt;/child2&gt;&lt;/root&gt;";
&gt; &gt; results in :
&gt; &gt; &lt;?xml version="1.0" encoding="UTF-16"?&gt;
&gt; &gt; &lt;root&gt;                                  &lt;child1&gt;text&lt;/child1&gt;
&gt; &gt;     &lt;child2&gt;   &lt;/child2&gt;
&gt; &gt; &lt;/root&gt;
&gt; &gt;
&gt; &gt; But stripping of this whitespace before will not be too difficult.
&gt; &gt;
&gt; &gt; I feel it is a pitty that the LSSerializer will not be maintained
&gt; &gt; anymore, because we do not have alternatives that supply the same
&gt; &gt; functionality.
&gt;
&gt; It is in Xalan. Their serializer started as a copy of the Xerces one
&gt; (even has similar package names: org.apache.xml.serialize vs.
&gt; org.apache.xml.serializer). We didn't want to duplicate the effort
&gt; anymore and decided to combine forces and the Xalan one was chosen
&gt; as the common codebase because it was better maintained and was
&gt; making significant improvements to performance. Its LSSerializer
&gt; implementation was written by a Xerces committer and I have made
&gt; improvements and fixes to it too where I've found issues, so it's
&gt; being jointly maintained, though in a different project. This is the
&gt; alternative. It *is* an LSSerializer and there is no reason that it
&gt; can't be updated / fixed to have similar behaviour, but that's only
&gt; likely to happen if users report the problems they're having
&gt; (patches are welcome), preferably in JIRA.
&gt;
&gt; &gt; I am afraid that maybe in the future there may be new xml (or DOM)
&gt; &gt; feautures that have effects on the serialization. Then we are
&gt; &gt; totally dependent on other libraries to implement that functionality.
&gt; &gt;
&gt; &gt; But I understand you have to make choices where to spent the effort.
&gt; &gt;
&gt; &gt; Thanks
&gt; &gt; Dick Deneer
&gt;
&gt; Thanks.
&gt;
&gt; Michael Glavassevich
&gt; XML Parser Development
&gt; IBM Toronto Lab
&gt; E-mail: mrglavas@ca.ibm.com
&gt; E-mail: mrglavas@apache.org

</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Loosing significant space in LSSerializer</title>
<author><name>Michael Glavassevich &lt;mrglavas@ca.ibm.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200911.mbox/%3cOF61AF2187.22732401-ON85257676.00526147-85257676.00553896@ca.ibm.com%3e"/>
<id>urn:uuid:%3cOF61AF2187-22732401-ON85257676-00526147-85257676-00553896@ca-ibm-com%3e</id>
<updated>2009-11-22T15:30:49Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: quoted-printable


Dick Deneer &lt;dick.deneer@donkeydevelopment.com&gt; wrote on 11/22/2009
06:33:28 AM:

&gt; Michael,
&gt;
&gt; Thank you for this suggestion.
&gt; I can use this. Before I call the serializer I will strip off all
&gt; whitespace in "whitespace-only" complex nodes because otherwise I do
&gt; not get a pretty-print:
&gt; For example:
&gt; String xml =3D "&lt;root&gt;" +
&gt; "                                  &lt;child1&gt;text&lt;/child1&gt;&lt;child2&gt;
&gt; &lt;/child2&gt;&lt;/root&gt;";
&gt; results in :
&gt; &lt;?xml version=3D"1.0" encoding=3D"UTF-16"?&gt;
&gt; &lt;root&gt;                                  &lt;child1&gt;text&lt;/child1&gt;
&gt;     &lt;child2&gt;   &lt;/child2&gt;
&gt; &lt;/root&gt;
&gt;
&gt; But stripping of this whitespace before will not be too difficult.
&gt;
&gt; I feel it is a pitty that the LSSerializer will not be maintained
&gt; anymore, because we do not have alternatives that supply the same
&gt; functionality.

It is in Xalan. Their serializer started as a copy of the Xerces one (e=
ven
has similar package names: org.apache.xml.serialize vs.
org.apache.xml.serializer). We didn't want to duplicate the effort anym=
ore
and decided to combine forces and the Xalan one was chosen as the commo=
n
codebase because it was better maintained and was making significant
improvements to performance. Its LSSerializer implementation was writte=
n by
a Xerces committer and I have made improvements and fixes to it too whe=
re
I've found issues, so it's being jointly maintained, though in a differ=
ent
project. This is the alternative. It *is* an LSSerializer and there is =
no
reason that it can't be updated / fixed to have similar behaviour, but
that's only likely to happen if users report the problems they're havin=
g
(patches are welcome), preferably in JIRA.

&gt; I am afraid that maybe in the future there may be new xml (or DOM)
&gt; feautures that have effects on the serialization. Then we are
&gt; totally dependent on other libraries to implement that functionality.=

&gt;
&gt; But I understand you have to make choices where to spent the effort.
&gt;
&gt; Thanks
&gt; Dick Deneer

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org=


</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Loosing significant space in LSSerializer</title>
<author><name>Dick Deneer &lt;dick.deneer@donkeydevelopment.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200911.mbox/%3c2082D588-F9ED-4699-A8B7-E906E310A34A@donkeydevelopment.com%3e"/>
<id>urn:uuid:%3c2082D588-F9ED-4699-A8B7-E906E310A34A@donkeydevelopment-com%3e</id>
<updated>2009-11-22T11:33:28Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Michael,

Thank you for this suggestion.
I can use this. Before I call the serializer I will strip off all  
whitespace in "whitespace-only" complex nodes because otherwise I do  
not get a pretty-print:
For example:
String xml = "&lt;root&gt;" +
				"                                  &lt;child1&gt;text&lt;/ 
child1&gt;&lt;child2&gt;   &lt;/child2&gt;&lt;/root&gt;";
results in :
&lt;?xml version="1.0" encoding="UTF-16"?&gt;
&lt;root&gt;                                  &lt;child1&gt;text&lt;/child1&gt;
     &lt;child2&gt;   &lt;/child2&gt;
&lt;/root&gt;

But stripping of this whitespace before will not be too difficult.

I feel it is a pitty that the LSSerializer will not be maintained  
anymore, because we do not have alternatives that supply the same  
functionality.
I am afraid that maybe in the future there may be new xml (or DOM)  
feautures that have effects on the serialization. Then we are totally  
dependent on other libraries to implement that functionality.


But I understand you have to make choices where to spent the effort.

Thanks
Dick Deneer


Op 21-nov-2009, om 20:07 heeft Michael Glavassevich het volgende  
geschreven:

&gt; You should also be able to control whether spaces are preserved by  
&gt; registering an LSSerializerFilter.
&gt;
&gt; When I added one to your test program:
&gt;
&gt;         if (useXerces)
&gt;         {
&gt;             domWriter = new DOMSerializerImpl();
&gt;             domWriter.setFilter(new LSSerializerFilter() {
&gt;                 public int getWhatToShow() {
&gt;                     return LSSerializerFilter.SHOW_ALL;
&gt;                 }
&gt;                 public short acceptNode(Node n) {
&gt;                     return LSSerializerFilter.FILTER_ACCEPT;
&gt;                 }});
&gt;         }
&gt;
&gt; the output I get is:
&gt;
&gt; Program started
&gt; Xerces serializer will be used
&gt; &lt;?xml version="1.0" encoding="UTF-16"?&gt;
&gt; &lt;root&gt;
&gt; &lt;child1&gt;text&lt;/child1&gt;
&gt; &lt;child2&gt; &lt;/child2&gt;
&gt; &lt;/root&gt;
&gt;
&gt; Xalan serializer will be used
&gt; &lt;?xml version="1.0" encoding="UTF-16"?&gt;&lt;root&gt;
&gt; &lt;child1&gt;text&lt;/child1&gt;
&gt; &lt;child2&gt; &lt;/child2&gt;
&gt; &lt;/root&gt;
&gt;
&gt; which I believe is what you were expecting.
&gt;
&gt; Thanks.
&gt;
&gt; Michael Glavassevich
&gt; XML Parser Development
&gt; IBM Toronto Lab
&gt; E-mail: mrglavas@ca.ibm.com
&gt; E-mail: mrglavas@apache.org
&gt;
&gt; Dick Deneer &lt;dick.deneer@donkeydevelopment.com&gt; wrote on 11/21/2009  
&gt; 01:19:27 PM:
&gt;
&gt; &gt; Hi Jake,
&gt; &gt;
&gt; &gt;
&gt; &gt; I just tried your suggestion and the spaces are indeed preserved.
&gt; &gt; But still, I woud prefer another solution. I do not have any clue
&gt; &gt; about the xml (I use xerces in a xml editor) and I do not want to
&gt; &gt; change the xml.
&gt; &gt; And also I would like to stay with the LSSerializer (it also
&gt; &gt; serilalizes doctype nodes).
&gt; &gt; If there is another way please let me know.
&gt; &gt;
&gt; &gt; Thanks
&gt; &gt; Dick Deneer
&gt; &gt;
&gt; &gt;
&gt; &gt;
&gt; &gt; Op 21-nov-2009, om 19:03 heeft Jacob Kjome het volgende geschreven:
&gt; &gt;
&gt; &gt; &gt; Have you tried xml:space="preserve"?
&gt; &gt; &gt;
&gt; &gt; &gt; Jake
&gt; &gt; &gt;
&gt; &gt; &gt; On 11/20/2009 4:36 PM, Dick Deneer wrote:
&gt; &gt; &gt;&gt; I am still using the deprecated LSSerializer because the xalan
&gt; &gt; &gt;&gt; serializer has issues with the pretty print.
&gt; &gt; &gt;&gt; But when I have simple elements with only space, the serializer
&gt; &gt; &gt;&gt; produces
&gt; &gt; &gt;&gt; empty elements. Is there a tweak to keep the spaces in this  
&gt; elements?
&gt; &gt; &gt;&gt;
&gt; &gt; &gt;&gt; Sample xml:
&gt; &gt; &gt;&gt; &lt;root&gt;&lt;child1&gt;text&lt;/child1&gt;&lt;child2&gt; &lt;/child2&gt;&lt;/root&gt;
&gt; &gt; &gt;&gt; I attached a simple test program, that you can just run to see  
&gt; the
&gt; &gt; &gt;&gt; results:
&gt; &gt; &gt;&gt;
&gt; &gt; &gt;&gt; Program started
&gt; &gt; &gt;&gt; Xerces serializer will be used
&gt; &gt; &gt;&gt; &lt;?xml version="1.0" encoding="UTF-16"?&gt;
&gt; &gt; &gt;&gt; &lt;root&gt;
&gt; &gt; &gt;&gt; &lt;child1&gt;text&lt;/child1&gt;
&gt; &gt; &gt;&gt; &lt;child2/&gt;
&gt; &gt; &gt;&gt; &lt;/root&gt;
&gt; &gt; &gt;&gt;
&gt; &gt; &gt;&gt; Xalan serializer will be used
&gt; &gt; &gt;&gt; &lt;?xml version="1.0" encoding="UTF-16"?&gt;&lt;root&gt;
&gt; &gt; &gt;&gt; &lt;child1&gt;text&lt;/child1&gt;
&gt; &gt; &gt;&gt; &lt;child2&gt; &lt;/child2&gt;
&gt; &gt; &gt;&gt; &lt;/root&gt;
&gt; &gt; &gt;&gt;
&gt; &gt; &gt;&gt; Regards
&gt; &gt; &gt;&gt; Dick Deneer
&gt; &gt; &gt;&gt;
&gt; &gt; &gt;&gt;  
&gt; ---------------------------------------------------------------------
&gt; &gt; &gt;&gt; ---
&gt; &gt; &gt;&gt;
&gt; &gt; &gt;
&gt; &gt; &gt;  
&gt; ---------------------------------------------------------------------
&gt; &gt; &gt; To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
&gt; &gt; &gt; For additional commands, e-mail: j-users-help@xerces.apache.org
&gt; &gt; &gt;
&gt; &gt;
&gt; &gt;
&gt; &gt;  
&gt; ---------------------------------------------------------------------
&gt; &gt; To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
&gt; &gt; For additional commands, e-mail: j-users-help@xerces.apache.org
&gt;



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Loosing significant space in LSSerializer</title>
<author><name>Michael Glavassevich &lt;mrglavas@ca.ibm.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200911.mbox/%3cOFCE31A93D.D20934F1-ON85257676.0011C43D-85257676.0012B969@ca.ibm.com%3e"/>
<id>urn:uuid:%3cOFCE31A93D-D20934F1-ON85257676-0011C43D-85257676-0012B969@ca-ibm-com%3e</id>
<updated>2009-11-22T03:24:30Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Content-type: text/plain; charset=ISO-8859-1
Content-transfer-encoding: quoted-printable


Hi Benson,

We're talking about two different implementations of the DOM Level 3
LSSerializer, the more recently developed one in Xalan (serializer.jar
which Xerces now ships and shares with Xalan) and the much older deprec=
ated
one in Xerces. If you're curious about the history on that, there's an =
FAQ
[1] on the website.

Some users have decided to keep using Xerces' deprecated serializer due=
 to
some quirks and issues with the currently available one from Xalan. Fol=
ks
really should be opening JIRA issues [2] against Xalan, so those proble=
ms
get addressed there. There's no intention to do any further development=
 or
fixes to the one in Xerces.

Thanks.

[1] http://xerces.apache.org/xerces2-j/faq-general.html#faq-6
[2] https://issues.apache.org/jira/browse/XALANJ

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Benson Margulies &lt;bimargulies@gmail.com&gt; wrote on 11/21/2009 02:17:49 P=
M:

&gt; Could I please ask for a bit of clarification? The only LSSerializer
&gt; I'm aware of is the DOM level 3 stuff, which, I thought, was the
&gt; opposite of obsolete. As someone pointed out here, unlike TraX, it
&gt; will serialize doctypes and do other handy things. In general, I'm
&gt; beginning to prefer the DOMImplementationLS to JAXP and TraX.

&gt; On Sat, Nov 21, 2009 at 2:07 PM, Michael Glavassevich
&lt;mrglavas@ca.ibm.com
&gt; &gt; wrote:
&gt; You should also be able to control whether spaces are preserved by
&gt; registering an LSSerializerFilter.
&gt;
&gt; When I added one to your test program:
&gt;
&gt; =A0 =A0 =A0 =A0 if (useXerces)
&gt; =A0 =A0 =A0 =A0 {
&gt; =A0 =A0 =A0 =A0 =A0 =A0 domWriter =3D new DOMSerializerImpl();
&gt; =A0 =A0 =A0 =A0 =A0 =A0 domWriter.setFilter(new LSSerializerFilter() =
{
&gt; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 public int getWhatToShow() {
&gt; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return LSSerializerFilter.SHO=
W_ALL;
&gt; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
&gt; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 public short acceptNode(Node n) {
&gt; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return LSSerializerFilter.FIL=
TER_ACCEPT;
&gt; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 }});
&gt; =A0 =A0 =A0 =A0 }
&gt;
&gt; the output I get is:
&gt;
&gt;
&gt; Program started
&gt; Xerces serializer will be used
&gt; &lt;?xml version=3D"1.0" encoding=3D"UTF-16"?&gt;
&gt; &lt;root&gt;
&gt; &lt;child1&gt;text&lt;/child1&gt;
&gt; &lt;child2&gt; &lt;/child2&gt;
&gt;
&gt; &lt;/root&gt;
&gt;
&gt; Xalan serializer will be used
&gt; &lt;?xml version=3D"1.0" encoding=3D"UTF-16"?&gt;&lt;root&gt;
&gt; &lt;child1&gt;text&lt;/child1&gt;
&gt; &lt;child2&gt; &lt;/child2&gt;
&gt; &lt;/root&gt;

&gt; which I believe is what you were expecting.
&gt;
&gt; Thanks.
&gt;
&gt; Michael Glavassevich
&gt; XML Parser Development
&gt; IBM Toronto Lab
&gt; E-mail: mrglavas@ca.ibm.com
&gt; E-mail: mrglavas@apache.org
&gt;
&gt; Dick Deneer &lt;dick.deneer@donkeydevelopment.com&gt; wrote on 11/21/2009
&gt; 01:19:27 PM:
&gt;
&gt;
&gt; &gt; Hi Jake,
&gt; &gt;
&gt; &gt;
&gt; &gt; I just tried your suggestion and the spaces are indeed preserved.
&gt; &gt; But still, I woud prefer another solution. I do not have any clue
&gt; &gt; about the xml (I use xerces in a xml editor) and I do not want to
&gt; &gt; change the xml.
&gt; &gt; And also I would like to stay with the LSSerializer (it also
&gt; &gt; serilalizes doctype nodes).
&gt; &gt; If there is another way please let me know.
&gt; &gt;
&gt; &gt; Thanks
&gt; &gt; Dick Deneer
&gt; &gt;
&gt; &gt;
&gt; &gt;
&gt; &gt; Op 21-nov-2009, om 19:03 heeft Jacob Kjome het volgende geschreven:=

&gt; &gt;
&gt; &gt; &gt; Have you tried xml:space=3D"preserve"?
&gt; &gt; &gt;
&gt; &gt; &gt; Jake
&gt; &gt; &gt;
&gt; &gt; &gt; On 11/20/2009 4:36 PM, Dick Deneer wrote:
&gt; &gt; &gt;&gt; I am still using the deprecated LSSerializer because the xalan
&gt; &gt; &gt;&gt; serializer has issues with the pretty print.
&gt; &gt; &gt;&gt; But when I have simple elements with only space, the serializer
&gt; &gt; &gt;&gt; produces
&gt; &gt; &gt;&gt; empty elements. Is there a tweak to keep the spaces in this
elements?
&gt; &gt; &gt;&gt;
&gt; &gt; &gt;&gt; Sample xml:
&gt; &gt; &gt;&gt; &lt;root&gt;&lt;child1&gt;text&lt;/child1&gt;&lt;child2&gt; &lt;/child2&gt;&lt;/root&gt;
&gt; &gt; &gt;&gt; I attached a simple test program, that you can just run to see t=
he
&gt; &gt; &gt;&gt; results:
&gt; &gt; &gt;&gt;
&gt; &gt; &gt;&gt; Program started
&gt; &gt; &gt;&gt; Xerces serializer will be used
&gt; &gt; &gt;&gt; &lt;?xml version=3D"1.0" encoding=3D"UTF-16"?&gt;
&gt; &gt; &gt;&gt; &lt;root&gt;
&gt; &gt; &gt;&gt; &lt;child1&gt;text&lt;/child1&gt;
&gt; &gt; &gt;&gt; &lt;child2/&gt;
&gt; &gt; &gt;&gt; &lt;/root&gt;
&gt; &gt; &gt;&gt;
&gt; &gt; &gt;&gt; Xalan serializer will be used
&gt; &gt; &gt;&gt; &lt;?xml version=3D"1.0" encoding=3D"UTF-16"?&gt;&lt;root&gt;
&gt; &gt; &gt;&gt; &lt;child1&gt;text&lt;/child1&gt;
&gt; &gt; &gt;&gt; &lt;child2&gt; &lt;/child2&gt;
&gt; &gt; &gt;&gt; &lt;/root&gt;
&gt; &gt; &gt;&gt;
&gt; &gt; &gt;&gt; Regards
&gt; &gt; &gt;&gt; Dick Deneer
&gt; &gt; &gt;&gt;
&gt; &gt; &gt;&gt;
---------------------------------------------------------------------
&gt; &gt; &gt;&gt; ---
&gt; &gt; &gt;&gt;
&gt; &gt; &gt;
&gt; &gt; &gt; -----------------------------------------------------------------=
----
&gt; &gt; &gt; To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
&gt; &gt; &gt; For additional commands, e-mail: j-users-help@xerces.apache.org
&gt; &gt; &gt;
&gt; &gt;
&gt; &gt;
&gt; &gt; -------------------------------------------------------------------=
--
&gt; &gt; To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
&gt; &gt; For additional commands, e-mail: j-users-help@xerces.apache.org=


</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Loosing significant space in LSSerializer</title>
<author><name>Benson Margulies &lt;bimargulies@gmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200911.mbox/%3c61b5d9410911211117p4da6641fh49fa8316cbc83b41@mail.gmail.com%3e"/>
<id>urn:uuid:%3c61b5d9410911211117p4da6641fh49fa8316cbc83b41@mail-gmail-com%3e</id>
<updated>2009-11-21T19:17:49Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Could I please ask for a bit of clarification? The only LSSerializer I'm
aware of is the DOM level 3 stuff, which, I thought, was the opposite of
obsolete. As someone pointed out here, unlike TraX, it will serialize
doctypes and do other handy things. In general, I'm beginning to prefer the
DOMImplementationLS to JAXP and TraX.

On Sat, Nov 21, 2009 at 2:07 PM, Michael Glavassevich
&lt;mrglavas@ca.ibm.com&gt;wrote:

&gt; You should also be able to control whether spaces are preserved by
&gt; registering an LSSerializerFilter.
&gt;
&gt; When I added one to your test program:
&gt;
&gt;         if (useXerces)
&gt;         {
&gt;             domWriter = new DOMSerializerImpl();
&gt;             domWriter.setFilter(new LSSerializerFilter() {
&gt;                 public int getWhatToShow() {
&gt;                     return LSSerializerFilter.SHOW_ALL;
&gt;                 }
&gt;                 public short acceptNode(Node n) {
&gt;                     return LSSerializerFilter.FILTER_ACCEPT;
&gt;                 }});
&gt;         }
&gt;
&gt; the output I get is:
&gt;
&gt;
&gt; Program started
&gt; Xerces serializer will be used
&gt; &lt;?xml version="1.0" encoding="UTF-16"?&gt;
&gt; &lt;root&gt;
&gt;  &lt;child1&gt;text&lt;/child1&gt;
&gt;  &lt;child2&gt; &lt;/child2&gt;
&gt;
&gt; &lt;/root&gt;
&gt;
&gt; Xalan serializer will be used
&gt; &lt;?xml version="1.0" encoding="UTF-16"?&gt;&lt;root&gt;
&gt;  &lt;child1&gt;text&lt;/child1&gt;
&gt;  &lt;child2&gt; &lt;/child2&gt;
&gt; &lt;/root&gt;
&gt;
&gt; which I believe is what you were expecting.
&gt;
&gt; Thanks.
&gt;
&gt; Michael Glavassevich
&gt; XML Parser Development
&gt; IBM Toronto Lab
&gt; E-mail: mrglavas@ca.ibm.com
&gt; E-mail: mrglavas@apache.org
&gt;
&gt; Dick Deneer &lt;dick.deneer@donkeydevelopment.com&gt; wrote on 11/21/2009
&gt; 01:19:27 PM:
&gt;
&gt;
&gt; &gt; Hi Jake,
&gt; &gt;
&gt; &gt;
&gt; &gt; I just tried your suggestion and the spaces are indeed preserved.
&gt; &gt; But still, I woud prefer another solution. I do not have any clue
&gt; &gt; about the xml (I use xerces in a xml editor) and I do not want to
&gt; &gt; change the xml.
&gt; &gt; And also I would like to stay with the LSSerializer (it also
&gt; &gt; serilalizes doctype nodes).
&gt; &gt; If there is another way please let me know.
&gt; &gt;
&gt; &gt; Thanks
&gt; &gt; Dick Deneer
&gt; &gt;
&gt; &gt;
&gt; &gt;
&gt; &gt; Op 21-nov-2009, om 19:03 heeft Jacob Kjome het volgende geschreven:
&gt; &gt;
&gt; &gt; &gt; Have you tried xml:space="preserve"?
&gt; &gt; &gt;
&gt; &gt; &gt; Jake
&gt; &gt; &gt;
&gt; &gt; &gt; On 11/20/2009 4:36 PM, Dick Deneer wrote:
&gt; &gt; &gt;&gt; I am still using the deprecated LSSerializer because the xalan
&gt; &gt; &gt;&gt; serializer has issues with the pretty print.
&gt; &gt; &gt;&gt; But when I have simple elements with only space, the serializer
&gt; &gt; &gt;&gt; produces
&gt; &gt; &gt;&gt; empty elements. Is there a tweak to keep the spaces in this elements?
&gt; &gt; &gt;&gt;
&gt; &gt; &gt;&gt; Sample xml:
&gt; &gt; &gt;&gt; &lt;root&gt;&lt;child1&gt;text&lt;/child1&gt;&lt;child2&gt; &lt;/child2&gt;&lt;/root&gt;
&gt; &gt; &gt;&gt; I attached a simple test program, that you can just run to see the
&gt; &gt; &gt;&gt; results:
&gt; &gt; &gt;&gt;
&gt; &gt; &gt;&gt; Program started
&gt; &gt; &gt;&gt; Xerces serializer will be used
&gt; &gt; &gt;&gt; &lt;?xml version="1.0" encoding="UTF-16"?&gt;
&gt; &gt; &gt;&gt; &lt;root&gt;
&gt; &gt; &gt;&gt; &lt;child1&gt;text&lt;/child1&gt;
&gt; &gt; &gt;&gt; &lt;child2/&gt;
&gt; &gt; &gt;&gt; &lt;/root&gt;
&gt; &gt; &gt;&gt;
&gt; &gt; &gt;&gt; Xalan serializer will be used
&gt; &gt; &gt;&gt; &lt;?xml version="1.0" encoding="UTF-16"?&gt;&lt;root&gt;
&gt; &gt; &gt;&gt; &lt;child1&gt;text&lt;/child1&gt;
&gt; &gt; &gt;&gt; &lt;child2&gt; &lt;/child2&gt;
&gt; &gt; &gt;&gt; &lt;/root&gt;
&gt; &gt; &gt;&gt;
&gt; &gt; &gt;&gt; Regards
&gt; &gt; &gt;&gt; Dick Deneer
&gt; &gt; &gt;&gt;
&gt; &gt; &gt;&gt; ---------------------------------------------------------------------
&gt; &gt; &gt;&gt; ---
&gt; &gt; &gt;&gt;
&gt; &gt; &gt;
&gt; &gt; &gt; ---------------------------------------------------------------------
&gt; &gt; &gt; To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
&gt; &gt; &gt; For additional commands, e-mail: j-users-help@xerces.apache.org
&gt; &gt; &gt;
&gt; &gt;
&gt; &gt;
&gt; &gt; ---------------------------------------------------------------------
&gt; &gt; To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
&gt; &gt; For additional commands, e-mail: j-users-help@xerces.apache.org
&gt;


</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Loosing significant space in LSSerializer</title>
<author><name>Michael Glavassevich &lt;mrglavas@ca.ibm.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200911.mbox/%3cOFE82F98E9.BB533770-ON85257675.0067F8C6-85257675.00690F8C@ca.ibm.com%3e"/>
<id>urn:uuid:%3cOFE82F98E9-BB533770-ON85257675-0067F8C6-85257675-00690F8C@ca-ibm-com%3e</id>
<updated>2009-11-21T19:07:32Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Content-type: text/plain; charset=US-ASCII

You should also be able to control whether spaces are preserved by
registering an LSSerializerFilter.

When I added one to your test program:

        if (useXerces)
        {
            domWriter = new DOMSerializerImpl();
            domWriter.setFilter(new LSSerializerFilter() {
                public int getWhatToShow() {
                    return LSSerializerFilter.SHOW_ALL;)
                }
                public short acceptNode(Node n) {
                    return LSSerializerFilter.FILTER_ACCEPT;
                }});
        }

the output I get is:

Program started
Xerces serializer will be used
&lt;?xml version="1.0" encoding="UTF-16"?&gt;
&lt;root&gt;
    &lt;child1&gt;text&lt;/child1&gt;
    &lt;child2&gt;   &lt;/child2&gt;&gt;
&lt;/root&gt;

Xalan serializer will be used
&lt;?xml version="1.0" encoding="UTF-16"?&gt;&lt;root&gt;.
   &lt;child1&gt;text&lt;/child1&gt;
   &lt;child2&gt;   &lt;/child2&gt;&gt;
&lt;/root&gt;

which I believe is what you were expecting.

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Dick Deneer &lt;dick.deneer@donkeydevelopment.com&gt; wrote on 11/21/2009
01:19:27 PM:

&gt; Hi Jake,
&gt;
&gt;
&gt; I just tried your suggestion and the spaces are indeed preserved.
&gt; But still, I woud prefer another solution. I do not have any clue
&gt; about the xml (I use xerces in a xml editor) and I do not want to
&gt; change the xml.
&gt; And also I would like to stay with the LSSerializer (it also
&gt; serilalizes doctype nodes).
&gt; If there is another way please let me know.
&gt;
&gt; Thanks
&gt; Dick Deneer
&gt;
&gt;
&gt;
&gt; Op 21-nov-2009, om 19:03 heeft Jacob Kjome het volgende geschreven:
&gt;
&gt; &gt; Have you tried xml:space="preserve"?
&gt; &gt;
&gt; &gt; Jake
&gt; &gt;
&gt; &gt; On 11/20/2009 4:36 PM, Dick Deneer wrote:
&gt; &gt;&gt; I am still using the deprecated LSSerializer because the xalan
&gt; &gt;&gt; serializer has issues with the pretty print.
&gt; &gt;&gt; But when I have simple elements with only space, the serializer
&gt; &gt;&gt; produces
&gt; &gt;&gt; empty elements. Is there a tweak to keep the spaces in this elements?
&gt; &gt;&gt;
&gt; &gt;&gt; Sample xml:
&gt; &gt;&gt; &lt;root&gt;&lt;child1&gt;text&lt;/child1&gt;&lt;child2&gt; &lt;/child2&gt;&lt;/root&gt;
&gt; &gt;&gt; I attached a simple test program, that you can just run to see the
&gt; &gt;&gt; results:
&gt; &gt;&gt;
&gt; &gt;&gt; Program started
&gt; &gt;&gt; Xerces serializer will be used
&gt; &gt;&gt; &lt;?xml version="1.0" encoding="UTF-16"?&gt;
&gt; &gt;&gt; &lt;root&gt;
&gt; &gt;&gt; &lt;child1&gt;text&lt;/child1&gt;
&gt; &gt;&gt; &lt;child2/&gt;
&gt; &gt;&gt; &lt;/root&gt;
&gt; &gt;&gt;
&gt; &gt;&gt; Xalan serializer will be used
&gt; &gt;&gt; &lt;?xml version="1.0" encoding="UTF-16"?&gt;&lt;root&gt;
&gt; &gt;&gt; &lt;child1&gt;text&lt;/child1&gt;
&gt; &gt;&gt; &lt;child2&gt; &lt;/child2&gt;
&gt; &gt;&gt; &lt;/root&gt;
&gt; &gt;&gt;
&gt; &gt;&gt; Regards
&gt; &gt;&gt; Dick Deneer
&gt; &gt;&gt;
&gt; &gt;&gt; ---------------------------------------------------------------------
&gt; &gt;&gt; ---
&gt; &gt;&gt;
&gt; &gt;
&gt; &gt; ---------------------------------------------------------------------
&gt; &gt; To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
&gt; &gt; For additional commands, e-mail: j-users-help@xerces.apache.org
&gt; &gt;
&gt;
&gt;
&gt; ---------------------------------------------------------------------
&gt; To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
&gt; For additional commands, e-mail: j-users-help@xerces.apache.org

</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Loosing significant space in LSSerializer</title>
<author><name>Dick Deneer &lt;dick.deneer@donkeydevelopment.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200911.mbox/%3c4CCD4C3B-32AF-4D98-8C38-502AAA9DD88B@donkeydevelopment.com%3e"/>
<id>urn:uuid:%3c4CCD4C3B-32AF-4D98-8C38-502AAA9DD88B@donkeydevelopment-com%3e</id>
<updated>2009-11-21T18:19:27Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Hi Jake,


I just tried your suggestion and the spaces are indeed preserved.
But still, I woud prefer another solution. I do not have any clue  
about the xml (I use xerces in a xml editor) and I do not want to  
change the xml.
And also I would like to stay with the LSSerializer (it also  
serilalizes doctype nodes).
If there is another way please let me know.

Thanks
Dick Deneer



Op 21-nov-2009, om 19:03 heeft Jacob Kjome het volgende geschreven:

&gt; Have you tried xml:space="preserve"?
&gt;
&gt; Jake
&gt;
&gt; On 11/20/2009 4:36 PM, Dick Deneer wrote:
&gt;&gt; I am still using the deprecated LSSerializer because the xalan
&gt;&gt; serializer has issues with the pretty print.
&gt;&gt; But when I have simple elements with only space, the serializer  
&gt;&gt; produces
&gt;&gt; empty elements. Is there a tweak to keep the spaces in this elements?
&gt;&gt;
&gt;&gt; Sample xml:
&gt;&gt; &lt;root&gt;&lt;child1&gt;text&lt;/child1&gt;&lt;child2&gt; &lt;/child2&gt;&lt;/root&gt;
&gt;&gt; I attached a simple test program, that you can just run to see the  
&gt;&gt; results:
&gt;&gt;
&gt;&gt; Program started
&gt;&gt; Xerces serializer will be used
&gt;&gt; &lt;?xml version="1.0" encoding="UTF-16"?&gt;
&gt;&gt; &lt;root&gt;
&gt;&gt; &lt;child1&gt;text&lt;/child1&gt;
&gt;&gt; &lt;child2/&gt;
&gt;&gt; &lt;/root&gt;
&gt;&gt;
&gt;&gt; Xalan serializer will be used
&gt;&gt; &lt;?xml version="1.0" encoding="UTF-16"?&gt;&lt;root&gt;
&gt;&gt; &lt;child1&gt;text&lt;/child1&gt;
&gt;&gt; &lt;child2&gt; &lt;/child2&gt;
&gt;&gt; &lt;/root&gt;
&gt;&gt;
&gt;&gt; Regards
&gt;&gt; Dick Deneer
&gt;&gt;
&gt;&gt; --------------------------------------------------------------------- 
&gt;&gt; ---
&gt;&gt;
&gt;
&gt; ---------------------------------------------------------------------
&gt; To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
&gt; For additional commands, e-mail: j-users-help@xerces.apache.org
&gt;


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Loosing significant space in LSSerializer</title>
<author><name>Jacob Kjome &lt;hoju@visi.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200911.mbox/%3c4B082B71.2090307@visi.com%3e"/>
<id>urn:uuid:%3c4B082B71-2090307@visi-com%3e</id>
<updated>2009-11-21T18:03:29Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Have you tried xml:space="preserve"?

Jake

On 11/20/2009 4:36 PM, Dick Deneer wrote:
&gt; I am still using the deprecated LSSerializer because the xalan
&gt; serializer has issues with the pretty print.
&gt; But when I have simple elements with only space, the serializer produces
&gt; empty elements. Is there a tweak to keep the spaces in this elements?
&gt;
&gt; Sample xml:
&gt; &lt;root&gt;&lt;child1&gt;text&lt;/child1&gt;&lt;child2&gt; &lt;/child2&gt;&lt;/root&gt;
&gt; I attached a simple test program, that you can just run to see the results:
&gt;
&gt; Program started
&gt; Xerces serializer will be used
&gt; &lt;?xml version="1.0" encoding="UTF-16"?&gt;
&gt; &lt;root&gt;
&gt; &lt;child1&gt;text&lt;/child1&gt;
&gt; &lt;child2/&gt;
&gt; &lt;/root&gt;
&gt;
&gt; Xalan serializer will be used
&gt; &lt;?xml version="1.0" encoding="UTF-16"?&gt;&lt;root&gt;
&gt; &lt;child1&gt;text&lt;/child1&gt;
&gt; &lt;child2&gt; &lt;/child2&gt;
&gt; &lt;/root&gt;
&gt;
&gt; Regards
&gt; Dick Deneer
&gt;
&gt; ------------------------------------------------------------------------
&gt;

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Loosing significant space in LSSerializer</title>
<author><name>Dick Deneer &lt;dick.deneer@donkeydevelopment.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200911.mbox/%3c45DAB5D0-C20E-4E3D-B1B9-0ED7E48D774D@donkeydevelopment.com%3e"/>
<id>urn:uuid:%3c45DAB5D0-C20E-4E3D-B1B9-0ED7E48D774D@donkeydevelopment-com%3e</id>
<updated>2009-11-20T22:36:36Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
I am still using the deprecated LSSerializer  because the xalan  
serializer has issues with the pretty print.
But when I have simple elements with only space, the serializer  
produces empty elements. Is there a tweak to keep the spaces in this  
elements?

Sample xml:
&lt;root&gt;&lt;child1&gt;text&lt;/child1&gt;&lt;child2&gt;   &lt;/child2&gt;&lt;/root&gt;
I attached a simple test program, that you can just run to see the  
results:

Program started
Xerces serializer will be used
&lt;?xml version="1.0" encoding="UTF-16"?&gt;
&lt;root&gt;
     &lt;child1&gt;text&lt;/child1&gt;
     &lt;child2/&gt;
&lt;/root&gt;

Xalan serializer will be used
&lt;?xml version="1.0" encoding="UTF-16"?&gt;&lt;root&gt;
    &lt;child1&gt;text&lt;/child1&gt;
    &lt;child2&gt;   &lt;/child2&gt;
&lt;/root&gt;

Regards
Dick Deneerï¿¼

</pre>
</div>
</content>
</entry>
<entry>
<title>Re: xs:any namespace resolution</title>
<author><name>Michael Glavassevich &lt;mrglavas@ca.ibm.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200911.mbox/%3cOF65E3570F.7D5A61E0-ON85257673.00615001-85257673.007770B2@ca.ibm.com%3e"/>
<id>urn:uuid:%3cOF65E3570F-7D5A61E0-ON85257673-00615001-85257673-007770B2@ca-ibm-com%3e</id>
<updated>2009-11-19T21:44:19Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Content-type: text/plain; charset=ISO-8859-1
Content-transfer-encoding: quoted-printable


Ajay,

If you want schemas to be dynamically loaded by the validator you need =
to
use the SchemaFactory.newSchema() method [1] (the one with no parameter=
s).
JAXP doesn't let you mix that with pre-loading of schemas. See [2][3] i=
n
the mailing list archives for more details.

Thanks.

[1]
http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/validation/Sc=
hemaFactory.html#newSchema
()
[2] http://markmail.org/message/5xe4u5njgxkiosk7
[3] http://markmail.org/message/4nhwp7ggi6fytqfg

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

ajay bhadauria &lt;abhadauria@yahoo.com&gt; wrote on 11/19/2009 12:25:17 PM:

&gt; Michael,
&gt;
&gt; Sorry. I was over excited. I was doing the same way as you suggested
&gt; but my LSResourceResolver is not getting called which means that I
&gt; am missing something which I am not aware of it.
&gt;
&gt; The Test2.xml which I attached in the previous mail, the tag
&gt; "ns1:Document" contains namespace xmlns:ns1=3D"urn:swift:xsd:$xtsn.
&gt; 998.001.01" which is on the 2.xsd.
&gt;
&gt; Please find the attached Code where I set LSresourceResolver to
Validator.
&gt;
&gt; Thanks
&gt; Ajay
&gt; --- On Thu, 11/19/09, Michael Glavassevich &lt;mrglavas@ca.ibm.com&gt; wrot=
e:
&gt;
&gt; &gt; From: Michael Glavassevich &lt;mrglavas@ca.ibm.com&gt;
&gt; &gt; Subject: Re: xs:any namespace resolution
&gt; &gt; To: j-users@xerces.apache.org
&gt; &gt; Date: Thursday, November 19, 2009, 8:32 PM
&gt; &gt;
&gt; &gt; (Ajay, patience. In the future, please don't
&gt; &gt; post the same message over and over again to the list. We
&gt; &gt; heard you the first time.)
&gt; &gt;
&gt; &gt;
&gt; &gt;
&gt; &gt; Try writing an LSResourceResolver (which you would
&gt; &gt; register with the validator) and have that return the 2nd
&gt; &gt; schema document on the request with its target
&gt; &gt; namespace.
&gt; &gt;
&gt; &gt;
&gt; &gt;
&gt; &gt; Thanks.
&gt; &gt;
&gt; &gt;
&gt; &gt;
&gt; &gt; Michael Glavassevich
&gt; &gt;
&gt; &gt; XML Parser Development
&gt; &gt;
&gt; &gt; IBM Toronto Lab
&gt; &gt;
&gt; &gt; E-mail: mrglavas@ca.ibm.com
&gt; &gt;
&gt; &gt; E-mail: mrglavas@apache.org
&gt; &gt;
&gt; &gt;
&gt; &gt;
&gt; &gt; ajay bhadauria &lt;abhadauria@yahoo.com&gt; wrote on
&gt; &gt; 11/19/2009 09:15:03 AM:
&gt; &gt;
&gt; &gt;
&gt; &gt;
&gt; &gt; &gt; Hi,
&gt; &gt;
&gt; &gt; &gt;
&gt; &gt;
&gt; &gt; &gt; I do knot know much about xs:any construct and I
&gt; &gt; =A0am new to this and
&gt; &gt;
&gt; &gt; &gt; I read it but I do not know how I can tell the
&gt; &gt; validator to use
&gt; &gt;
&gt; &gt; &gt; namespace (only runtime) which is defined in the
&gt; &gt; different schema.
&gt; &gt;
&gt; &gt; &gt;
&gt; &gt;
&gt; &gt; &gt; Using
&gt; &gt;
&gt; &gt; &gt; &lt;xs:any
&gt; &gt;
&gt; &gt; &gt; &gt; =A0namespace=3D"##any"
&gt; &gt; processContents=3D"strict"/&gt; construct,
&gt; &gt;
&gt; &gt; &gt;
&gt; &gt;
&gt; &gt; &gt; I am vlidating xml instance with Validator which has a
&gt; &gt; main schema
&gt; &gt;
&gt; &gt; &gt; but validator does not know second schema.
&gt; &gt;
&gt; &gt; &gt;
&gt; &gt;
&gt; &gt; &gt; Now, =A0how I can tell the validator during
&gt; &gt; validation time about the
&gt; &gt;
&gt; &gt; &gt; second schema to which some elements belong to the
&gt; &gt; namespace which
&gt; &gt;
&gt; &gt; &gt; is defined in the second schema.
&gt; &gt;
&gt; &gt; &gt;
&gt; &gt;
&gt; &gt; &gt; Thanks
&gt; &gt;
&gt; &gt; &gt; ajay
&gt; &gt;
&gt; &gt; &gt;
&gt; &gt;
&gt; &gt; &gt; --- On Thu, 11/19/09, ajay bhadauria
&gt; &gt; &lt;abhadauria@yahoo.com&gt; wrote:
&gt; &gt;
&gt; &gt; &gt;
&gt; &gt;
&gt; &gt; &gt; &gt; From: ajay bhadauria
&gt; &gt; &lt;abhadauria@yahoo.com&gt;
&gt; &gt;
&gt; &gt; &gt; &gt; Subject: Re: xs:any namespace resolution
&gt; &gt;
&gt; &gt; &gt; &gt; To: j-users@xerces.apache.org
&gt; &gt;
&gt; &gt; &gt; &gt; Date: Thursday, November 19, 2009, 6:38 AM
&gt; &gt;
&gt; &gt; &gt; &gt; Hi,
&gt; &gt;
&gt; &gt; &gt; &gt;
&gt; &gt;
&gt; &gt; &gt; &gt; I am using &lt;xs:any
&gt; &gt;
&gt; &gt; &gt; &gt; &gt; namespace=3D"##any"
&gt; &gt; processContents=3D"strict"/&gt; and I
&gt; &gt;
&gt; &gt; &gt; &gt; am validating xml instance which is having
&gt; &gt; elements which
&gt; &gt;
&gt; &gt; &gt; &gt; belong to the different namespace and
&gt; &gt; corresponding to this
&gt; &gt;
&gt; &gt; &gt; &gt; namespace, schema is not pre-loaded. I mean yhat
&gt; &gt; external
&gt; &gt;
&gt; &gt; &gt; &gt; schema is not pre-loaded.
&gt; &gt;
&gt; &gt; &gt; &gt;
&gt; &gt;
&gt; &gt; &gt; &gt; How do I tell Java Validator about this external
&gt; &gt; schema so
&gt; &gt;
&gt; &gt; &gt; &gt; that xml instance is validated successfully ?
&gt; &gt;
&gt; &gt; &gt; &gt;
&gt; &gt;
&gt; &gt; &gt; &gt;
&gt; &gt;
&gt; &gt; &gt; &gt; Is there any way I can tell the validator at the
&gt; &gt; time of
&gt; &gt;
&gt; &gt; &gt; &gt; validation only about external schema which is
&gt; &gt; not
&gt; &gt;
&gt; &gt; &gt; &gt; pre-loaded with main schema?
&gt; &gt;
&gt; &gt; &gt; &gt;
&gt; &gt;
&gt; &gt; &gt; &gt; Help me in understanding whether it can be done
&gt; &gt; ???
&gt; &gt;
&gt; &gt; &gt; &gt; Thanks
&gt; &gt;
&gt; &gt; &gt; &gt; Ajay
&gt; &gt;
&gt; &gt; &gt; &gt;
&gt; &gt;
&gt; &gt; &gt; &gt; --- On Thu, 11/19/09, ajay bhadauria
&gt; &gt; &lt;abhadauria@yahoo.com&gt;
&gt; &gt;
&gt; &gt; &gt; &gt; wrote:
&gt; &gt;
&gt; &gt; &gt; &gt;
&gt; &gt;
&gt; &gt; &gt; &gt; &gt; From: ajay bhadauria
&gt; &gt; &lt;abhadauria@yahoo.com&gt;
&gt; &gt;
&gt; &gt; &gt; &gt; &gt; Subject: xs:any namespace resolution
&gt; &gt;
&gt; &gt; &gt; &gt; &gt; To: j-users@xerces.apache.org
&gt; &gt;
&gt; &gt; &gt; &gt; &gt; Date: Thursday, November 19, 2009, 12:48 AM
&gt; &gt;
&gt; &gt; &gt; &gt; &gt; Hi,
&gt; &gt;
&gt; &gt; &gt; &gt; &gt;
&gt; &gt;
&gt; &gt; &gt; &gt; &gt; I have schema file 1.xsd which has xs:any
&gt; &gt; schema
&gt; &gt;
&gt; &gt; &gt; &gt; construct
&gt; &gt;
&gt; &gt; &gt; &gt; &gt;
&gt; &gt;
&gt; &gt; &gt; &gt; &gt; &lt;xs:complexType
&gt; &gt; name=3D"ExtensionEnvelope"&gt;
&gt; &gt;
&gt; &gt; &gt; &gt; &gt;
&gt; &gt;
&gt; &gt; &gt; &gt; =A0=A0=A0&lt;xs:sequence&gt;
&gt; &gt;
&gt; &gt; &gt; &gt; &gt;
&gt; &gt;
&gt; &gt; &gt; &gt; =A0=A0=A0&lt;xs:any
&gt; &gt;
&gt; &gt; &gt; &gt; &gt; namespace=3D"##any"
&gt; &gt; processContents=3D"strict"/&gt;
&gt; &gt;
&gt; &gt; &gt; &gt; &gt;
&gt; &gt;
&gt; &gt; &gt; &gt; =A0=A0=A0&lt;/xs:sequence&gt;
&gt; &gt;
&gt; &gt; &gt; &gt; &gt;=A0 =A0=A0=A0&lt;/xs:complexType&gt;
&gt; &gt;
&gt; &gt; &gt; &gt; &gt;
&gt; &gt;
&gt; &gt; &gt; &gt; &gt; And I try to validate xml instance (
&gt; &gt; test2.xml )
&gt; &gt;
&gt; &gt; &gt; &gt; against
&gt; &gt;
&gt; &gt; &gt; &gt; &gt; this schema, it gave the following error
&gt; &gt;
&gt; &gt; &gt; &gt; &gt;=A0 =A0 =A0 cvc-complex-type.2.4.c: The
&gt; &gt;
&gt; &gt; &gt; &gt; &gt; matching wildcard is strict, but no
&gt; &gt; declaration can be
&gt; &gt;
&gt; &gt; &gt; &gt; found
&gt; &gt;
&gt; &gt; &gt; &gt; &gt; for element 'ns1:Document'.
&gt; &gt;
&gt; &gt; &gt; &gt; &gt;
&gt; &gt;
&gt; &gt; &gt; &gt; &gt; However, the namespace which the Validator
&gt; &gt; is looking
&gt; &gt;
&gt; &gt; &gt; &gt; for
&gt; &gt;
&gt; &gt; &gt; &gt; &gt; is in other xsd file (2.xsd).
&gt; &gt;
&gt; &gt; &gt; &gt; &gt;
&gt; &gt;
&gt; &gt; &gt; &gt; &gt; How do I tell Validator the location of
&gt; &gt; 2.xsd file
&gt; &gt;
&gt; &gt; &gt; &gt; during
&gt; &gt;
&gt; &gt; &gt; &gt; &gt; validation ?
&gt; &gt;
&gt; &gt; &gt; &gt; &gt;
&gt; &gt;
&gt; &gt; &gt; &gt; &gt; The test.xml has some elements which belong
&gt; &gt; to the
&gt; &gt;
&gt; &gt; &gt; &gt; &gt; namespace urn:swift:xsd:$xtsn.998.001.01
&gt; &gt; which is
&gt; &gt;
&gt; &gt; &gt; &gt; defined in
&gt; &gt;
&gt; &gt; &gt; &gt; &gt; the 2.xsd file.
&gt; &gt;
&gt; &gt; &gt; &gt; &gt;
&gt; &gt;
&gt; &gt; &gt; &gt; &gt;
&gt; &gt;
&gt; &gt; &gt; &gt; &gt;
&gt; &gt;
&gt; &gt; &gt; &gt; &gt;
&gt; &gt;
&gt; &gt; &gt; &gt;
&gt; &gt; -------------------------------------------------------------------=
--
&gt; &gt;
&gt; &gt; &gt; &gt; &gt; To unsubscribe, e-mail:
&gt; &gt; j-users-unsubscribe@xerces.apache.org
&gt; &gt;
&gt; &gt; &gt; &gt; &gt; For additional commands, e-mail:
&gt; &gt; j-users-help@xerces.apache.org
&gt; &gt;
&gt; &gt; &gt; &gt;
&gt; &gt;
&gt; &gt; &gt; &gt;
&gt; &gt;
&gt; &gt; &gt; &gt;
&gt; &gt;
&gt; &gt; &gt; &gt;
&gt; &gt;
&gt; &gt; &gt; &gt;
&gt; &gt; -------------------------------------------------------------------=
--
&gt; &gt;
&gt; &gt; &gt; &gt; To unsubscribe, e-mail:
&gt; &gt; j-users-unsubscribe@xerces.apache.org
&gt; &gt;
&gt; &gt; &gt; &gt; For additional commands, e-mail:
&gt; &gt; j-users-help@xerces.apache.org
&gt; &gt;
&gt; &gt; &gt;
&gt; &gt;
&gt; &gt; &gt;
&gt; &gt;
&gt; &gt; &gt;
&gt; &gt; -------------------------------------------------------------------=
--
&gt; &gt;
&gt; &gt; &gt; To unsubscribe, e-mail:
&gt; &gt; j-users-unsubscribe@xerces.apache.org
&gt; &gt;
&gt; &gt; &gt; For additional commands, e-mail:
&gt; &gt; j-users-help@xerces.apache.org
&gt; &gt;
&gt; &gt;
&gt;
&gt;
&gt;       [attachment "SchemaReader.java" deleted by Michael
&gt; Glavassevich/Toronto/IBM]
&gt; ---------------------------------------------------------------------=

&gt; To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
&gt; For additional commands, e-mail: j-users-help@xerces.apache.org=


</pre>
</div>
</content>
</entry>
<entry>
<title>Re: xs:any namespace resolution</title>
<author><name>ajay bhadauria &lt;abhadauria@yahoo.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200911.mbox/%3c817568.79294.qm@web111511.mail.gq1.yahoo.com%3e"/>
<id>urn:uuid:%3c817568-79294-qm@web111511-mail-gq1-yahoo-com%3e</id>
<updated>2009-11-19T17:25:17Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Michael,

Sorry. I was over excited. I was doing the same way as you suggested but my LSResourceResolver
is not getting called which means that I am missing something which I am not aware of it.


The Test2.xml which I attached in the previous mail, the tag "ns1:Document" contains namespace
xmlns:ns1="urn:swift:xsd:$xtsn.998.001.01" which is on the 2.xsd.

Please find the attached Code where I set LSresourceResolver to Validator.

Thanks
Ajay 
--- On Thu, 11/19/09, Michael Glavassevich &lt;mrglavas@ca.ibm.com&gt; wrote:

&gt; From: Michael Glavassevich &lt;mrglavas@ca.ibm.com&gt;
&gt; Subject: Re: xs:any namespace resolution
&gt; To: j-users@xerces.apache.org
&gt; Date: Thursday, November 19, 2009, 8:32 PM
&gt; 
&gt; (Ajay, patience. In the future, please don't
&gt; post the same message over and over again to the list. We
&gt; heard you the first time.)
&gt; 
&gt; 
&gt; 
&gt; Try writing an LSResourceResolver (which you would
&gt; register with the validator) and have that return the 2nd
&gt; schema document on the request with its target
&gt; namespace.
&gt; 
&gt; 
&gt; 
&gt; Thanks.
&gt; 
&gt; 
&gt; 
&gt; Michael Glavassevich
&gt; 
&gt; XML Parser Development
&gt; 
&gt; IBM Toronto Lab
&gt; 
&gt; E-mail: mrglavas@ca.ibm.com
&gt; 
&gt; E-mail: mrglavas@apache.org
&gt; 
&gt; 
&gt; 
&gt; ajay bhadauria &lt;abhadauria@yahoo.com&gt; wrote on
&gt; 11/19/2009 09:15:03 AM:
&gt; 
&gt; 
&gt; 
&gt; &gt; Hi,
&gt; 
&gt; &gt; 
&gt; 
&gt; &gt; I do knot know much about xs:any construct and I
&gt;  am new to this and
&gt; 
&gt; &gt; I read it but I do not know how I can tell the
&gt; validator to use 
&gt; 
&gt; &gt; namespace (only runtime) which is defined in the
&gt; different schema.
&gt; 
&gt; &gt;  
&gt; 
&gt; &gt; Using  
&gt; 
&gt; &gt; &lt;xs:any
&gt; 
&gt; &gt; &gt;  namespace="##any"
&gt; processContents="strict"/&gt; construct, 
&gt; 
&gt; &gt; 
&gt; 
&gt; &gt; I am vlidating xml instance with Validator which has a
&gt; main schema 
&gt; 
&gt; &gt; but validator does not know second schema.  
&gt; 
&gt; &gt; 
&gt; 
&gt; &gt; Now,  how I can tell the validator during
&gt; validation time about the 
&gt; 
&gt; &gt; second schema to which some elements belong to the
&gt; namespace which 
&gt; 
&gt; &gt; is defined in the second schema.   
&gt; 
&gt; &gt; 
&gt; 
&gt; &gt; Thanks
&gt; 
&gt; &gt; ajay
&gt; 
&gt; &gt; 
&gt; 
&gt; &gt; --- On Thu, 11/19/09, ajay bhadauria
&gt; &lt;abhadauria@yahoo.com&gt; wrote:
&gt; 
&gt; &gt; 
&gt; 
&gt; &gt; &gt; From: ajay bhadauria
&gt; &lt;abhadauria@yahoo.com&gt;
&gt; 
&gt; &gt; &gt; Subject: Re: xs:any namespace resolution
&gt; 
&gt; &gt; &gt; To: j-users@xerces.apache.org
&gt; 
&gt; &gt; &gt; Date: Thursday, November 19, 2009, 6:38 AM
&gt; 
&gt; &gt; &gt; Hi,
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; I am using &lt;xs:any
&gt; 
&gt; &gt; &gt; &gt; namespace="##any"
&gt; processContents="strict"/&gt; and I
&gt; 
&gt; &gt; &gt; am validating xml instance which is having
&gt; elements which
&gt; 
&gt; &gt; &gt; belong to the different namespace and
&gt; corresponding to this
&gt; 
&gt; &gt; &gt; namespace, schema is not pre-loaded. I mean yhat
&gt; external
&gt; 
&gt; &gt; &gt; schema is not pre-loaded.
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; How do I tell Java Validator about this external
&gt; schema so
&gt; 
&gt; &gt; &gt; that xml instance is validated successfully ?
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; Is there any way I can tell the validator at the
&gt; time of
&gt; 
&gt; &gt; &gt; validation only about external schema which is
&gt; not
&gt; 
&gt; &gt; &gt; pre-loaded with main schema?
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; Help me in understanding whether it can be done
&gt; ???
&gt; 
&gt; &gt; &gt; Thanks
&gt; 
&gt; &gt; &gt; Ajay 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; --- On Thu, 11/19/09, ajay bhadauria
&gt; &lt;abhadauria@yahoo.com&gt;
&gt; 
&gt; &gt; &gt; wrote:
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; From: ajay bhadauria
&gt; &lt;abhadauria@yahoo.com&gt;
&gt; 
&gt; &gt; &gt; &gt; Subject: xs:any namespace resolution
&gt; 
&gt; &gt; &gt; &gt; To: j-users@xerces.apache.org
&gt; 
&gt; &gt; &gt; &gt; Date: Thursday, November 19, 2009, 12:48 AM
&gt; 
&gt; &gt; &gt; &gt; Hi,
&gt; 
&gt; &gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; I have schema file 1.xsd which has xs:any
&gt; schema
&gt; 
&gt; &gt; &gt; construct
&gt; 
&gt; &gt; &gt; &gt;  
&gt; 
&gt; &gt; &gt; &gt; &lt;xs:complexType
&gt; name="ExtensionEnvelope"&gt;
&gt; 
&gt; &gt; &gt; &gt;     
&gt; 
&gt; &gt; &gt;    &lt;xs:sequence&gt;
&gt; 
&gt; &gt; &gt; &gt;         
&gt; 
&gt; &gt; &gt;    &lt;xs:any
&gt; 
&gt; &gt; &gt; &gt; namespace="##any"
&gt; processContents="strict"/&gt;
&gt; 
&gt; &gt; &gt; &gt;     
&gt; 
&gt; &gt; &gt;    &lt;/xs:sequence&gt;
&gt; 
&gt; &gt; &gt; &gt;     &lt;/xs:complexType&gt;
&gt; 
&gt; &gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; And I try to validate xml instance (
&gt; test2.xml )
&gt; 
&gt; &gt; &gt; against
&gt; 
&gt; &gt; &gt; &gt; this schema, it gave the following error
&gt; 
&gt; &gt; &gt; &gt;      cvc-complex-type.2.4.c: The
&gt; 
&gt; &gt; &gt; &gt; matching wildcard is strict, but no
&gt; declaration can be
&gt; 
&gt; &gt; &gt; found
&gt; 
&gt; &gt; &gt; &gt; for element 'ns1:Document'.
&gt; 
&gt; &gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; However, the namespace which the Validator
&gt; is looking
&gt; 
&gt; &gt; &gt; for
&gt; 
&gt; &gt; &gt; &gt; is in other xsd file (2.xsd). 
&gt; 
&gt; &gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; How do I tell Validator the location of
&gt; 2.xsd file
&gt; 
&gt; &gt; &gt; during
&gt; 
&gt; &gt; &gt; &gt; validation ? 
&gt; 
&gt; &gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; The test.xml has some elements which belong
&gt; to the
&gt; 
&gt; &gt; &gt; &gt; namespace urn:swift:xsd:$xtsn.998.001.01
&gt; which is
&gt; 
&gt; &gt; &gt; defined in
&gt; 
&gt; &gt; &gt; &gt; the 2.xsd file.
&gt; 
&gt; &gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; &gt;       
&gt; 
&gt; &gt; &gt; &gt;
&gt; 
&gt; &gt; &gt;
&gt; ---------------------------------------------------------------------
&gt; 
&gt; &gt; &gt; &gt; To unsubscribe, e-mail:
&gt; j-users-unsubscribe@xerces.apache.org
&gt; 
&gt; &gt; &gt; &gt; For additional commands, e-mail:
&gt; j-users-help@xerces.apache.org
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt;       
&gt; 
&gt; &gt; &gt; 
&gt; 
&gt; &gt; &gt;
&gt; ---------------------------------------------------------------------
&gt; 
&gt; &gt; &gt; To unsubscribe, e-mail:
&gt; j-users-unsubscribe@xerces.apache.org
&gt; 
&gt; &gt; &gt; For additional commands, e-mail:
&gt; j-users-help@xerces.apache.org
&gt; 
&gt; &gt;       
&gt; 
&gt; &gt; 
&gt; 
&gt; &gt;
&gt; ---------------------------------------------------------------------
&gt; 
&gt; &gt; To unsubscribe, e-mail:
&gt; j-users-unsubscribe@xerces.apache.org
&gt; 
&gt; &gt; For additional commands, e-mail:
&gt; j-users-help@xerces.apache.org
&gt; 
&gt;


      

</pre>
</div>
</content>
</entry>
<entry>
<title>Re: xs:any namespace resolution</title>
<author><name>Michael Glavassevich &lt;mrglavas@ca.ibm.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200911.mbox/%3cOFD3A5C0B5.32985991-ON85257673.0051C79F-85257673.0052AD6F@ca.ibm.com%3e"/>
<id>urn:uuid:%3cOFD3A5C0B5-32985991-ON85257673-0051C79F-85257673-0052AD6F@ca-ibm-com%3e</id>
<updated>2009-11-19T15:02:46Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Content-type: text/plain; charset=ISO-8859-1
Content-transfer-encoding: quoted-printable


(Ajay, patience. In the future, please don't post the same message over=
 and
over again to the list. We heard you the first time.)

Try writing an LSResourceResolver (which you would register with the
validator) and have that return the 2nd schema document on the request =
with
its target namespace.

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

ajay bhadauria &lt;abhadauria@yahoo.com&gt; wrote on 11/19/2009 09:15:03 AM:

&gt; Hi,
&gt;
&gt; I do knot know much about xs:any construct and I  am new to this and
&gt; I read it but I do not know how I can tell the validator to use
&gt; namespace (only runtime) which is defined in the different schema.
&gt;
&gt; Using
&gt; &lt;xs:any
&gt; &gt;  namespace=3D"##any" processContents=3D"strict"/&gt; construct,
&gt;
&gt; I am vlidating xml instance with Validator which has a main schema
&gt; but validator does not know second schema.
&gt;
&gt; Now,  how I can tell the validator during validation time about the
&gt; second schema to which some elements belong to the namespace which
&gt; is defined in the second schema.
&gt;
&gt; Thanks
&gt; ajay
&gt;
&gt; --- On Thu, 11/19/09, ajay bhadauria &lt;abhadauria@yahoo.com&gt; wrote:
&gt;
&gt; &gt; From: ajay bhadauria &lt;abhadauria@yahoo.com&gt;
&gt; &gt; Subject: Re: xs:any namespace resolution
&gt; &gt; To: j-users@xerces.apache.org
&gt; &gt; Date: Thursday, November 19, 2009, 6:38 AM
&gt; &gt; Hi,
&gt; &gt;
&gt; &gt; I am using &lt;xs:any
&gt; &gt; &gt; namespace=3D"##any" processContents=3D"strict"/&gt; and I
&gt; &gt; am validating xml instance which is having elements which
&gt; &gt; belong to the different namespace and corresponding to this
&gt; &gt; namespace, schema is not pre-loaded. I mean yhat external
&gt; &gt; schema is not pre-loaded.
&gt; &gt;
&gt; &gt; How do I tell Java Validator about this external schema so
&gt; &gt; that xml instance is validated successfully ?
&gt; &gt;
&gt; &gt;
&gt; &gt; Is there any way I can tell the validator at the time of
&gt; &gt; validation only about external schema which is not
&gt; &gt; pre-loaded with main schema?
&gt; &gt;
&gt; &gt; Help me in understanding whether it can be done ???
&gt; &gt; Thanks
&gt; &gt; Ajay
&gt; &gt;
&gt; &gt; --- On Thu, 11/19/09, ajay bhadauria &lt;abhadauria@yahoo.com&gt;
&gt; &gt; wrote:
&gt; &gt;
&gt; &gt; &gt; From: ajay bhadauria &lt;abhadauria@yahoo.com&gt;
&gt; &gt; &gt; Subject: xs:any namespace resolution
&gt; &gt; &gt; To: j-users@xerces.apache.org
&gt; &gt; &gt; Date: Thursday, November 19, 2009, 12:48 AM
&gt; &gt; &gt; Hi,
&gt; &gt; &gt;
&gt; &gt; &gt; I have schema file 1.xsd which has xs:any schema
&gt; &gt; construct
&gt; &gt; &gt;
&gt; &gt; &gt; &lt;xs:complexType name=3D"ExtensionEnvelope"&gt;
&gt; &gt; &gt;
&gt; &gt; =A0=A0=A0&lt;xs:sequence&gt;
&gt; &gt; &gt;
&gt; &gt; =A0=A0=A0&lt;xs:any
&gt; &gt; &gt; namespace=3D"##any" processContents=3D"strict"/&gt;
&gt; &gt; &gt;
&gt; &gt; =A0=A0=A0&lt;/xs:sequence&gt;
&gt; &gt; &gt;=A0 =A0=A0=A0&lt;/xs:complexType&gt;
&gt; &gt; &gt;
&gt; &gt; &gt; And I try to validate xml instance ( test2.xml )
&gt; &gt; against
&gt; &gt; &gt; this schema, it gave the following error
&gt; &gt; &gt;=A0 =A0 =A0 cvc-complex-type.2.4.c: The
&gt; &gt; &gt; matching wildcard is strict, but no declaration can be
&gt; &gt; found
&gt; &gt; &gt; for element 'ns1:Document'.
&gt; &gt; &gt;
&gt; &gt; &gt; However, the namespace which the Validator is looking
&gt; &gt; for
&gt; &gt; &gt; is in other xsd file (2.xsd).
&gt; &gt; &gt;
&gt; &gt; &gt; How do I tell Validator the location of 2.xsd file
&gt; &gt; during
&gt; &gt; &gt; validation ?
&gt; &gt; &gt;
&gt; &gt; &gt; The test.xml has some elements which belong to the
&gt; &gt; &gt; namespace urn:swift:xsd:$xtsn.998.001.01 which is
&gt; &gt; defined in
&gt; &gt; &gt; the 2.xsd file.
&gt; &gt; &gt;
&gt; &gt; &gt;
&gt; &gt; &gt;
&gt; &gt; &gt;
&gt; &gt; -------------------------------------------------------------------=
--
&gt; &gt; &gt; To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
&gt; &gt; &gt; For additional commands, e-mail: j-users-help@xerces.apache.org
&gt; &gt;
&gt; &gt;
&gt; &gt;
&gt; &gt;
&gt; &gt; -------------------------------------------------------------------=
--
&gt; &gt; To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
&gt; &gt; For additional commands, e-mail: j-users-help@xerces.apache.org
&gt;
&gt;
&gt; ---------------------------------------------------------------------=

&gt; To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
&gt; For additional commands, e-mail: j-users-help@xerces.apache.org=


</pre>
</div>
</content>
</entry>
<entry>
<title>Re: xs:any namespace resolution</title>
<author><name>ajay bhadauria &lt;abhadauria@yahoo.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200911.mbox/%3c144319.39589.qm@web111512.mail.gq1.yahoo.com%3e"/>
<id>urn:uuid:%3c144319-39589-qm@web111512-mail-gq1-yahoo-com%3e</id>
<updated>2009-11-19T14:15:03Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Hi,

I do knot know much about xs:any construct and I  am new to this and I read it but I do not
know how I can tell the validator to use namespace (only runtime) which is defined in the
different schema.
 
Using  
&lt;xs:any
&gt;  namespace="##any" processContents="strict"/&gt; construct, 

I am vlidating xml instance with Validator which has a main schema but validator does not
know second schema.  

Now,  how I can tell the validator during validation time about the second schema to which
some elements belong to the namespace which is defined in the second schema.   

Thanks
ajay

--- On Thu, 11/19/09, ajay bhadauria &lt;abhadauria@yahoo.com&gt; wrote:

&gt; From: ajay bhadauria &lt;abhadauria@yahoo.com&gt;
&gt; Subject: Re: xs:any namespace resolution
&gt; To: j-users@xerces.apache.org
&gt; Date: Thursday, November 19, 2009, 6:38 AM
&gt; Hi,
&gt; 
&gt; I am using &lt;xs:any
&gt; &gt; namespace="##any" processContents="strict"/&gt; and I
&gt; am validating xml instance which is having elements which
&gt; belong to the different namespace and corresponding to this
&gt; namespace, schema is not pre-loaded. I mean yhat external
&gt; schema is not pre-loaded.
&gt; 
&gt; How do I tell Java Validator about this external schema so
&gt; that xml instance is validated successfully ?
&gt; 
&gt; 
&gt; Is there any way I can tell the validator at the time of
&gt; validation only about external schema which is not
&gt; pre-loaded with main schema?
&gt; 
&gt; Help me in understanding whether it can be done ???
&gt; Thanks
&gt; Ajay 
&gt; 
&gt; --- On Thu, 11/19/09, ajay bhadauria &lt;abhadauria@yahoo.com&gt;
&gt; wrote:
&gt; 
&gt; &gt; From: ajay bhadauria &lt;abhadauria@yahoo.com&gt;
&gt; &gt; Subject: xs:any namespace resolution
&gt; &gt; To: j-users@xerces.apache.org
&gt; &gt; Date: Thursday, November 19, 2009, 12:48 AM
&gt; &gt; Hi,
&gt; &gt; 
&gt; &gt; I have schema file 1.xsd which has xs:any schema
&gt; construct
&gt; &gt;  
&gt; &gt; &lt;xs:complexType name="ExtensionEnvelope"&gt;
&gt; &gt;     
&gt;    &lt;xs:sequence&gt;
&gt; &gt;         
&gt;    &lt;xs:any
&gt; &gt; namespace="##any" processContents="strict"/&gt;
&gt; &gt;     
&gt;    &lt;/xs:sequence&gt;
&gt; &gt;     &lt;/xs:complexType&gt;
&gt; &gt; 
&gt; &gt; And I try to validate xml instance ( test2.xml )
&gt; against
&gt; &gt; this schema, it gave the following error
&gt; &gt;      cvc-complex-type.2.4.c: The
&gt; &gt; matching wildcard is strict, but no declaration can be
&gt; found
&gt; &gt; for element 'ns1:Document'.
&gt; &gt; 
&gt; &gt; However, the namespace which the Validator is looking
&gt; for
&gt; &gt; is in other xsd file (2.xsd). 
&gt; &gt; 
&gt; &gt; How do I tell Validator the location of 2.xsd file
&gt; during
&gt; &gt; validation ? 
&gt; &gt; 
&gt; &gt; The test.xml has some elements which belong to the
&gt; &gt; namespace urn:swift:xsd:$xtsn.998.001.01 which is
&gt; defined in
&gt; &gt; the 2.xsd file.
&gt; &gt; 
&gt; &gt; 
&gt; &gt;       
&gt; &gt;
&gt; ---------------------------------------------------------------------
&gt; &gt; To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
&gt; &gt; For additional commands, e-mail: j-users-help@xerces.apache.org
&gt; 
&gt; 
&gt;       
&gt; 
&gt; ---------------------------------------------------------------------
&gt; To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
&gt; For additional commands, e-mail: j-users-help@xerces.apache.org
&gt; 
&gt; 


      

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: xs:any namespace resolution</title>
<author><name>ajay bhadauria &lt;abhadauria@yahoo.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200911.mbox/%3c681174.21047.qm@web111507.mail.gq1.yahoo.com%3e"/>
<id>urn:uuid:%3c681174-21047-qm@web111507-mail-gq1-yahoo-com%3e</id>
<updated>2009-11-19T01:08:36Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Hi,

I am using &lt;xs:any
&gt; namespace="##any" processContents="strict"/&gt; and I am validating xml instance which
is having elements which belong to the different namespace and corresponding to this namespace,
schema is not pre-loaded. I mean yhat external schema is not pre-loaded.

How do I tell Java Validator about this external schema so that xml instance is validated
successfully ?


Is there any way I can tell the validator at the time of validation only about external schema
which is not pre-loaded with main schema?

Help me in understanding whether it can be done ???
Thanks
Ajay 

--- On Thu, 11/19/09, ajay bhadauria &lt;abhadauria@yahoo.com&gt; wrote:

&gt; From: ajay bhadauria &lt;abhadauria@yahoo.com&gt;
&gt; Subject: xs:any namespace resolution
&gt; To: j-users@xerces.apache.org
&gt; Date: Thursday, November 19, 2009, 12:48 AM
&gt; Hi,
&gt; 
&gt; I have schema file 1.xsd which has xs:any schema construct
&gt;  
&gt; &lt;xs:complexType name="ExtensionEnvelope"&gt;
&gt;         &lt;xs:sequence&gt;
&gt;             &lt;xs:any
&gt; namespace="##any" processContents="strict"/&gt;
&gt;         &lt;/xs:sequence&gt;
&gt;     &lt;/xs:complexType&gt;
&gt; 
&gt; And I try to validate xml instance ( test2.xml ) against
&gt; this schema, it gave the following error
&gt;      cvc-complex-type.2.4.c: The
&gt; matching wildcard is strict, but no declaration can be found
&gt; for element 'ns1:Document'.
&gt; 
&gt; However, the namespace which the Validator is looking for
&gt; is in other xsd file (2.xsd). 
&gt; 
&gt; How do I tell Validator the location of 2.xsd file during
&gt; validation ? 
&gt; 
&gt; The test.xml has some elements which belong to the
&gt; namespace urn:swift:xsd:$xtsn.998.001.01 which is defined in
&gt; the 2.xsd file.
&gt; 
&gt; 
&gt;       
&gt; ---------------------------------------------------------------------
&gt; To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
&gt; For additional commands, e-mail: j-users-help@xerces.apache.org


      

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: How to add new node to the document and attach it with its 	correct PSVI ?</title>
<author><name>Michael Glavassevich &lt;mrglavas@ca.ibm.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200911.mbox/%3cOF8060BBB7.9DEB3378-ON85257672.00746C82-85257672.0074F3BD@ca.ibm.com%3e"/>
<id>urn:uuid:%3cOF8060BBB7-9DEB3378-ON85257672-00746C82-85257672-0074F3BD@ca-ibm-com%3e</id>
<updated>2009-11-18T21:17:08Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Content-type: text/plain; charset=ISO-8859-1
Content-transfer-encoding: quoted-printable


You should be looking at the *source code* of the samples. They're
primarily meant to educate developers on how to use the APIs, not so mu=
ch
for direct consumption by your application.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Omar Hamed &lt;omhmmmk@gmail.com&gt; wrote on 11/18/2009 03:05:38 AM:

&gt; I have been searching the mailing list for the past two days with no
clue.
&gt; Regarding the samples, I don't understand it, like "java
&gt; jaxp.SourceValidator (options) ..." how could I use this in my code ?=
?
&gt;
&gt; Thanks in advance,,
&gt; Omar Hamed

&gt; On Sun, Nov 15, 2009 at 9:50 PM, Michael Glavassevich
&lt;mrglavas@ca.ibm.com
&gt; &gt; wrote:
&gt; Omar Hamed &lt;omhmmmk@gmail.com&gt; wrote on 11/15/2009 02:26:24 PM:
&gt;
&gt;
&gt; &gt; The JAXP samples will generate the data access classes and the bean=
s
&gt; &gt; that represent the grammar specified in the XSD, am I right ?
&gt;
&gt;
&gt; No. You must be thinking of *JAXB*. That's something entirely
&gt; different and not supported by Xerces.
&gt;
&gt; Please take a look at the samples and FAQs in the documentation. If
&gt; you're still not sure after reviewing that I suggest that you search
&gt; the mailing list archives [1] where you'll find many past
&gt; discussions on DOM and PSVI.
&gt;
&gt;
&gt; &gt; What I want to do is to get the PSVI dynamically while my
&gt; &gt; application is running.
&gt; &gt;
&gt; &gt; I hope it's clear now.

&gt; Thanks.
&gt;
&gt; [1] http://xerces-j-users.markmail.org/
&gt;
&gt;
&gt; Michael Glavassevich
&gt; XML Parser Development
&gt; IBM Toronto Lab
&gt; E-mail: mrglavas@ca.ibm.com
&gt; E-mail: mrglavas@apache.org=


</pre>
</div>
</content>
</entry>
<entry>
<title>xs:any namespace resolution</title>
<author><name>ajay bhadauria &lt;abhadauria@yahoo.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200911.mbox/%3c139662.23515.qm@web111502.mail.gq1.yahoo.com%3e"/>
<id>urn:uuid:%3c139662-23515-qm@web111502-mail-gq1-yahoo-com%3e</id>
<updated>2009-11-18T19:18:10Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Hi,

I have schema file 1.xsd which has xs:any schema construct
 
&lt;xs:complexType name="ExtensionEnvelope"&gt;
        &lt;xs:sequence&gt;
            &lt;xs:any namespace="##any" processContents="strict"/&gt;
        &lt;/xs:sequence&gt;
    &lt;/xs:complexType&gt;

And I try to validate xml instance ( test2.xml ) against this schema, it gave the following
error
     cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found
for element 'ns1:Document'.

However, the namespace which the Validator is looking for is in other xsd file (2.xsd). 

How do I tell Validator the location of 2.xsd file during validation ? 

The test.xml has some elements which belong to the namespace urn:swift:xsd:$xtsn.998.001.01
which is defined in the 2.xsd file.


      

</pre>
</div>
</content>
</entry>
<entry>
<title>Re: How to add new node to the document and attach it with its	correct PSVI ?</title>
<author><name>Omar Hamed &lt;omhmmmk@gmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200911.mbox/%3c7a8f50790911180005k21426338k2332bcf31cdfbd6b@mail.gmail.com%3e"/>
<id>urn:uuid:%3c7a8f50790911180005k21426338k2332bcf31cdfbd6b@mail-gmail-com%3e</id>
<updated>2009-11-18T08:05:38Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
I have been searching the mailing list for the past two days with no clue.
Regarding the samples, I don't understand it, like "java
jaxp.SourceValidator (options) ..." how could I use this in my code ??

Thanks in advance,
Omar Hamed

On Sun, Nov 15, 2009 at 9:50 PM, Michael Glavassevich
&lt;mrglavas@ca.ibm.com&gt;wrote:

&gt; Omar Hamed &lt;omhmmmk@gmail.com&gt; wrote on 11/15/2009 02:26:24 PM:
&gt;
&gt;
&gt; &gt; The JAXP samples will generate the data access classes and the beans
&gt; &gt; that represent the grammar specified in the XSD, am I right ?
&gt;
&gt;
&gt; No. You must be thinking of *JAXB*. That's something entirely different and
&gt; not supported by Xerces.
&gt;
&gt; Please take a look at the samples and FAQs in the documentation. If you're
&gt; still not sure after reviewing that I suggest that you search the mailing
&gt; list archives [1] where you'll find many past discussions on DOM and PSVI.
&gt;
&gt;
&gt; &gt; What I want to do is to get the PSVI dynamically while my
&gt; &gt; application is running.
&gt; &gt;
&gt; &gt; I hope it's clear now.
&gt;
&gt; Thanks.
&gt;
&gt; [1] http://xerces-j-users.markmail.org/
&gt;
&gt;
&gt; Michael Glavassevich
&gt; XML Parser Development
&gt; IBM Toronto Lab
&gt; E-mail: mrglavas@ca.ibm.com
&gt; E-mail: mrglavas@apache.org
&gt;
&gt;


-- 
0ÂµÂªÎ“


</pre>
</div>
</content>
</entry>
<entry>
<title>Can't get type of the newly added elements</title>
<author><name>Omar Hamed &lt;omhmmmk@gmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/xerces-j-users/200911.mbox/%3c7a8f50790911172357g298c2bd2vf94191c1bc5b0ac8@mail.gmail.com%3e"/>
<id>urn:uuid:%3c7a8f50790911172357g298c2bd2vf94191c1bc5b0ac8@mail-gmail-com%3e</id>
<updated>2009-11-18T07:57:18Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Hi,
     I have a problem that I can't re-parse the xml document after adding
nodes to it so that I can retrieve the new elements type.

here is the code:
public static void main(String[] args){

     DocumentBuilderFactory parserFactory =
DocumentBuilderFactory.newInstance();
     SchemaFactory factory =
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);

            Source schemaFile = new StreamSource(new File("test.xsd"));
            Schema schema = factory.newSchema(schemaFile);

            parserFactory.setSchema(schema);

            DocumentBuilder parser = parserFactory.newDocumentBuilder();
            Document document = parser.parse(new File("test.xml"));


            Node promoTag =
document.getElementsByTagName("promotion_period").item(0); // get element

            Element endElm = document.createElement("end_date");            //
add new element
            endElm.setTextContent("2007-05-10");
            promoTag.appendChild(endElm);

            ((Element)
document.getElementsByTagName("end_date").item(0)).getSchemaTypeInfo().getTypeName();
// [1] returns null
}

At point #1: I think I need something like re-parse or re-validate the
document so that I can attach the added node with its type.

I have the same issue if I'm working with the XERCES ElementPSVI.

I don't know what is missing or how can I do that.

Thanks in advance
Omar Mostafa


</pre>
</div>
</content>
</entry>
</feed>
