You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Michael Rafael Glavassevich <mr...@engmail.uwaterloo.ca> on 2003/05/11 23:14:14 UTC

[PATCH]: "standalone" in the XML declaration,

It looks like a bug in the parser.

Changing lines 859 & 865 in Revision 1.86 of
org.apache.xerces.parsers.AbstractDOMParser as shown below should fix the problem.

public void xmlDecl(String version, String encoding, String standalone,
                        Augmentations augs)
        throws XNIException {
        if (!fDeferNodeExpansion) {
            // REVISIT: when DOM Level 3 is REC rely on Document.support
            //          instead of specific class
            if (fDocumentImpl != null) {
                fDocumentImpl.setVersion(version);
                fDocumentImpl.setEncoding(encoding);
-               fDocumentImpl.setStandalone("true".equals(standalone));
+               fDocumentImpl.setStandalone("yes".equals(standalone));
            }
        }
        else {
            fDeferredDocumentImpl.setVersion(version);
            fDeferredDocumentImpl.setEncoding(encoding);
-           fDeferredDocumentImpl.setStandalone("true".equals(standalone));
+           fDeferredDocumentImpl.setStandalone("yes".equals(standalone));
        }
    } // xmlDecl(String,String,String)

-----------------------------
Michael Glavassevich
mrglavas@engmail.uwaterloo.ca
4B Computer Engineering
University of Waterloo

On Sun, 11 May 2003, Pae Choi wrote:

> When I try to get the "standalone" attribute value from the DOM after loading
> the XML document from a file it *always* returns "false."
>
> I have a demo XML file containing two lines as:
>
> // ################ XML File ##################
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"/>
>
> And the code snippet is as follows:
>
> // ################ CODE SNIPPET ##################
> private void checkXMLDecl() {
>         // Create a factory object for creating DOM parsers
>         DocumentBuilderFactory  factory = DocumentBuilderFactory.newInstance();
>         DocumentBuilder         builder = null;
>         Document                 xmlDOM = null;
>
>         try {
>             // Now use the factory to create a DOM parser
>             builder = factory.newDocumentBuilder();
>             xsDOM = builder.parse(xsdFile);
>
>             // Get the xml declaration
>             System.out.println("version = [" + ((CoreDocumentImpl)xsDOM).getVersion() + "]");
>             System.out.println("encoding = [" + ((CoreDocumentImpl)xsDOM).getEncoding() + "]");
>             // ########################################################
>             // The getStandalone() method does NOT work
>             if ( ((CoreDocumentImpl)xsDOM).getStandalone() )
>                 System.out.println("standalone is true");
>             else
>                 System.out.println("standalone is false");
>         }
>         catch (Exception ex) {
>         }
> }
>
> I have tested with Xerces v2.0.2, v2.2.1, and v2.4.0, but all three returns
> the same result, "false."
>
> Any comments?
>
>
> Pae
>
>

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


Re: [PATCH]: "standalone" in the XML declaration,

Posted by Michael Rafael Glavassevich <mr...@engmail.uwaterloo.ca>.
Hi Pae,

The patch is in CVS now, so I'd assume it will be in the next release.

-----------------------------------------
Michael Glavassevich
mrglavas@engmail.uwaterloo.ca
Candidate for Bachelor of Applied Science
Computer Engineering
University of Waterloo

On Mon, 12 May 2003, Michael Rafael Glavassevich wrote:

