XML from a schema

I was able to find information on how to validate an xml file based on an existing schema, but how about generating an xml file using a schema. Are there java API's for that?
I looked at a couple of the java.xml classes and couldn't find anything. I'd like to be able to go through each schema element, get the attributes, and actually construct an XML file. Can someone please point me in the right direction?
Thanks.

I was looking for a programmatic way to do this, so given the choices it seems like JAXB is the best, as XMLSPY & InfoPath are actual applications.
* XMLSPY from Altova has a menu item to generate aFrom their website it seems like it is built to work with Eclipse, but I'm not looking for an IDE, but a java API.
>
* I've used JAXB from the web services developer pack
to compile a schema, fill up the elements using the
get and set methods, and then marshall out to an XML
instance document. I'll look into this--is this the main java API that's used for generating XML documents from a schema?
>
* Or, crossing to the dark side for a moment,
Microsoft's InfoPath 2003 sucks in an XML Schema
document and presents a GUI through which you can
create an instance XML document. I actually found
this a very handy tool for quickly and accurately
building instance documents.Yeah, I think just like XMLSPY I don't know if there are methods I can call from within java to do this, I think I'll probably go with JAXB.
See what you think.Thanks for the advice.

Similar Messages

  • JAXB: How to unmarshal from xml contains two schemas?

    Hi, all.
    My question is in subject.
    Ex.)
    schema1.xsd:
    (snip)...
    <xsd:element name="xxx">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    ...(snip)
    schema2.xsd:
    (snip)...
    <xsd:element name="yyy">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element ref="zzz" minOccurs="1" maxOccurs="1"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="zzz" type="xsd:string"/>
    if I have a xml like the following, xml validation is correct:
    sample.xml:
    (snip)...
    <ns1:xxx xmlns:ns1="...(schema1.xsd)...">
    <ns2:yyy xmlns:ns2="...(schema2.xsd)...">
    <ns2:zzz>SAMPLE</ns2:zzz>
    </ns2:yyy>
    </ns1:xxx>
    I want to unmarshal from this xml using JAXB, but actually ths xxx didn't have any tag in List class given getAny() method, because xxx doesn't know about yyy, I think.
    These schemas cannot change as requirements of customer.
    How to unmarshal from xml contains two schemas using JAXB?
    tx.

    I solved it myself.
    JAXBContext can be specified many context path at same time.
    Ex.)
    context = JAXBContext.newInstance("package1:package2:package3...");
    So, unmarshaller can know how to choose what be instanced.
    tx.

  • Generate database schema in XML from database structure

    hi
    I want to generate the entire database schema in XML from database structure. (Same feature is provided by Altova XMLSpy).
    It would be great if there was some API that does the process of parsing the database structure and generating the XML automatically. A similiar feature is provided by Apache DdlUtils' API, but a stable version is not yet available...
    Please help!
    Thanks in advance.

    Nikhil,
    There is a wealth of information available on the Internet regarding the XML capabilities of the Oracle database.
    Have you done an Internet search for "SQL XML Oracle"?
    Good Luck,
    Avi.

  • ORA-20100: Error occurred while parsing (from xml in custom schema)

    Hi,
    I am using xmlParser and xmlDom to extract information from xml document. My whole process works perfectly in the APPS schema on the Oracle e-Business Suite. The minute I move it to a custom schema (ie new User) I get this error.
    ORA-20100: Error occurred while parsing: Element '' used but not declared.
    This only occures at runtime. I am pretty sure I grant the correct SELECT and EXECUTE privileges to this Schema. If I hadn't then it would not compile. It compiles without errors on the Database.
    Any help will be appreciated.
    Thanks in advance.
    Regards
    Dave

    I just tried this again. I have Oracle9i 9.0.1.1 on my Windows
    2000 laptop.
    I went to OTN and downloaded the XDK 9.0.2D for PL/SQL
    I used loadjava to load the \oracle\ora90\rdbms\jlib\xdb_g.jar
    file into the database (shouldn't have had to do this) into the
    XMLBOOK account. Filed a bug for needing to do this by hand.
    I ran "xdkload.bat" with xmlbook/xmlbook as the username/password
    I made sure the proxy server name was set correctly in the
    example (if you don't need a proxy server, comment out that line
    in the parse_xml_news.sql example, or that could cause your
    error!!)
    I ran the parse_xml_news.sql script, and I get:
    Top Stories on XML from Moreover.com on December 21st, 2001
    ( 1) CEO highlights Mercator Softwares single biggest opportunity
    ( 2) WWRE Chooses webMethods
    ( 3) WebMethods, retail exchange ink deal
    ( 4) Worldwide Retail Exchange Chooses webMethods
    ( 5) Worldwide Retail Exchange Chooses webMethods
    ( 6) WorldWide Retail Exchange choses webMethods for integration
    ( 7) XML: Wherever You Go, There You Are
    ( 8) Chap. 13: Metadata
    ( 9) Enterprise Adoption of XML Made Simple
    (10) XML Databases
    (11) Using CSS2 to display XML documents
    (12) How XML could bring an end to all of your troubles
    (13) Effort Launched To Bring Classic Macs Rich Metadata To Mac
    (14) Sneak attack on Pearl Harbor roused publics anger, resolve
    (15) Drug dogs whiff worth $230,000
    (16) PORTLAND Police target
    (17) 11-year-old cant seem to get out of jury duty
    (18) Another casualty of war: Proposed waterfront museum
    (19) webMethods Establishes Sales Operations in Brussels
    (20) Using Emacs for XML documents
    (21) Gates: XML could be everything we dreamed...
    (22) XML: The end of all your troubles?
    (23) Java XML
    (24) Tool To Compare XML Files
    (25) Fairfax County Sends webMethods to School
    (26) webMethods Embraces Web Services
    (27) WebMethods Supports Web Services
    (28) Accessing metadata through Reflection
    (29) When format is foremost
    (30) Views from Abroad: XML Pipelines and Delta XML

  • How to generate XML from XML schema

    Hi,
    I have registered XML schema and I would like to construct XML document for the schema. I wonder it is possible to create an empty instance and then populate it with the data? One solution is to construct the XML with concatenation of the elements but I think it exists more flexible and intelligent way. I read OTN and Metalink samples, documentation and forums users’ examples but I did not find any appropriate. What is the ordinary way for XML construction? Can you give me some advice? Tank you in advance.
    Best regards,
    Georgi

    The JAXB Class Generator generates java classes with the
    orajaxb utility.
    oracle.xml.jaxb.orajaxb -schema <schemafile> -outputDir <outputdir>
    The java classes generated have get/set methods to construct an XML document.
    thanks,
    Deepak

  • Unable to load any XML from JAR - Please help!!

    Hi All,
    I am a student in the final days of my degree. I have been working on my final project for some time now, an applet which converts input text to a signal plot for line encoding schemes - AMI, NRZ etc. It is pretty much finished, but one small bug threatens to scuttle the entire project! I have been searching the web all day long for answers with little success, and as the castor forum still appears to be down I am posting here. Any suggestions or advice would be greatly appreciated.
    The applet uses the castor databinding framework to load various XML data. I am using Eclipse 3.01 for development - when the program is run locally as an applet, everything works fine. When the program is bundled into a JAR file and nested into a clean folder with a html page and the jar file, when the command to read in XML is given, a NullPointerException occurs, indicating that castor was unable to access the XML files.
    Below is one of the methods used to make castor load XML data:
         public CodeSet loadCodeXML(String _codesetFilename)
              String _mappingURI = "schema/codes/codesets-mapping.xml";
              String _codesetURI = "schema/codes/" + _codesetFilename;
                    // Create a new Castor mapping object
              Mapping mapping = new Mapping();                         
            try                                                                 // Attempt to load in the selected XML character set
                 mapping.loadMapping(_mappingURI);                    // Initialize 'mapping' with the map file
                Unmarshaller unmar = new Unmarshaller(mapping); // Create a new XML Unmarshaller that uses 'mapping'
                // The line below creates a new CharSet object called _codeset and populates it with the XML data
                CodeSet _codeset = (CodeSet)unmar.unmarshal(new InputSource(new FileReader(_codesetURI)));
                // The character set was successfully loaded, so pass new CharSet object back to caller and end
                return _codeset;
            } catch (Exception e) {
                 // If an error occurs while extracting the XML data, this block will execute:
                JOptionPane.showMessageDialog(null, e);               // Display a message dialog containing the exception error
                return null;                                             // Do not return a CharSet object to caller
         }It would seem to me the problem lies within
              String _mappingURI = "schema/codes/codesets-mapping.xml";
              String _codesetURI = "schema/codes/" + _codesetFilename;I have read that files inside a JAR can be accessed in this way ( http://archive.codehaus.org/castor/user/msg00025.html ) but it won't appear to work.
    If these are set to a full system path (outside any JAR) i.e. "/home/me/proj/schema/codes/codesets-mapping.xml", the application operates fine. Clearly this is no good however, as the XML data must reside within the JAR package. I have tried many permutations such as "jar://schema/..." , "/schema/..", "schema/..", with no success. I have read of using InputStream and getResource methods to access files within the jar but have had no success. I have checked the schema dir is being put into the JAR archive.
    Could anyone suggest an appropriate way of loading XML files from within a JAR file in this context?
    Thanks in advance for any replies.

    Hi, me again..
    Re: mr_doghead - the filename of the file is passed from the calling function
    public CodeSet loadCodeXML(String _codesetFilename)eg loadCodeXML(ami.xml) will return a CodeSet object containing the ami xml data
    Anyway, I've manged to fix it up. The problem actually lies within castor, not my code at all. This is a known bug in castor that the dev's deemed 'not important' to fix, but I have to say the work around is EXTREMLY poorly documented online. Hence, this post is just to say how to fix it up if ne1 else is having trouble...
    To load mappings, use:
    mapping.loadMapping(getClass().getResource(_mappingURI).toString());where _mappingURI is a string such as "/xml/mapfile.xml"
    However, the unmarshalling method takes in a file object, so getResourceAsStream must be used:
    CharSet _charset = (CharSet)unmar.unmarshal(new InputSource(getClass().getResourceAsStream(_charsetURI)));Where CharSet is your custom object you are marshalling into, and _charsetURI is a relative path to your xml file.
    Ugly as hell? Very.
    Does it work? Perfectly.
    take it ez guys, time for me to go hand this sht in! ;D

  • Generating XML from database

    I'm a total newbie in XML DB and need advice on generating XML from database.
    The situation is the following: there is a legacy web application which uses an XML document as a configuration file. This document conforms to some well-defined schema. For instance:
    <config>
         <title value="TITLE" />
         <subtitle value="SUBTITLE" />
         <style url="default.css" />
         <widgets>
              <widget id="1" opened="true" />
              <widget id="2" opened="false" />
         </widgets>
    </config>
    It contains portions of static data which are common for all users as well as dynamic personal data.
    Dynamic data comes from two sources:
    1) security considerations (for instance, not all widgets are available for some users) - thus the "master" configuration content must be filtered, but not otherwise modified;
    2) user preferences (for instance, user can set widget2 to be opened by default) - thus values of some attributes must be different for each user. When the user saves her preferences, the entire document with new values is posted back to server.
    We want to try to store user preferences, apply security and generate personalized configuration documents using XML DB.
    So we need advice on storage models and generation procedures - which should be more efficient and easy to support or extend.
    Please note, that there is no requirement to actually store data as XML.
    Thanks in advance!
    P.S.: Sorry for the incomplete initial post.
    Edited by: WxD on 27.09.2010 11:45

    Hi,
    See this link for more details
    http://www.stanford.edu/dept/itss/docs/oracle/10g/appdev.101/b10790/xdb13gen.htm

  • XML validation against schema in XSD format

    I have a requirement for validation of XML file against XML schema(XSD format). Using IXML liabrary I know how to validate XML file against schema in DTD format. But i am not getting how to do it against XSD. Is it possible using IXML liabrary? Also i wanted to know how to attach one XML or CSV file into another XML file using SAP ABAP.
    Please provide solution!!

    Hi Madhura,
    see here my comparison of the web version against the local file version on my Windows box (which is itself not the fastest): It makes a factor 16 in difference!
    C:\Temp\xsdvalidator>java XsdValidator madhu.xsd madhu.xml
    cvc-pattern-valid: Value 'provamail.it' is not facet-valid with respect to patte
    rn '[^@]+@[^.]+[.].+' for type 'EmailType'.
    NOK - Validation error
    Elapsed time: 16353 ms
    C:\Temp\xsdvalidator>java XsdValidator madhu_local.xsd madhu.xml
    cvc-pattern-valid: Value 'provamail.it' is not facet-valid with respect to patte
    rn '[^@]+@[^.]+[.].+' for type 'EmailType'.
    NOK - Validation error
    Elapsed time: 994 ms
    Obviously, the w3c.org domain that you specified as ressource location is very slow - and, as the FAQ shows, this delay is intentional!
    The W3C servers are slow to return DTDs. Is the delay intentional?
    Yes. Due to various software systems downloading DTDs from our site millions of times a day (despite the caching directives of our servers), we have started to serve DTDs and schema (DTD, XSD, ENT, MOD, etc.) from our site with an artificial delay. Our goals in doing so are to bring more attention to our ongoing issues with excessive DTD traffic, and to protect the stability and response time of the rest of our site. We recommend HTTP caching or catalog files to improve performance.
    --> They don't want to have requests to their site from productive servers all around the world.
    Regards,
    Rüdiger

  • Mapping the xsd:any tag from one schema to other in BPEL

    I am using soa suite 11g
    I have 2 schemas with <xsd:any> tag
    at run time the xml based on one xsd can have tags as below in place of xsd:any tag
    <*number* xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeId="1001" readOnly="False">P00001</number>
    <*description* xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeId="1002" readOnly="False">Test Part created for Mapping</description>
    <*itemType* xsi:type="common:AgileListEntryType" xmlns:common="http://xmlns.oracle.com/AgileObjects/Core/Common/V1" attributeId="1081" readOnly="False">
    <selection>
    <id>10141</id>
    <apiName>Part</apiName>
    <value>Part</value>
    </selection>
    </itemType>
    <*lifecyclePhase* xsi:type="common:AgileListEntryType" xmlns:common="http://xmlns.oracle.com/AgileObjects/Core/Common/V1" attributeId="1084" readOnly="True">
    <selection>
    <id>976</id>
    <apiName>PRELIMINARY</apiName>
    <value>Preliminary</value>
    </selection>
    </lifecyclePhase>
    and in othe xsd it can be
    <key1001 attributeId="5001">P00002</key1001>
    <key1002 attributeId="5002">Test Part created for Mapping</key1002>
    I can create a DVM to have mapping of attribute id's values 1001 -5001 ,1002-5002 but how to wire/map the any nodes and the attribute id element of one any node to other in XSLT mapper.At design time I am not aware that what all tags can substitute in place of any.
    I need to map these two any tags.How to do this in transform activity xslt mapper in BPEL.It does not allow me to directly wire two any tags
    Request someone to help me on this.stuck on this for long .

    I have figured out that with xpath and copy-of operation I can copy all nodes that come in place of xsd:any from one schema to other .But beofre copying I want to change the attribute values of the node that come in place of xsd:any based on the mapping stored in the DVM.Request some one to please help .

  • To generate a XML file against schema

    Hello,
    I am trying to parse a schema then against the schema to create new DOM object for the new XML file. After going through each element type from the schema DOM and find the type of each element, I could not deal with <xsd:sequence>. I could parse the schema without <xsd:sequence> well, but I am stuck with "sequence".
    Any idea will be highly appreciated.
    The following is the fragement of the code:
    public string findType(Node el){
                String type="simple";
                if (el.getChildNodes().getLength()>0){
                    for (int j=1;j<el.getChildNodes().getLength();j=j++) {
            //out.println("The element" + el.getChildNodes().item(j).getNodeName());
              if (el.getChildNodes().item(j).getNodeName()=="xsd:complexType") {
               type = " complex ";
          else
                 type = " simple ";
           return type;
        }Thank you.
    Vica

    what does your code have to do with your problem. Does the code you have posted work? I don't see any reference to xsd:schema.

  • Error saving xml from model to file

    Hello.
    I am trying to create an xml file based on example GEO_DIM.dtd
    I have a dataserver
    jdbc:snps:xml?d=/oracle/product/odi_1/oracledi/demo/xml/GEO_DIM.dtd&s=MY_GEO_SCHEMA&lf=/logs/demo_geo_dim.log&ll=31
    xml model works fine. I can do Insert into and populate the whole model with data.
    When I try to save it on the disk using (on target)
    create xmlfile ' /tmp/test_demo_geo.xml' from schema MY_GEO_SCHEMA
    I get an error
    ODI-1272: The Logical Schema has not been set on source for populate_demo_geo.
    Caused By: java.lang.NullPointerException
    at com.sunopsis.jdbc.driver.xml.SnpsXmlPreparedStatementRedirector.executeUpdate(SnpsXmlPreparedStatementRedirector.java:625)
    What this driver wants from me?
    I just want to write the xml I’ve created to the disk.
    I’ve tried to do this CREATE XMLFILE command on source, but, it doesn’t help either. I just receive
    java.lang.NullPointerException
    at com.sunopsis.jdbc.driver.xml.SnpsXmlPreparedStatementRedirector.executeUpdate(SnpsXmlPreparedStatementRedirector.java:625)
    at com.sunopsis.jdbc.driver.xml.SnpsXmlPreparedStatement.executeUpdate(SnpsXmlPreparedStatement.java:113)
    Please, It just makes me mad, sorry…

    Hi Lembit,
    Thanks for posting current syntax to write the xml file.
    Even i am triying the same to write out an xml file from my xml schema.
    I executed my interface which inserted 3 records into target XML schema and inserted data i can in the XML model data store.
    I wrote a procedure to write XML schema data including newly inserted 3 records, i went through,but all record of XML model is written into file.
    my create xml command looks like create xml file "D:\temp\XML\gan_out.xml" from schema DEPT_TRG_SCH.
    Now i have around 10 records in the XML datastore in target XML model. I want to write an XML file each record from XML data store.
    Please help,
    Thanks,

  • Extracting XML from Pdf form

    There is an industry standard pdf form with an underlying XML schema which can be opened in Adobe reader.
    The form has a custom button on Page 2  called "export" which can be manually clicked to export the XML file.
    We will have hundreds of these forms. How would I automate the extraction of this XML document?
    I would prefer to just write a simple script and extract out the xml to a file folder
    Thanks for your help.

    Thanks Patrick.
    We are thinking about using a third party native Java library to do this (http://www.qoppa.com/pdffields/jpfindex.html). I was hoping we could use acrobat reader, since everyone has it!
    Here are a few more things.
    1. We are an Software Vendor that sells our solutions - our software solutions need to extract the xml from pdf. We have a java based program that parses this xml and does stuff with it.
    2. Obviously, we would need to be able to redistribute whatever solution we use to extract the xml from pdf.
    3. Can Acrobat Professional batch mode be executed from Java?
    4.. If so, Instead of distributing a full blown Acrobat Professional or requiring customers to buy it,  is there a library that Adobe provides that we could repackage and ewdistribute? If so, can you send me some pointers on where I could find what those libraries would be and how much would they cost for each distribution we do.
    5. If no, are you familiar with qoppa or do you have recommendations on any other third party libary for Java?
    Thanks a bunch!

  • Validate xml againt registerd schema, ignoring xsi:noNamespaceSchemaLocatio

    hi,
    i would like to validate received xml against registered schema, ignoring the one defined in xml. I use XMLisValid(xml_data ,schema_url) but it works only if there is no xsi:noNamespaceSchemaLocation attrubute.
    This is sample xml.
    <?xml version="1.0" encoding="UTF-8"?>
    <!--Sample XML file generated by XMLSPY v2004 rel. 3 U (http://www.xmlspy.com)-->
    <ROOT xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://localhost/public/xsd/myapp.xsd">
         <ID>0</ID>
         <INFO>
              <INFO_ID>0</INFO_ID>
              <INFO_CONTENT>Text</INFO_CONTENT>
         </INFO>
    </ROOT>
    Anybody knows if it is possible?
    Thanks in advance..

    Hi,
    It should work according to the documentation, but obviously it doesn't.
    So I guess you'll have to consider one of these options :
    - Changing the xsi:noNamespaceSchemaLocation at the source to use the URL of your registered schema instead
    - The other way around : register your schema at the URL defined in the document
    - Removing the xsi:noNamespaceSchemaLocation attribute prior to validation
    Here's an example for the third option :
    BEGIN
      dbms_xmlschema.registerSchema(
        schemaURL => 'myapp2.xsd'
      , schemaDoc =>
    '<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:element name="ROOT">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="ID" type="xs:integer"/>
            <xs:element name="INFO">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="INFO_ID" type="xs:integer"/>
                  <xs:element name="INFO_CONTENT" type="xs:string"/>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:schema>'
      , local => true
      , genTypes => false
      , genTables => false
    END;
    SQL> declare
      2 
      3    doc xmltype := xmltype('<?xml version="1.0" encoding="UTF-8"?>
      4  <ROOT xmlns:xdb="http://xmlns.oracle.com/xdb"
      5        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      6        xsi:noNamespaceSchemaLocation="http://localhost/public/xsd/myapp.xsd">
      7  <ID>0</ID>
      8  <INFO>
      9  <INFO_ID>0</INFO_ID>
    10  <INFO_CONTENT>Text</INFO_CONTENT>
    11  </INFO>
    12  </ROOT>');
    13 
    14    isValid integer;
    15 
    16  begin
    17 
    18    doc := doc.deleteXML('/ROOT/@xsi:noNamespaceSchemaLocation','xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"');
    19 
    20    select xmlisvalid(doc, 'myapp2.xsd') into isValid from dual;
    21 
    22    dbms_output.put_line('isValid = '||to_char(isValid));
    23 
    24  end;
    25  /
    isValid = 1
    PL/SQL procedure successfully completed

  • Creating weblogic-cmp-rdbms-jar.xml from JDeveloper 10g

    Hi
    is any one aware if I can create the weblogic-cmp-rdbms-jar.xml from the Jdeveloper 10g. I know that it definitely does not have this deployment discriptor in the list.
    Is there any other way of creating this via JDeveloper.
    if not would it be a good feature to have?

    A schema for weblogic-cmp-rdbms-jar.xml may be registered and an XML document based on the schema generated.

  • Schema Validation on attributes of an element in XML againt XSD schema

    Hi,
    I had generated artifact java classes from XSD schema file.Now i am validatiing one sample XML document by using these classes in JAXB.The XML document is validated successfully.but only elements are validated ,but not attributes of that elements.for example ,i am giving wrong element which is not defined inside the schema file,it throws validation error as expected ,whereas validation against wrong attributes of elements in XML it is not working anyway,it does not throw any validation errors,but it should throw validation errors.kindly help me to solve this issue.
    Here The sample validation code snippets :
    import javax.xml.bind.ValidationEvent;
    import javax.xml.bind.ValidationEventHandler;
    import javax.xml.bind.ValidationEventLocator;
    public class MyEventHandler implements ValidationEventHandler{
         public boolean handleEvent(ValidationEvent ve) {
              if (ve.getSeverity()==ValidationEvent.FATAL_ERROR ||
                        ve .getSeverity()==ValidationEvent.ERROR){
                   ValidationEventLocator locator = ve.getLocator();
                   //Print message from valdation event
                   System.out.println("Invalid booking document: "
                             + locator.getURL());
                   System.out.println("Error: " + ve.getMessage());
                   //Output line and column number
                   System.out.println("Error at column " +
                             locator.getColumnNumber() +
                             ", line "
                             + locator.getLineNumber());
              return true;
    Unmarshaller unmarshaller = jc.createUnmarshaller();
    unmarshaller.setEventHandler(new MyEventHandler());

    Here is my analagous 'strange' behavior. I am jaxb processing and then marshalling generated classes to XML ( following the simple Sun 'PurchaseOrder' example )
    1. This works:
    <xsd:schema....>
    <xsd:complextType name = "myName">
    <xsd:attribute name='name1'>
    </xsd:complextType>
    </xsd:schema>
    2. This doesn't:
    <xsd:schema....>
    <xsd:complextType name = "myName">
    <xsd:attribute name='name1'/>
    <xsd:attribute name='name2'/>
    </xsd:complextType>
    </xsd:schema>
    That is, using more than one attribute line within this simple complex type causes nothing to be marshalled to XML.
    Ideas?

Maybe you are looking for