Parsing XML file with different languages (Xerces)

How do we code or program to an XML file with different
languages , say english and spanish. WHen we parse such a document with the default locale , the presence of special characters throws errors .For eg when I use xerces and use
DOMParser parser = new DOMParser();
try
// Parse the XML Document
parser.parse(xmlFile);
catch (SAXException se)
se.printStackTrace();
org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0xfc) was found in the element content of the document.
System Error:          void org.apache.xerces.framework.XMLParser.parse(org.xml.sax.InputSource)
So what locale do we set before we parse ?How to handle this problem

You need an encoding attribute in the xml declaration. If you don't, the parser assumes UTF-8, which are ASCII characters up to 127 - useful (only) for English.
So, something like this would allow you to use characters above 127, ISO-8859-1 is the encoding used by standard PCs.
<?xml version="1.0" encoding="ISO-8859-1"?>
You can find a (offical) list of encodings at:
http://www.iana.org/assignments/character-sets
I'm not sure about mixing various encodings. I think you have to resort external parsed entities, which can have their own encoding, but I think you cannot mix encodings in one XML file.
Good luck.

Similar Messages

  • XML file with different format

    Hello
       I have a requirement where the customer needs XML file with different format.  How do I achieve the second format mentioned below instead of first format.
    Normally we create the XML file in the following format:
    - <Entries>
        - <Organization>
            <MemberName>0000000002</MemberName>
            <FullName>BAY GYNECOLOGICAL ASSOCIATES</FullName>
            <OrgId>0000000002</OrgId>
            <OrgType>CUST</OrgType>
       - <AssociatedToOrg>
            <Name>0002</Name>
       - </AssociatedToOrg>
      </Organization>
    Now the customer wants like the following format:
    <Organization MemberName="522_Community_Customer" FullName="522 Community Customer" OrgId="DEA123456" OrgIdType="DEA" >
          <AssociatedToOrg Name="MN"/>
        </Organization>
    Thanks
    Naga

    you can solve it with a XSL mapping. refer to the SDN to know how develop it
    /people/aleksey.popov2/blog/2010/01/26/consuming-webservices-with-tag-in-wsdl-using-xslt
    XSLT Editor for creating xlst mappings
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/190eb190-0201-0010-0ab3-e69f70b6c257
    http://wiki.sdn.sap.com/wiki/display/XI/XSLTMappingSteps
    http://wiki.sdn.sap.com/wiki/display/XI/FileTOFile-UsingXSLTmapping%28forBeginners%29
    http://wiki.sdn.sap.com/wiki/display/Snippets/ConvertflatXMLfiletonestedusing+XSLT
    http://wiki.sdn.sap.com/wiki/display/Java/MultiMappingwithJavaandXSLTmappings
    Edited by: Rodrigo Alejandro Pertierra on Oct 1, 2010 5:26 PM

  • Parse exisitng xml file and recreate another xml file with different struct

    Is it possible in java using dom parser to parse an exisiting xml file and recreate a new xml file from data obtained by parsing old xml file.
    I checked on old forum threads and everywhere either parsing xml file has been explained or creating new xml file from scratch has been shown.
    Any examples/guidance will be appreciated....

    The general process is:
    Document dom1 = ... // the parsed document
    Document dom2 = ... // new document constructed on the fly
    Node nD1 = ... // some random node found in dom1
    // copy the node from dom1 and associate with dom2
    Node nD2 = dom2.importNode(nD1, true);
    // ... treat nD2 as a node which can now be inserted into dom2 ...
    Node otherD2 =  ... // some other node already in dom2
    otherD2.appendChild(nD2);Note, in this example the nD1 node is copied (including any sub-nodes) into a new node, nD2. You can alternately move the node from one Document to another using Document.adoptNode(), however this may fail (see the javadoc).

  • How to parse XML file with namesapce?

    Hi,
       I am trying to parse an xml file having namespace. But no data is returned.
    Sample Code:
    public class XMLFileLoader
    var xml:XML = new XML();
    var myXML:XML = new XML();
    var XML_URL:String = "file:///C:/Documents and Settings/Administrator/Desktop/MyData.xml";
    var myLoader:URLLoader = null;
    public function XMLFileLoader()
    var myXMLURL:URLRequest = new URLRequest(XML_URL);
    myLoader= new URLLoader(myXMLURL);
    myLoader.addEventListener(Event.COMPLETE,download);
    public function download(event:Event):void
    myXML = XML(myLoader.data);
    var ns:Namespace=myXML.namespace("xsi");
    for(var prop:String in myXML)
         trace(prop);
    //Alert.show(myXML..Parameters);
    //trace("Data loadedww."+myXML.toString());
    //Alert.show(myXML.DocumentInfo.attributes()+"test","Message");
    The XML Contains the following format.
    <Network xmlns="http://www.test.com/2005/test/omc/conf"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://www.test.com/2005/test/omc/conf/TestConfigurationEdition3proposal4.xsd">
        <TestDomain>
          <WAC>
            <!--Release Parameter  -->
            <Parameters ParameterName="ne_release" OutageType="None"
                        accessRight="CreateOnly" isMandatory="true"
                        Planned="false"
                        Reference="true" Working="true">
              <DataType>
                <StringType/>
              </DataType>
              <GUIInfo graphicalName="Release"
                       tabName="All"
                       description="Describes the release version of the managed object"/>
            </Parameters>
    </TestDomain>
    </Network>
    Any sample code how to parse this kind of xml file with namespaces...
    Regards,
    Purushotham

    i have exactly the same problem with KXml2, but using a j2me-polish netbeans project.
    i've tried to work around with similar ways like you, but none of them worked. now i've spent 3 days for solving this problem, i'm a bit disappointed :( what is wrong with setting the downloaded kxml2 jar path in libraries&resources?
    screenshot

  • Parse xml file with validating againat dtd

    i have a xlm file looks like:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE map SYSTEM "map.dtd">
    <map width="20" height="15" goal="25" name="eXtreme Labyrinth of Dooom">
    <random-item type='lantern' amount='5' />
    <random-item type='health' amount='10' />
    <tile x="14" y="0" type="wall">
    <renderhint>wall:rock,cracked</renderhint>
    </tile>
    <tile x="15" y="0" type="wall" />
    <tile x="16" y="0" type="floor">
    <renderhint>floor:marble,cracked</renderhint>
    </tile>
    <tile x="17" y="0" type="floor">
    <renderhint>floor:stone,rubble</renderhint>
    </tile>
    <tile x="18" y="0" type="floor" />
    <tile x="0" y="1" type="floor" />
    <tile x="1" y="1" type="floor" startlocation="1" />
    <tile x="2" y="1" type="floor" />
    <tile x="3" y="1" type="floor">
    <item type="treasure">Bar of Silver</item>
    <renderhint>floor:stone,blood</renderhint>
    </tile>
    <tile x="4" y="1" type="wall" />
    <tile x="5" y="1" type="wall" />
    <tile x="6" y="1" type="wall">
    <renderhint>wall:bricks,cracked</renderhint>
    </tile>
    </map>and a dtd document like:
    <!ELEMENT map (random-item+, tile+)>
    <!ATTLIST map
    width CDATA #REQUIRED
    height CDATA #REQUIRED
    goal CDATA #REQUIRED
    name CDATA #REQUIRED
    <!ELEMENT random-item EMPTY>
    <!ATTLIST random-item
    type (armour|health|sword|treasure|lantern) #REQUIRED
    amount CDATA #REQUIRED
    <!ELEMENT tile (item|renderhint)*>
    <!ATTLIST tile
    x CDATA #REQUIRED
    y CDATA #REQUIRED
    type (exit|floor|wall) #REQUIRED
    startlocation CDATA #IMPLIED
    <!ELEMENT item (#PCDATA)>
    <!ATTLIST item
    type (armour|health|sword|treasure|lantern) #REQUIRED
    <!ELEMENT renderhint (#PCDATA)>i need to validate the xml file against the dtd document and parse it to java using DOM.
    Can anyone give ma any suggestions on how to do it?
    thank you

    i have started my coding like:
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.ParserConfigurationException;
    import org.w3c.dom.*;
    import org.xml.sax.SAXException;
    import java.io.*;
    class loadxml
        public static void main(String[] args)
         try {
              DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
              factory.setValidating(true);
              factory.setIgnoringElementContentWhitespace(true);
              DocumentBuilder parser = factory.newDocumentBuilder();
              Document doc = parser.parse(new File("hallways.xml"));
              loadxml load = new loadxml();
              load.parseNode(doc);
         } catch (ParserConfigurationException e) {
              e.printStackTrace();
         } catch (SAXException e) {
              e.printStackTrace();
         } catch (IOException e) {
              e.printStackTrace();
        public void parseNode (Node node) throws IOException
               // here is where i have problem with
    }since in my xml file, i have got ATTLIST, this ready confuses me when i try to coding it.
    Can anyone help me, please.
    Thank you.
    Edited by: mujingyue on Mar 12, 2008 3:10 PM

  • Transforming xml file with different elements into HTML

    hi all !
    i have an xml object that has been generated from database using java. the xml file has numerous elements that have been merged into single file. all elements have been got from different table :-
    <?xml version = '1.0' ?>
    <ROWSET>
    <ROW id= "1">
    <EMPID>1</EMPID>
    <EMPADDRESS>H 3 STREET 4</EMPADDRESS>
    <EMPPHONE>98764653</EMPPHONE>
    </ROW>
    <ROW id="2">
    <EMPID>5</EMPID>
    <EMPQUAL>GRADE 12</EMPQUAL>
    <EMPGRADE>A</EMPGRADE>
    </ROW>
    </ROWSET>
    (its just a sample data, might not be wel formed)
    as it shows that each element "ROW" has data corresponding to different employee and with different details. actually these elemnt are the updates in an employee profile that have to be communicated to a distant located database. what i need is a tranformation into HTML so that the recieving user can view this file as html with relative headings of corresponding tables.
    (the schema at both ends is exact replica)
    any help in this regards would be obliging.

    thank you bro!
    the xml file has been created by importing multiple files resulted from XSU into a master file in java. we are running a web based project in a distributed environment. so i would need to make this page appear in a web browser with ACCEPT and REJECT command buttons as the receiver is the approving agent. what all i have thought of so far is to create a style sheet with templates of all heading of each table from where the data is coming from and then run a check on what table the data is from and place that specific heading on the entry. the style sheet would be placed at both ends so only the xml file will be transported and transformation would be done auto.
    i hope it works. but am not sure wether its the right approach or not.

  • Parsing XML file with the word "Infinity" in it

    I am having a problem within Flex that parses an XML file,
    one of the text names within the file contains the word "Infinity".
    Unfortunately this is a constant within Flex and the element of my
    array does not think it is a text string but a value. I have tried
    type setting the xml element, and putting escape characters around
    the text but nothing works. If I change the text to lowercase
    "infinity" it works fine.
    Any help greatly appreciated.

    This sounds like a bug. Can you file it, with a small code
    example that illustrates it, here:
    http://bugs.adobe.com/jira
    Thanks!
    matt horn
    flex docs

  • Parse XML file with regex

    Hi,
    Is that possible to parse a xml file using regular expressions....if s what is the API needed
    thanx in advance

    Is that possible to parse a xml file using regular
    expressions....if s what is the API neededI'm sure it can be done. Here's the regex API:
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/package-summary.html
    http://www.javaregex.com/tutorial.html
    But that's not where regex is for. Better have a look at this:
    http://java.sun.com/xml/

  • Parsing a file with different groupings!

    I need to parse a file. The file looks like this.
    ABC45     CLIENT-90      MY COMPANY-0333    STOCK  VS POSITIONS      DATE
    ......n number of records here
    ABC45     CLIENT-90      MY COMPANY-0897    STOCK VS POSITIONS       DATE
    .....n number of records here
    ABC 45    CLIENT-90      MY COMPANY-0333     STOCK VS POSITIONS       DATE
    ....n number of records here
    ABC 45    CLIENT-90      MY COMPANY-0367     STOCK VS POSITIONS       DATE
    ....n number of records hereI need to get all the records under say "MY COMPANY-0333" and parse them further and output to a text file. How can I do that?
    Thanks

    You have header and detail records, I suppose. Let's call them that. Pseudocode:boolean rightStuff = false;
    for each record:
      if it's a header record:
        if it has MY COMPANY-0333 in the right place then rightStuff = true else rightStuff = false
      if it's a detail record:
        if rightStuff then process it and write to the filePC&#178;

  • Reading xml file with sax parser: unknown protocol: c

    Hi,
    I've been googling around, and the best I can find is that the file name:
    File test = new File("lib/test/parseTest/validate-test.xml");should be a url:
    File test = new File("File://lib/test/parseTest/validate-test.xml");but I'm working on a linux machine and can't put "File://c:/pathToFile/file.xml"
    Also, I did some testing and I can read a small xml file with just a few elements, but on large complex files, I get that error.
    anyone ever run into this before?
    bp
    Edited by: badperson on Nov 1, 2008 2:19 PM

    badperson wrote:
    I've been googling around, and the best I can find is that the file name:
    File test = new File("lib/test/parseTest/validate-test.xml");should be a url:
    File test = new File("File://lib/test/parseTest/validate-test.xml");
    No, that's wrong. The parameter for that constructor is a file path (relative or absolute). Not a URL. You must have misunderstood whatever you read.
    but I'm working on a linux machine and can't put "File://c:/pathToFile/file.xml"What kind of a Linux machine is this which has a C drive? You must have misunderstood whoever told you to do that.

  • Read XML file from different server on JSP

    Dear All,
    I am a newbie to JSP with XML, now i want to read the "test.xml" from JSP.
    I read successfully this "test.xml" file from my system and I got output, but I need to read the xml file from
    different server like "http://www.domain.com/test.xml". I couldn't read such a type of file from different server.
    Is it possible to read a xml file from different server?
    If anybody have idea please let me know.
    Thanks in Advance,
    Prasath.
    <%@ page import="java.sql.*,java.io.*,java.util.*,javax.xml.parsers.*,org.w3c.dom.*,org.xml.sax.*" %>
    <%
    try {
        DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
        DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
        Document doc = docBuilder.parse (new File("http://www.domain.com/test.xml"));
        // normalize text representation
        doc.getDocumentElement ().normalize ();
        out.println ("Root element of the doc is " +
             doc.getDocumentElement().getNodeName()+"<br>");
        NodeList listOfPersons = doc.getElementsByTagName("person");
        int totalPersons = listOfPersons.getLength();
        out.println("Total no of people : " + totalPersons+"<br>");
        for(int s=0; s<listOfPersons.getLength() ; s++){
            Node firstPersonNode = listOfPersons.item(s);
            if(firstPersonNode.getNodeType() == Node.ELEMENT_NODE){
                Element firstPersonElement = (Element)firstPersonNode;
                NodeList firstNameList = firstPersonElement.getElementsByTagName("first");
                Element firstNameElement = (Element)firstNameList.item(0);
                NodeList textFNList = firstNameElement.getChildNodes();
                out.println("First Name : " +
                       ((Node)textFNList.item(0)).getNodeValue().trim()+"<br>");
                NodeList lastNameList = firstPersonElement.getElementsByTagName("last");
                Element lastNameElement = (Element)lastNameList.item(0);
                NodeList textLNList = lastNameElement.getChildNodes();
                out.println("Last Name : " +
                       ((Node)textLNList.item(0)).getNodeValue().trim()+"<br>");
                NodeList ageList = firstPersonElement.getElementsByTagName("age");
                Element ageElement = (Element)ageList.item(0);
                NodeList textAgeList = ageElement.getChildNodes();
                out.println("Age : " +
                       ((Node)textAgeList.item(0)).getNodeValue().trim()+"<br>");
            }//end of if clause
        }//end of for loop with s var
    }catch (SAXParseException err) {
    out.println ("** Parsing error" + ", line "
         + err.getLineNumber () + ", uri " + err.getSystemId ());
    out.println(" " + err.getMessage ());
    }catch (SAXException e) {
    Exception x = e.getException ();
    ((x == null) ? e : x).printStackTrace ();
    }catch (Throwable t) {
    t.printStackTrace ();
    %>

    You might try:
    Document doc = docBuilder.parse ("http://www.domain.com/test.xml");Alternatively use the java.net package to obtain an Input Stream to the xml document
    InputStream in = methodThatYouWriteYourselfCalledgetInputStreamForURI("http://www.domain.com/test.xml");
    Document doc = docBuilder.parse (in);cheers,
    evnafets

  • Parsing Error while Parsing XML file

    Hi I am trying to parse an xml file with use of an stylehseet as shown below but its giving an error message as follows
    [Fatal Error] myfile2.xml:1:8: The processing instruction target matching "[xX][mM][lL]" is not allowed.
    org.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed.
    at org.apache.xerces.parsers.DOMParser.parse(DOMParser.java:235)
    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:201)
    at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
    at Stylizer.main(Stylizer.java:50)
    The sample xml file is
    - <nitf id="366045">
    - <head>
    <title type="main">������� �������� ������</title>
    - <tobject toobject.type="���� �����">
    <tobject.subject tobject.subject.type="�����" tobject.subject.matter="����� ������" />
    </tobject>
    - <docdata>
    <date.issue norm="28/09/2002" />
    <doc.copyright year="YYYY" holder="Aljazeera.net" />
    </docdata>
    <pubdata type="web" position.section="�����" />
    </head>
    - <body>
    - <body.head>
    - <hedline>
    <hl1>������� �������� ������</hl1>
    </hedline>
    - <byline>
    <person>�������</person>
    </byline>
    - <dateline>
    <location>�����</location>
    <story.date>31/03/1999</story.date>
    </dateline>
    <abstract>����� ����������� �������������� ���� ����� �������� ���� ��� ������� ������ �� ����� ������.</abstract>
    </body.head>
    <body.content>���� ������: �� ��� ��������. ���� ���� ��� ���� ���� �� ���� ����.</body.content>
    </body>
    </nitf>
    and stylesheet file is as follows:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" >
    <xsl:output method="xml" indent="yes"/>
    <xsl:template match="/">
    <xsl:for-each select="NITF_News/News/nitf">
    <xsl:value-of select='body.head/hedline/hl1'/>
    </xsl:for-each>     
    </xsl:template>
    </xsl:stylesheet>
    Now can anyone tell me why is this coming up
    Thanks
    Raj

    Sorry for that
    This is the xml file as follows : --
    <?xml version="1.0" encoding="UTF-16" ?>
    - <NITF_News xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:user="http://mycompany.com/mynamespace">
    - <user_data>
    <client_no>31</client_no>
    <profile_id>57</profile_id>
    <private_key>5A07A6F0-0535-46E8-87CF-398062BA77C3</private_key>
    </user_data>
    - <News>
    - <nitf id="365751">
    - <head>
    <title type="main">���� ���� ��� ����� �� ������� ���������</title>
    - <tobject toobject.type="������ ��������">
    <tobject.subject tobject.subject.type="�����" tobject.subject.matter="������ ������" />
    </tobject>
    - <docdata>
    <date.issue norm="29/09/2002" />
    <doc.copyright year="YYYY" holder="Aljazeera.net" />
    </docdata>
    <pubdata type="web" position.section="�����" />
    </head>
    - <body>
    - <body.head>
    - <hedline>
    <hl1>���� ���� ��� ����� �� ������� ���������</hl1>
    </hedline>
    - <byline>
    <person>none</person>
    </byline>
    - <dateline>
    <location>�������</location>
    <story.date>29/09/2002</story.date>
    </dateline>
    <abstract>���� ���� ���� ���������� ��� ����� �� ������� �������� �������� �� �������� ���� ��� ������� ������ ����� �� ������� �������� ���������. ��� ���� ������ ����� ��������� �� ���� ������ �� ����� ������ �� ������ ��� ������� ������.</abstract>
    </body.head>
    <body.content>������ ���� ���� ����� ��� ������ ��� ������� ������ ������ ����� ��������� ���� ���� ���� ���������� �� ����� ������ �������� ��� ����� �� ������� �������� �������� �� ������� ���� ��� ���� ������ ������� ��� ������ �� ����� ������ ���������. ���� ���� ��� �� ����� ���� ���� ���� ���� ������ "����� ����� ���� ����� ����� �� ������ ��������� �� ����� ��� ���� ���� ����"� ����� ��� �� ��� ������ ����� ��� ���� ������� ����� ��� ���� ������� ������ �� ���� ������. ����� ������ �� ����� ��� ����� ������ ������ ��������� ������� ����� ������ ������ ������ ��� �� �� ��� ��� �������� �������� ����� ������ �� ���� �������� �� ��� �������. ��� ���� ������ ����� ��������� �� ���� ������ �� ����� ������ ������� ������ �� ������ ����� ���� ��� ����� ����� ����� �� ���� ����� ������ �������. ���� �������� �������� �� ��� ����� ��� �������� ���� ����� �� ������� ������ ���� ���� ��� ���� ����� �� ��� ������ ����� ������� ��� ��� ��� ����� ���� ������ ��������. ���� ������ ������� ������ �� ������� �������� �� ������� ��� ��� ���� ����� �� ������ ��� ����� ������� ������� ������� ����� ��� ���� ������� ���������. ���� ��� �� ���� ���� ����� ����� ���� �� 800 ��� ��� ��� 1968 �� ������ ���� ���� ��� ����� ���� ������ ������ �� ���� ������� ����� ��� �����. ����� �������� ������� �������� �������� ��� ������ ��������� ����� �������.</body.content>
    </body>
    </nitf>
    </News>
    </NITF_News>
    I have a java program which will parse this xml file using an xsl file and will produce another xml file as desired by me .This new xml file format will be defined in the xsl file as follows
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" >
    <xsl:output method="xml" indent="yes"/>
    <xsl:template match="/">
    <?xml version="1.0" encoding="UTF-16"?>
    <businessnews>
    <xsl:for-each select="root/nitf">
    <story>
    <h1 color="RED">
    <headline>Headline<xsl:value-of select='mitem_maintitle'/></headline>
    <author>Author</author>
    <summary>Summary<xsl:value-of select='mitem_summary'/></summary>
    <article>Article</article>
    <date>Date<xsl:value-of select='published_date'/></date>
    <category>Category<xsl:value-of select='el_topics/main_topic_desc'/></category>
    </h1>
    </story>
    </xsl:for-each>
    </businessnews>
    </xsl:template>
    </xsl:stylesheet>
    Now it is always giving the error message as follows
    The processing instruction target matching "[xX][mM][lL]" is not allowed.
    Hoping for a positive reply
    Thanks
    Raj

  • How to validate the Xml File With Java

    Hi,
    Can pls tell me. I want to validate the XML File for the Some Mandartory TAG. if that if Tag null i want to generate error xml file with error and i want move another folder with java. pls help me as soon as possible

    Use a validating parser (any recent Xerces, for one) and switch on the validation feature. Very much vendor-specific, so look at the docs of your parser. Oh, you do have a schema for these documents, don't you?

  • Binding Xml file with Xsd Schema

    Hello
    everybody there.
    I am trying to make an application where word files are converted into xml.
    For that i have used org.exolab.castor and org.apache.poi.hwpf.
    Now the problem is that i was able to generate the xml file from word, but when i am binding it with XMLSchema.xsd following error is coming.
    java.lang.IllegalArgumentException: getSimpleType: the simple type 'formChoice' is not a built-in type as defined in XML Schema specification.
         at org.exolab.castor.xml.schema.Schema.getSimpleType(Schema.java:1289)
         at org.exolab.castor.xml.schema.Schema.addSimpleType(Schema.java:583)
         at org.exolab.castor.xml.schema.reader.SchemaUnmarshaller.endElement(SchemaUnmarshaller.java:643)
         at org.exolab.castor.xml.schema.reader.Sax2ComponentReader.endElement(Sax2ComponentReader.java:198)
         at org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1392)
         at org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:1550)
         at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1149)
         at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
         at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
         at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:430)
         at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:485)
         at TempHwpf.<init>(TempHwpf.java:35)
         at TempHwpf.main(TempHwpf.java:44)the code for binding my xml file with xsd schema is as under:-
    SourceGenerator sourcegen = new SourceGenerator();
    sourcegen.getVersion();
    System.out.println(sourcegen.getVersion());
    sourcegen.generateSource("XMLSchema.xsd","packagename");I have checked XMLSchema.xsd file, in that formChoice is already defined, than also error is coming.
    can anyone help me out. first i thought that XMLSchema.xsd which i have is not proper, but i downloaded it again from w3c.org,
    than also same error is shown.
    please help me out.
    waiting for reply.
    milind

    Please do not double-post. http://forum.java.sun.com/thread.jspa?threadID=5134447&tstart=0
    Then use Stax (Woodstock) or Saxon.
    - Saish

  • How can I save a XML file with JAXP1.1?

    Dear All.
    I write a program to create XML file with DOM model, but I can't know how to save it? My environment is JAXP1.1 and JDK1.3.1,I has been required not use other XML parser toolkits,only JAXP1.1.
    How can I do? thank you.
    Many person give me a idea the com.sun.xml.tree.XmlDocument, but I can't find the class in API document or JAXP1.1's packages. why?
    what is it? How can i use it?
    thank you very much.

    The way to save an XML Document is using a Transformer.
    To have access to a transformer use the packages :
    import javax.xml.transform.*;
    import javax.xml.transform.dom.*;
    import javax.xml.transform.stream.*;
    Then for saving your Document Object (named dXml) get a Transformer Object with the TransformerFactory Object :
    TransformerFactory tf = TransformerFactory.newInstance();
    Transformer t = tf.newTransformer();
    Now you have got your Transformer Object, to save your Document Object use the method :
    Document dXml = getMyDocument(); // this is your Document Object.
    OutputStream osSave = getMySaveStream(); // this the OutputStream you need to save your Document.
    try
    t.transform(new DomSource(dXml), new StreamResult(new OutputStreamWriter(osSave)));
    finally
    osSave.close();
    And your Document was now saved.

Maybe you are looking for

  • Unable to Import Transport Request

    HI all, I was trying to import some Transport request, but it pops an error: ERROR: "Transport control program tp ended with error code 0012" "Errors: A tool used by tp aborted". Any ideas, Thanks. Ravi.

  • Problem opening PDF attachments

    When I try to open some PDF attachments from Mail, I get a blank screen.  If I try to open the same attachment in a program like Good Reader, I get a message that the file is not valid.  I can however open the file from Microsoft Outlook without any

  • Moving 2 different movieClips at same time onPress function

    Hello, Im using the following code to simulate a volume control bar filling on vol+ and unfilling on vol-. The dragger is a mask that causes the fill to appear and dissappear when the mouse is pressed and dragged on the volume controller. It works we

  • How can i know the month and year when my ipod classic was manufactured ?

    assuming i only have its serial no.

  • 'Show View Options" window colors is screwed up

    If I open a folder window and then select Show View Options from the View menubar item I can change the color of that window. However, it will change to some completely different color after I close that window then reopen it. Upon closing and reopen