> Hi Pae,
>
> I can't really speculate as to what will be in the next release, and when
> it will be released. One of the Xerces-J committers would probably have a
> better idea about those items.
>
> -----------------------------
> Michael Glavassevich
> mrglavas@engmail.uwaterloo.ca
> 4B Computer Engineering
> University of Waterloo
>
> On Mon, 12 May 2003, Pae Choi wrote:
>
> > Michael,
> >
> > Thank you for your prompt reply as well as the patch. Should we
> > expect the patch in the next release? If so, would you share
> > the release plan? Thank you.
> >
> > Regards,
> >
> >
> > Pae
> >
> >
> > ----- Original Message -----
> > From: "Michael Rafael Glavassevich" <mr...@engmail.uwaterloo.ca>
> > To: <xe...@xml.apache.org>
> > Sent: Sunday, May 11, 2003 5:14 PM
> > Subject: [PATCH]: "standalone" in the XML declaration, <?xml ... ?>
> >
> >
> > > It looks like a bug in the parser.
> > >
> > > Changing lines 859 & 865 in Revision 1.86 of
> > > org.apache.xerces.parsers.AbstractDOMParser as shown below should fix the
> > problem.
> > >
> > > public void xmlDecl(String version, String encoding, String standalone,
> > >                         Augmentations augs)
> > >         throws XNIException {
> > >         if (!fDeferNodeExpansion) {
> > >             // REVISIT: when DOM Level 3 is REC rely on Document.support
> > >             //          instead of specific class
> > >             if (fDocumentImpl != null) {
> > >                 fDocumentImpl.setVersion(version);
> > >                 fDocumentImpl.setEncoding(encoding);
> > > -               fDocumentImpl.setStandalone("true".equals(standalone));
> > > +               fDocumentImpl.setStandalone("yes".equals(standalone));
> > >             }
> > >         }
> > >         else {
> > >             fDeferredDocumentImpl.setVersion(version);
> > >             fDeferredDocumentImpl.setEncoding(encoding);
> > > -
> > fDeferredDocumentImpl.setStandalone("true".equals(standalone));
> > > +           fDeferredDocumentImpl.setStandalone("yes".equals(standalone));
> > >         }
> > >     } // xmlDecl(String,String,String)
> > >
> > > -----------------------------
> > > Michael Glavassevich
> > > mrglavas@engmail.uwaterloo.ca
> > > 4B Computer Engineering
> > > University of Waterloo
> > >
> > > On Sun, 11 May 2003, Pae Choi wrote:
> > >
> > > > When I try to get the "standalone" attribute value from the DOM after
> > loading
> > > > the XML document from a file it *always* returns "false."
> > > >
> > > > I have a demo XML file containing two lines as:
> > > >
> > > > // ################ XML File ##################
> > > > <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> > > > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"/>
> > > >
> > > > And the code snippet is as follows:
> > > >
> > > > // ################ CODE SNIPPET ##################
> > > > private void checkXMLDecl() {
> > > >         // Create a factory object for creating DOM parsers
> > > >         DocumentBuilderFactory  factory =
> > DocumentBuilderFactory.newInstance();
> > > >         DocumentBuilder         builder = null;
> > > >         Document                 xmlDOM = null;
> > > >
> > > >         try {
> > > >             // Now use the factory to create a DOM parser
> > > >             builder = factory.newDocumentBuilder();
> > > >             xsDOM = builder.parse(xsdFile);
> > > >
> > > >             // Get the xml declaration
> > > >             System.out.println("version = [" +
> > ((CoreDocumentImpl)xsDOM).getVersion() + "]");
> > > >             System.out.println("encoding = [" +
> > ((CoreDocumentImpl)xsDOM).getEncoding() + "]");
> > > >             // ########################################################
> > > >             // The getStandalone() method does NOT work
> > > >             if ( ((CoreDocumentImpl)xsDOM).getStandalone() )
> > > >                 System.out.println("standalone is true");
> > > >             else
> > > >                 System.out.println("standalone is false");
> > > >         }
> > > >         catch (Exception ex) {
> > > >         }
> > > > }
> > > >
> > > > I have tested with Xerces v2.0.2, v2.2.1, and v2.4.0, but all three
> > returns
> > > > the same result, "false."
> > > >
> > > > Any comments?
> > > >
> > > >
> > > > Pae
> > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: xerces-j-user-help@xml.apache.org
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-j-user-help@xml.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>

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


