ws-mirae-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i..@apache.org
Subject svn commit: r367179 - /webservices/mirae/trunk/src/mirae/jaxp/org/apache/mirae/j2me/xml/NonValidatingParser.java
Date Mon, 09 Jan 2006 03:36:18 GMT
Author: ias
Date: Sun Jan  8 19:36:16 2006
New Revision: 367179

URL: http://svn.apache.org/viewcvs?rev=367179&view=rev
Log:
Fix
1. Add support of UTF-16 as required by the spec.
2. notation mark and notation can be omitted.
3. According to http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html#skippedEntity(java.lang.String),
Non-validating processors may skip entities if they have not seen the declarations.

Modified:
    webservices/mirae/trunk/src/mirae/jaxp/org/apache/mirae/j2me/xml/NonValidatingParser.java

Modified: webservices/mirae/trunk/src/mirae/jaxp/org/apache/mirae/j2me/xml/NonValidatingParser.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/mirae/jaxp/org/apache/mirae/j2me/xml/NonValidatingParser.java?rev=367179&r1=367178&r2=367179&view=diff
==============================================================================
--- webservices/mirae/trunk/src/mirae/jaxp/org/apache/mirae/j2me/xml/NonValidatingParser.java
(original)
+++ webservices/mirae/trunk/src/mirae/jaxp/org/apache/mirae/j2me/xml/NonValidatingParser.java
Sun Jan  8 19:36:16 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Copyright 2001-2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -33,7 +33,7 @@
 import org.xml.sax.helpers.DefaultHandler;
 
 /**
- * This is a non-validating parser implementation for J2ME JAXP
+ * This is a non-validating parser implementation for Java ME JAXP
  * @author Ias (iasandcb@tmax.co.kr)
  *  
  */
@@ -78,7 +78,14 @@
                     throw new IOException();
                 }
             }
-            sourceReader = new InputStreamReader(ips);
+            String encoding = source.getEncoding();
+            if (encoding != null && encoding.equals("UTF-16")) {
+                byte[] bom = new byte[2];
+                ips.read(bom);
+                sourceReader = new Utf16Reader(ips, bom[0] == ((byte)0xFE));
+            } else {
+                sourceReader = new InputStreamReader(ips);
+            }
         }
 
         locator = new LocatorImpl(source.getPublicId(), source.getSystemId(), 1, 1);
@@ -671,6 +678,12 @@
                 skipWhitespace();
                 systemId = readString('%', parameterEntityResolver);
                 skipWhitespace();
+                char delim = reader.read();
+                if (delim == '>') {
+                    reader.unread();
+                    skipTag();
+                    break;
+                }
                 notationMark = readString('%', parameterEntityResolver);
                 if (notationMark.startsWith("NDATA")) {
                     skipWhitespace();
@@ -928,7 +941,8 @@
         Object obj = entityResolver.getEntity(entity);
 
         if (obj == null) {
-            handler.warning(new SAXParseException("'" + entity + "' invalid entity", locator));
+            handler.skippedEntity(entityResolver == parameterEntityResolver ? "&" + entity
: entity);
+//            handler.warning(new SAXParseException("'" + entity + "' invalid entity", locator));
         }
         else if (obj instanceof java.lang.String) {
             reader.addString((String) obj);



---------------------------------------------------------------------
To unsubscribe, e-mail: mirae-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: mirae-dev-help@ws.apache.org


Mime
View raw message