Proposal for the ISO character entity... with attachments

Arnaud Vandyck <[email protected]>
Newsgroups gmane.comp.java.classpath.extensions.xml
Organization STE-FI, ULg
Message-ID <[email protected]>
Sorry for the empty attachments... here they are.

-- arnaud :: http://vbstefi60.fapse.ulg.ac.be/~arnaud/
LOI DE BOOB
Quel que soit l'objet, il sera trouvé dans le dernier endroit dans
lequel on aura cherché
jaxp-char-entities-patch-20021012.diff (text/plain, 790 B)
diff -ru jaxp.orig/source/gnu/xml/aelfred2/XmlParser.java jaxp.new/source/gnu/xml/aelfred2/XmlParser.java
--- jaxp.orig/source/gnu/xml/aelfred2/XmlParser.java	2002-10-12 23:33:11.000000000 +0200
+++ jaxp.new/source/gnu/xml/aelfred2/XmlParser.java	2002-10-12 23:33:11.000000000 +0200
@@ -1921,6 +1921,7 @@
     throws Exception
     {
 	boolean peFlag = false;
+    int flags = LIT_DISABLE_CREF;
 
 	// Check for a parameter entity.
 	expandPE = false;
@@ -1945,7 +1946,7 @@
 	if (c == '"' || c == '\'') {
 	    // Internal entity ... replacement text has expanded refs
 	    // to characters and PEs, but not to general entities
-	    String value = readLiteral (0);
+	    String value = readLiteral (flags);
 	    setInternalEntity (name, value);
 	} else {
 	    // Read the external IDs
Test.java (text/plain, 2.9 KB)
import org.w3c.dom.*;
import javax.xml.parsers.*;
import java.io.*;

/**
 * Test.java
 *
 *
 * Created: Thu Oct 10 21:44:07 2002
 *
 * @author <a href="mailto:[email protected]">Arnaud Vandyck</a>
 * @version
 */
public class Test
{
 
    public static String[] NODETYPE = 
    {
        "Unknow Node", "ELEMENT_NODE", "ATTRIBUTE_NODE", "TEXT_NODE", 
        "CDATA_SECTION_NODE", "ENTITY_REFERENCE_NODE", "ENTITY_NODE", 
        "PROCESSING_INSTRUCTION_NODE", "COMMENT_NODE", "DOCUMENT_NODE", 
        "DOCUMENT_TYPE_NODE", "DOCUMENT_FRAGMENT_NODE", "NOTATION_NODE"
        
    };

    public Test ()
    {
        
    }
    
    public static void main(String[] args)
    {
        /*
        System.out.println( "ATTRIBUTE_NODE : " + Node.ATTRIBUTE_NODE );
        System.out.println( "CDATA_SECTION_NODE : " + Node.CDATA_SECTION_NODE );
        System.out.println( "COMMENT_NODE : " + Node.COMMENT_NODE );
        System.out.println( "DOCUMENT_FRAGMENT_NODE : " + Node.DOCUMENT_FRAGMENT_NODE );
        System.out.println( "DOCUMENT_NODE : " + Node.DOCUMENT_NODE );
        System.out.println( "DOCUMENT_TYPE_NODE : " + Node.DOCUMENT_TYPE_NODE );
        System.out.println( "ELEMENT_NODE : " + Node.ELEMENT_NODE );
        System.out.println( "ENTITY_NODE : " + Node.ENTITY_NODE );
        System.out.println( "ENTITY_REFERENCE_NODE : " + Node.ENTITY_REFERENCE_NODE );
        System.out.println( "NOTATION_NODE : " + Node.NOTATION_NODE );
        System.out.println( "PROCESSING_INSTRUCTION_NODE : " + Node.PROCESSING_INSTRUCTION_NODE );
        System.out.println( "TEXT_NODE : " + Node.TEXT_NODE );
        System.exit( 1 );
        */

        try
            {
                System.out.println( "Starting processing..." );
                
                DocumentBuilder domManager = DocumentBuilderFactory.newInstance().newDocumentBuilder();
                
                FileInputStream fis = new FileInputStream( "test.xml" );
                Document d = domManager.parse( fis );
                System.out.println( "File has been passed to the processor..." );
                
                Element root = d.getDocumentElement();
                System.out.println( "Nom de la racine: " + root.getTagName() );
                
                printChildNodes( root.getChildNodes() );
            }
        catch (Exception e1)
            {
                e1.printStackTrace();
            }
        
    }

    static private void printChildNodes( NodeList list )
    {
        int l = list.getLength();
        for (int i=0; i<l; i++) 
            {
                Node node = list.item( i );
                printNode( node );
                printChildNodes( node.getChildNodes() );
            }
    }
    
    static private void printNode( Node node )
    {
        System.out.println( node.getNodeName() + " [" + NODETYPE[node.getNodeType()] + "]: " + node.getNodeValue() );
    }
    
} // Test
test.xml (text/xml, 675 B)
<?xml version="1.0" encoding="ISO-8859-1" standalone="no" ?>
<?xml-stylesheet type="text/xsl" href="sdocbook.xsl"?>
<!DOCTYPE article SYSTEM "file:///usr/share/sgml/docbook/dtd/xml/4.2/docbookx.dtd"
[
<!NOTATION wmf SYSTEM "wmf" >
<!ENTITY g001 SYSTEM "images/example_001.wmf" NDATA wmf >

<!ENTITY yo "Yooooooo">
<!ENTITY yo2 "&yo;">
]>

<article>
  <articleinfo>
    <title>Titre de test</title>
    <author>
      <firstname>Arnaud</firstname>
      <surname>Vandyck</surname>
    </author>
  </articleinfo>
  <section>
    <title>Test</title>
    <para>Entite yo: &yo;</para>
    <para>Entite yo2: &yo2;</para>
    <para>Entite EURO: &euro;</para>
  </section>
</article>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.