Re: [PATCH]: "standalone" in the XML declaration,

Posted by Michael Rafael Glavassevich <mr...@engmail.uwaterloo.ca>.
Hi Pae,

I can't really speculate as to what will be in the next release, and when
it will be released. One of the Xerces-J committers would probably have a
better idea about those items.

-----------------------------
Michael Glavassevich
mrglavas@engmail.uwaterloo.ca
4B Computer Engineering
University of Waterloo

On Mon, 12 May 2003, Pae Choi wrote:

> Michael,
>
> Thank you for your prompt reply as well as the patch. Should we
> expect the patch in the next release? If so, would you share
> the release plan? Thank you.
>
> Regards,
>
>
> Pae
>
>
> ----- Original Message -----
> From: "Michael Rafael Glavassevich" <mr...@engmail.uwaterloo.ca>
> To: <xe...@xml.apache.org>
> Sent: Sunday, May 11, 2003 5:14 PM
> Subject: [PATCH]: "standalone" in the XML declaration, <?xml ... ?>
>
>
> > It looks like a bug in the parser.
> >
> > Changing lines 859 & 865 in Revision 1.86 of
> > org.apache.xerces.parsers.AbstractDOMParser as shown below should fix the
> problem.
> >
> > public void xmlDecl(String version, String encoding, String standalone,
> >                         Augmentations augs)
> >         throws XNIException {
> >         if (!fDeferNodeExpansion) {
> >             // REVISIT: when DOM Level 3 is REC rely on Document.support
> >             //          instead of specific class
> >             if (fDocumentImpl != null) {
> >                 fDocumentImpl.setVersion(version);
> >                 fDocumentImpl.setEncoding(encoding);
> > -               fDocumentImpl.setStandalone("true".equals(standalone));
> > +               fDocumentImpl.setStandalone("yes".equals(standalone));
> >             }
> >         }
> >         else {
> >             fDeferredDocumentImpl.setVersion(version);
> >             fDeferredDocumentImpl.setEncoding(encoding);
> > -
> fDeferredDocumentImpl.setStandalone("true".equals(standalone));
> > +           fDeferredDocumentImpl.setStandalone("yes".equals(standalone));
> >         }
> >     } // xmlDecl(String,String,String)
> >
> > -----------------------------
> > Michael Glavassevich
> > mrglavas@engmail.uwaterloo.ca
> > 4B Computer Engineering
> > University of Waterloo
> >
> > On Sun, 11 May 2003, Pae Choi wrote:
> >
> > > When I try to get the "standalone" attribute value from the DOM after
> loading
> > > the XML document from a file it *always* returns "false."
> > >
> > > I have a demo XML file containing two lines as:
> > >
> > > // ################ XML File ##################
> > > <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> > > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"/>
> > >
> > > And the code snippet is as follows:
> > >
> > > // ################ CODE SNIPPET ##################
> > > private void checkXMLDecl() {
> > >         // Create a factory object for creating DOM parsers
> > >         DocumentBuilderFactory  factory =
> DocumentBuilderFactory.newInstance();
> > >         DocumentBuilder         builder = null;
> > >         Document                 xmlDOM = null;
> > >
> > >         try {
> > >             // Now use the factory to create a DOM parser
> > >             builder = factory.newDocumentBuilder();
> > >             xsDOM = builder.parse(xsdFile);
> > >
> > >             // Get the xml declaration
> > >             System.out.println("version = [" +
> ((CoreDocumentImpl)xsDOM).getVersion() + "]");
> > >             System.out.println("encoding = [" +
> ((CoreDocumentImpl)xsDOM).getEncoding() + "]");
> > >             // ########################################################
> > >             // The getStandalone() method does NOT work
> > >             if ( ((CoreDocumentImpl)xsDOM).getStandalone() )
> > >                 System.out.println("standalone is true");
> > >             else
> > >                 System.out.println("standalone is false");
> > >         }
> > >         catch (Exception ex) {
> > >         }
> > > }
> > >
> > > I have tested with Xerces v2.0.2, v2.2.1, and v2.4.0, but all three
> returns
> > > the same result, "false."
> > >
> > > Any comments?
> > >
> > >
> > > Pae
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-j-user-help@xml.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>

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


