You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by ji...@apache.org on 2004/04/12 23:17:46 UTC

[jira] Updated: (XERCERJ-169) DOM Parsers seems to create 'wrong' tree

The following issue has been updated:

    Updater: Serge Knystautas (mailto:sergek@lokitech.com)
       Date: Mon, 12 Apr 2004 2:17 PM
    Changes:
             Attachment changed from i.xml
    ---------------------------------------------------------------------
For a full history of the issue, see:

  http://issues.apache.org/jira/browse/XERCERJ-169?page=history

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/XERCERJ-169

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: XERCERJ-169
    Summary: DOM Parsers seems to create 'wrong' tree
       Type: Bug

     Status: Resolved
 Resolution: DUPLICATE

    Project: Xerces2-J

   Assignee: Xerces-J Developers Mailing List
   Reporter: Peter Coppens

    Created: Mon, 11 Feb 2002 2:05 PM
    Updated: Mon, 12 Apr 2004 2:17 PM
Environment: Operating System: Windows NT/2K
Platform: PC

Description:
Using the following input document for the DOM parser

<?xml version="1.0" encoding="UTF-8"?>
<jxtr-result>
  <![CDATA[33013.12345]]>
  <![CDATA[VarChar 13]]>
  <el-c_char>Char 13   </el-c_char>
  <el-c_time>
    <![CDATA[15:41:13]]>
    15:41:13
  </el-c_time>
</jxtr-result>

And then serializing the DOM tree, results in 

<jxtr-result>
   <![CDATA[33013.12345]]>
   <![CDATA[VarChar 13]]>
   <el-c_char>Char 13   </el-c_char>
   <el-c_time>
     <![CDATA[15:41:13]]>33013.12345VarChar 1315:41:13     15:41:13   
   </el-c_time> 
</jxtr-result>


The application used to reproduce this was:

import  org.w3c.dom.*;
import  org.apache.xerces.dom.DocumentImpl;
import  org.apache.xerces.dom.DOMImplementationImpl;
import  org.w3c.dom.Document;
import  org.apache.xml.serialize.OutputFormat;
import  org.apache.xml.serialize.Serializer;
import  org.apache.xml.serialize.SerializerFactory;
import  org.apache.xml.serialize.XMLSerializer;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.InputSource;

import  java.io.*;
  
public class tx2
  {
  static void main ( String [] args )
    {
    try
      {
      InputSource is = new InputSource ( new FileReader ( "i.xml" ) );
      is.setSystemId ( "" );
      DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance ();
      dbf.setValidating ( false );
      dbf.setNamespaceAware ( true );
      DocumentBuilder db = dbf.newDocumentBuilder ();
      // Parse the XML from the provided reader
      Document doc = db.parse ( is );
      // Print
      OutputFormat format  = new OutputFormat( doc );
      XMLSerializer serial = new XMLSerializer( new FileWriter ("o.xml"), 
format );
      serial.asDOMSerializer();                            // As a DOM 
Serializer
      serial.serialize( doc.getDocumentElement() );
      }
    catch ( Exception e )
      {
      e.printStackTrace();
      }
    }
  }


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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