Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

getting null value while parsing "XML String" with encoding WINDOWS-1252.

843834Sep 4 2010 — edited Sep 8 2010
Hi,

when I am converting the Follwoing "xml string " to Document, I am getting the "null" as a document value.
    String strXML =  "<?xml version="1.0" encoding="WINDOWS-1252"?>
                          <category name="SearchByAttributes" value="Search By Attributes">
                            <item name="ORDER_LINE_ID" description="Application Search Attributes" >
                               <attribute name="Sequence" value="0001"/>
                             </item>
                            </category>"       
 
My "xml string" has the encoding vaule: WINDOWS-1252.

I am using the following code to convert the "xml string" to Document. I am getting the Document values as a "null" while converting the above "string xml"
        String strXML = //my above string xml.
        DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
        docBuilderFactory.setIgnoringElementContentWhitespace(true);
        docBuilder = docBuilderFactory.newDocumentBuilder();
        doc = docBuilder.parse(new InputSource(new StringReader(strXML)));               
        System.out.println("doc value.."+doc)//I am getting null value for "doc".
 
Can anyone help me to resolve the issue.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 6 2010
Added on Sep 4 2010
8 comments
2,260 views