Re: [PATCH]: "standalone" in the XML declaration,

Posted by Pae Choi <pa...@earthlink.net>.
Michael,

Thank you for your prompt reply as well as the patch. Should we
expect the patch in the next release? If so, would you share
the release plan? Thank you.

Regards,


Pae


----- Original Message -----
From: "Michael Rafael Glavassevich" <mr...@engmail.uwaterloo.ca>
To: <xe...@xml.apache.org>
Sent: Sunday, May 11, 2003 5:14 PM
Subject: [PATCH]: "standalone" in the XML declaration, <?xml ... ?>


> It looks like a bug in the parser.
>
> Changing lines 859 & 865 in Revision 1.86 of
> org.apache.xerces.parsers.AbstractDOMParser as shown below should fix the
problem.
>
> public void xmlDecl(String version, String encoding, String standalone,
>                         Augmentations augs)
>         throws XNIException {
>         if (!fDeferNodeExpansion) {
>             // REVISIT: when DOM Level 3 is REC rely on Document.support
>             //          instead of specific class
>             if (fDocumentImpl != null) {
>                 fDocumentImpl.setVersion(version);
>                 fDocumentImpl.setEncoding(encoding);
> -               fDocumentImpl.setStandalone("true".equals(standalone));
> +               fDocumentImpl.setStandalone("yes".equals(standalone));
>             }
>         }
>         else {
>             fDeferredDocumentImpl.setVersion(version);
>             fDeferredDocumentImpl.setEncoding(encoding);
> -
fDeferredDocumentImpl.setStandalone("true".equals(standalone));
> +           fDeferredDocumentImpl.setStandalone("yes".equals(standalone));
>         }
>     } // xmlDecl(String,String,String)
>
> -----------------------------
> Michael Glavassevich
> mrglavas@engmail.uwaterloo.ca
> 4B Computer Engineering
> University of Waterloo
>
> On Sun, 11 May 2003, Pae Choi wrote:
>
> > When I try to get the "standalone" attribute value from the DOM after
loading
> > the XML document from a file it *always* returns "false."
> >
> > I have a demo XML file containing two lines as:
> >
> > // ################ XML File ##################
> > <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"/>
> >
> > And the code snippet is as follows:
> >
> > // ################ CODE SNIPPET ##################
> > private void checkXMLDecl() {
> >         // Create a factory object for creating DOM parsers
> >         DocumentBuilderFactory  factory =
DocumentBuilderFactory.newInstance();
> >         DocumentBuilder         builder = null;
> >         Document                 xmlDOM = null;
> >
> >         try {
> >             // Now use the factory to create a DOM parser
> >             builder = factory.newDocumentBuilder();
> >             xsDOM = builder.parse(xsdFile);
> >
> >             // Get the xml declaration
> >             System.out.println("version = [" +
((CoreDocumentImpl)xsDOM).getVersion() + "]");
> >             System.out.println("encoding = [" +
((CoreDocumentImpl)xsDOM).getEncoding() + "]");
> >             // ########################################################
> >             // The getStandalone() method does NOT work
> >             if ( ((CoreDocumentImpl)xsDOM).getStandalone() )
> >                 System.out.println("standalone is true");
> >             else
> >                 System.out.println("standalone is false");
> >         }
> >         catch (Exception ex) {
> >         }
> > }
> >
> > I have tested with Xerces v2.0.2, v2.2.1, and v2.4.0, but all three
returns
> > the same result, "false."
> >
> > Any comments?
> >
> >
> > Pae
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>


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