JAXB Namespace Requirements

I was able to solve the unexpected root element error by including the namespace in the xml. Is there a way to configure JAXB to work with or without the namespace?

Here is an excerpt from the top level schema: Is there anything here that would require the use of a namespace?
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v5 rel. 2 U (http://www.xmlspy.com) by Salim Djaffar (WaMu) -->
<xs:schema targetNamespace="http://schema.wamu.com/wamuhomeloans/loan/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:crm="http://schema.wamu.com/crm/customer/" xmlns="http://schema.wamu.com/wamuhomeloans/loan/" elementFormDefault="unqualified" attributeFormDefault="unqualified" version="2.6">
     <xs:include schemaLocation="loantypes.xsd"/>
     <xs:import namespace="http://schema.wamu.com/crm/customer/" schemaLocation="crmtypes.xsd"/>
     <xs:element name="NoteHistoryRequest" type="NoteHistoryRequestType"/>
     <xs:element name="NoteHistoryResponse" type="NoteHistoryResponseType"/>
     <xs:complexType name="NoteHistoryRequestType">
          <xs:sequence>
               <xs:element name="LoanInformation" type="LoanInformationType" minOccurs="0"/>
               <xs:element name="ListFilter" type="ListFilterType" minOccurs="0"/>
          </xs:sequence>
     </xs:complexType>
</xs:schema>

Similar Messages

  • JAXB.NewInstance requires jaxb.properties in JAXB 2.0

    The XJC in JAXB 2.0 does not generate the jaxb.properties file, but the JAXBContext.NewInstance requires it.
    I am sure that the old JAXB is not installed on my machine, because I just got a new machine and only installed the JAXB 2.0.
    I am using Oracle JDeveloper on Windows XP and I have the following environment vars:
    JAVA_HOME=C:\Oracle\10g\jdk\jre
    JAXB_HOME=C:\Oracle\10g\jaxb
    CLASSPATH=c:\oracle\10g\jaxb\lib\jaxb-api.jar;c:\oracle\10g\jaxb\lib\jaxb-impl.jar;c:\oracle\10g\jaxb\lib\jaxb-xjc.jar + some other files
    My code is nothing special:
    JAXBContext loJAXBContext = JAXBContext.newInstance("si.ixtlan_team.bibliotheque2.materialdata");
    Did anyone have a similar problem and knows the solution?
    Thanks,
    Bogdan

    Can you please let me know how did you solve it. I ahve the same problem in jdeveloper. even though I load jaxb2.0 library manually, runtimr jdeveloper picks up 1.o library.
    Thanks

  • JAXB & Namespace

    Hi,
    can anyone tell me what's going wrong.
    XML-Schema:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <xsd:element name="journal">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="item" maxOccurs="unbounded" type="xsd:string"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
    </xsd:schema>XML-Document to used by JAXB:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:journal xmlns:ns0="a-namespace">
      <item>String1</item>
      <item>String2</item>
    </ns0:journal>The classes were generated by xjc (jwsdp-1.1).
    Executing a very simple unmarshalling test throws:
    javax.xml.bind.UnmarshalException
    - with linked exception:
    [org.xml.sax.SAXParseException: unexpected root element ns0:journal]
    ...thank's for your help
    -chris

    Deepak,
    thanks a lot. Finally I got it with this XML-Schema:
    <xsd:schema attributeFormDefault="unqualified"
                targetNamespace="a-namespace"
                xmlns="a-namespace"
                xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
                jxb:version="1.0">
      <xsd:annotation>
        <xsd:appinfo>
          <jxb:globalBindings bindingStyle="elementBinding"
                              choiceContentProperty="false"
                              collectionType="java.util.Vector"
                              enableFailFastCheck="false"  
                              fixedAttributeAsConstantProperty="true"
                              generateIsSetMethod="false"
                              typesafeEnumBase="xsd:NCName"
                              typesafeEnumMemberName="generateError"
                              underscoreBinding="asCharInWord"/>
          <jxb:schemaBindings>
            <jxb:package name="package.name"/>
          </jxb:schemaBindings>
        </xsd:appinfo>
      </xsd:annotation>
      <xsd:element name="journal" type="journalType" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
      <xsd:complexType name="journalType" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="a-namespace">
        <xsd:sequence>
          <xsd:element name="item" minOccurs="1" maxOccurs="unbounded" type="xsd:string"/>
        </xsd:sequence>
      </xsd:complexType>
    <xsd:schema>

  • JAXB NameSpace URI

    I am currently using JAXB for data binding to our schemas. However, we maintain our schemas in each of our environments (Dev, Test, and Production). In each environment the schemas contain different namespace URIs that are relative to their environment.
    Is there anyway to compile JAXB so that it doesn't care what NameSpace URI is? This is important when validation (via JAXP) occurs so it doesn't fail when unmarshaling an XML instance generated from a different environment.
    If this is not possible my only option would be to compile 3 sets of objects for dev, test, and production which would not be a great approach : (
    Thanks
    Brian

    Having different name spaces but wanting one set of objects seem contradictory. The motivation for wanting separate name spaces frequently justifies separate objects.
    You could try specifying the same value to -p when you compile each of the schemas. This would place the bindings in the same package. However, you might run into name collisions, which you then would need to resolve (with an external binding file, e.g.).
    Regards,
    -- Ed

  • JAXB namespace common elements

    Hi,
    I'm generating a parser according to 3 DTDs:
    main.dtd
    devinf.dtd
    metinf.dtd
    I have translated the DTDs in 3 XML schemas with DTD to XML Schema translator (found on w3c) that Translate a Document Type Definition (XML 1.0 DTD) into an XML schema (REC-xmlschema-1-20010502):
    http://puvogel.informatik.med.uni-giessen.de/dtd2xs/
    The main.dtd contains an element Meta defined such as:
    <!-- Meta element type -->
    <!-- Element types in the content MUST have name space declared. -->
    <!--The Meta content would be something such as:
    <Meta>
    <Type xmlns='metinf'>myType</Type>
    <Format xmlns='metinf'>myFormat</Format>
    </Meta>-->
    <!ELEMENT Meta (#PCDATA)>
    AND 2 elements Format and Type!!!!
    Converting to Schema:
    <xs:element name="Meta" type="xs:string" />
    <xs:element name="Format" type="xs:string" />
    <xs:element name="Type" type="xs:string" />
    The metinf DTD defines the elements Type and Format such as after converting in schema we have:
    <xs:element name="Format" type="xs:string" />
    <xs:element name="Type" type="xs:string" />
    The devinf DTD defines also these two elements !!!!
    I tried to modify the main schema to import the devinf and metinf schema. However when I try to compile, I receive the error that the compiler atempts to generates the same interface (Format and Type) from the 3 different schema.
    (compile line is:
    xjc -jar %JAVA_LIBS%\jaxb-xjc.jar -p mypackage devinf.xsl metinf.xsl main.xsl)
    How could I do to obtain a Parser that could read and write the following XML:
    <!-- These Format and Type refer to main.dtd -->
    <Format>formatA</Format>
    <Type>typeA</Type>
    <Meta>
    <!-- These Format and Type refer to metinf.dtd -->
    <Format xmlns="metinf">formatB</Format>
    <Type xmlns="metinf">typeB</Type>
    </Meta>
    <!-- These Format and Type refer to devinf.dtd -->
    <Format xmlns="devinf">formatC</Format>
    <Type xmlns="metinf">typeC</Type>
    Many thanks and sorry for my poor english!

    Sorry to disturb you....
    Sometimes you found you are really stupid.
    The solution for the above problem is to define a custom binding (specifying per example a different package for the different DTDs)
    Sorry again
    Tanguy

  • Along with Namespace require others atr like xmlns:xsi & xsi:schemaLocation

    Hi Experts,
    Could you please help me in creation of the XSD so that the output file from PI will contain the following message:
    Message xmlns="http://www.abc.com/schemas/" xmlns:xsi="http://www.w3.org/Schema-instance" xsi_schemaLocation="http://www.abc.com/schemas/ http://www.abc.com/schemas/4.0.0/2001/message.xsd" >

    Hi Experts,
    As i said  my requirement is to include the following in the output XML.
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation =="http://www.XYZ.com/schemas/ http://www.XYZ.com/schemas/4.0.0/2001/message.xsd">
    i have written the XSD as below
    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema targetNamespace="http://www.XYZ.com/schemas/"
         xmlns="http://www.XYZ.com/schemas/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:xsd="http://www.w3.org/2001/XMLSchema"
         xsi:schemaLocation="http://www.XYZ.com/schemas/ http://www.XYZ.com/schemas/4.0.0/2001/message.xsd">
         <xsd:element name="Message" type="Message" />
         <xsd:complexType name="Message">
              <xsd:sequence>
                   <xsd:element name="Head">
                        <xsd:complexType>
                             <xsd:sequence>
                                  <xsd:element name="field1">
                                       <xsd:complexType>
                                            <xsd:attribute name="Id" type="xsd:string" />
                                       </xsd:complexType>
                                  </xsd:element>
                             </xsd:sequence>
                        </xsd:complexType>
                   </xsd:element>
              </xsd:sequence>
         </xsd:complexType>
    </xsd:schema>
    but when  the correponding XML from this XSD donot have the
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation =="http://www.XYZ.com/schemas/ http://www.XYZ.com/schemas/4.0.0/2001/message.xsd">
    Any clue , how to handle this.

  • ABAP proxy based on XSD with specific requirement for NAMESPACE

    Hi
    I'm using PI 7.11
    My scenario is an ABAP proxy from SAP backend to filereceiver. NO mapping.
    The SI is based on an XSD from our customer, which have a targetnamespace, so a namespace requirement of six chars namely "SBSFL1:nnn".
    When sending the message from our SAP backend - SAP ALWAYS ignore this targetnamespace SBSFL1 and replaces it with nr1:nnn. Why? When taken the same XSD into xmlspy and generating sample XML et works great all nodes/fields have a prefix of SBSFL1 ....
    Why is PI 7.11 ignoring this targetnamespace requirement. I was hoping this was possible to archive WITHOUT any XSLT mapping or other "tricks" in the MAPPING runtime (i want to avoid any mapping because of performance)
    Hope for som help, since this is a major issue
    Cheers and thx in advance

    > Why is PI 7.11 ignoring this targetnamespace requirement.
    Because there is no standard having a specific namespace prefix.
    It does not make any difference which namespace prefix is used.
    Unfortunatly some developers don't about the XML standards and expect a specific namespace prefix, like PIDX.
    Blame them
    Regards
    Stefan

  • XSLT Transformer xmlns namespace problem

    Hi,
    I have the following xml document
    <PIPEDocument Version="2.0" DocumentReferenceNumber="2001" CreationDate="2002070401251212245"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://www.oeb.gov.on.ca/">
         <MarketParticipantDirectory>
    </MarketParticipantDirectory>
    </PIPEDocument>
    and the following xsl stylesheet
    <xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"
              xmlns ="http://www.oeb.gov.on.ca/"
              version = "1.0">
    <xsl:output method = "xml" indent = "yes" />
    <xsl:template match = "/" >
    <PIPEFunctionalAcknowledgement>
              <xsl:apply-templates select="//MarketParticipantDirectory"/>
    </PIPEFunctionalAcknowledgement>
    </xsl:template>
    <xsl:template match = "MarketParticipantDirectory" >
    </xsl:template>
    </xsl:stylesheet>           
    My problem is, using JAXP1.2.0-EA2 (from JWSDP1-0-ea2), javax.xml.transform.Transformer will not find a match on the element name within the template unless I put a prefix on the target namespace i.e.
    if my xml is changed to include a prefix (:xyz in example below)
    <PIPEDocument Version="2.0" DocumentReferenceNumber="2001" CreationDate="2002070401251212245"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:xyz="http://www.oeb.gov.on.ca/">
         <MarketParticipantDirectory>
    </MarketParticipantDirectory>
    </PIPEDocument>
    and my stylesheet is changed also to include the prefix
    <xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"
              xmlns:xyz ="http://www.oeb.gov.on.ca/"
              version = "1.0">
    </xsl:stylesheet>
    then the transfomer works correctly and find a match on the element name "MarketParticipantDirectory" within the template (even though the element doesn't have the prefix xyz:MarketParticipantDirectory).
    Could anyone tell me why this is the case?
    I would have expected XSLT to match the elements from the namespace xmlns ="http://www.oeb.gov.on.ca/" without the prefix.
    Any comments would be much appreciated.
    Thanks
    Sinead Casey

    Matching an element on a Default Namespace requires Explicit Prefix.
    http://www.w3.org/TR/xslt20req

  • JAXB Demo Crashes - using JDK 1.4.2

    I have installed the pack (1.6) with JDK 1.4.2. That finished 'ok'.
    Now I am getting the error: [java] java.lang.NoSuchMethodError: javax.xml.parsers.SAXParserFactory.getSchema()Ljavax/xml/validation/Schema;
    when trying to run the bind choice jaxb demo.
    As far as I can tell the javax.xml libraries in the java jdk1.4 are too old. How will this work with jdk 1.4 ?
    Thanks.

    Just FYI -
    (This issue is also discussed in this forum, named Java Forums - JAXB JDK requirement.)
    I had a hard time trying to figure out the -D and the build file config. I am using Eclipse 3.1, so it is supposed to take care of all this for me, right?
    In Eclipse, if you click on the right side of the Run button to open it up, then from the dropdown select Run, a new window will open up that has all of your projects displayed. Select your JAXB project (which might already be highlighted) and you'll see some tabs.
    Select the Classpath tab.
    Here you'll see Bootstrap Entries. On the right you'll see an Add Jars button. Click on it.
    Add the JAXB and JAXP jar files, per the Sun specs:
    jaxb-api.jar
    jaxb-impl.jar
    jaxb-libs.jar
    jaxb-xjc.jar
    jaxp-api.jar
    dom.jar
    sax.jar
    xalan.jar
    xercesImpl.jar
    ....basically all the jars in the JAXB and JAXP lib directories, including the endorsed files, will do.
    This will take care of this issue with JAXB and the 1.4.2 issue when you use Eclipse 3.1. Hope this helps, as it took an experienced Eclipse developer to show me this...

  • Is it a safe to install DFS namespace service to an Active Directory Server?

    Hi All,
    Is it safe and/or best practice to install a DFS namespace server to a server that runs an Active directory services?
    I have read a blog in which, as much as possible, active directory server should only run the directory services and no other installed services. But we're running out of a physical server and our virtual environments were already full so I'm hoping that
    DFS namespace server could be installed to the AD server.
    Also, if its possible , what could be the possible conflicts/problems/errors that we might encounter in the near future of running this 2 services into a single server?
    Appreciate any suggestions and feedbacks.

    Hi,
    >>Is it safe and/or best practice to install a DFS namespace server to a server that runs an Active directory services?
    Yes, we can host DFS namespace on domain controllers. However, as the following article states:
    When deciding whether to host a DFS namespace on a domain controller, consider the following factors:
    Only members of the Domain Admins group can manage a DFS namespace hosted on a domain controller.
    If you plan to use a domain controller to host a DFS namespace, the server hardware must be sized to handle the additional load. As described in the previous question, root servers that host large or multiple namespaces require additional memory.
    Distributed File System: Namespace Server Questions
    http://technet.microsoft.com/en-us/library/hh341468(v=ws.10).aspx
    Best regards,
    Frank Shen

  • Help in Java XML Binding (JAXB)

    Looking for a JAVA written program that will provide interface to complex XML files using JAXB.
    Requirement : JAVA progam will report on existing XML using a simple GUI that will run on Windows. Program should be able to be emailed and installed with all components including XML files and schema. Purpose of this program is twofold.

    Sir,
    It is bad to expect people to solve assignments for you. Would you elaborate on where you are stuck?

  • JAXB for previous versions of Java

    Will JAXB work with previous versions of Java. Say like Java 1.3 ?
    Thanks,
    - Liju.

    "The JAXB RI requires J2SE 1.3.1 or later"
    http://java.sun.com/xml/jaxb/users-guide/jaxb-intro.html#configure

  • Default namespace

    We are using the default clause with xmlnamespaces. However, it does not support the use of a variable, only a string literal.
    How do we avoid hardcoding this namespace in the PL/SQL? Typically we would soft-code this so that the namespace is read from a table. As is, changing the namespace requires a change and recompile of code.
    for r in (select *
                from xmltable(xmlnamespaces (default 'http://schemas.abcdefg.com/servicemarket/resourceavailabilitynotification/20081120'),
                              '/ResourceAvailabilityNotification/Body/Resources/Resource'
                       passing p_message
                       columns isrc        varchar2(12) path 'Isrc',
                               available   varchar2(5)  path 'Available'
                       )) loop
    end loop;Thanks,
    Todd

    I made some changes, the following xsl removes all the namespaces and one attribute the xsi:schemaLocation.
    I added some dummy attributes to the xml to see that only the schemaLocation will be removed. Looks like it works.
    SQL> with t as (select xmltype('<?xml version="1.0" encoding="UTF-8"?>
      2   <ns1:ResourceAvailabilityNotification
      3   xsi:schemaLocation="http://schemas.abcdef.com/resourceavailabilitynotification"
      4   xmlns:ns1="http://schemas.abcdef.com/resourceavailabilitynotification"
      5   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      6    <ns1:Header>
      7      <Id iid="a">String</Id>
      8      <CallThreadId k="aaaa">String</CallThreadId>
      9    </ns1:Header>
    10  </ns1:ResourceAvailabilityNotification>') xcol from dual)
    11      select xmltransform(xcol
    12        ,xmltype('<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
    13                   <xsl:template match="*">
    14                    <xsl:element name="{local-name()}" namespace="">
    15                     <xsl:apply-templates select="@* | node()" />
    16                    </xsl:element>
    17                   </xsl:template>
    18              <xsl:template match="@*">
    19                <xsl:if test="name(.)!=''xsi:schemaLocation''">
    20                  <xsl:attribute name="{local-name()}">
    21                    <xsl:value-of select="."/>
    22                  </xsl:attribute>
    23                </xsl:if>
    24              </xsl:template>
    25                  </xsl:stylesheet>')) xml
    26     from t;
    XML
    <ResourceAvailabilityNotification>
      <Header>
        <Id iid="a">String</Id>
        <CallThreadId k="aaaa">String</CallThreadId>
      </Header>
    </ResourceAvailabilityNotification>Ants

  • Namespaces in target fields

    Hi mates,
    I've a problem with this sample:
    <ClaimedIdentity xmlns="urn:oasis:oasis:------rt::core:schema">
                        <Name xmlns="urn:oasis:------rt::schema">telvent.DEMOAfirma</Name>
                    </ClaimedIdentity>
                    <ReturnReadableCertificateInfo xmlns="urn:afiroasis:------rt:chema"></ReturnReadableCertificateInfo>
                    <ReturnVerificationReport xmlns="urn:oasis:------rt:rt:schema#">
                        <ReportOptions xmlns="urn:oasis:------rt:schema#">
                       </ReturnVerificationReport>
                </OptionalInputs>
    Here we can see a part of a message that i send from RWB. It's only a sample that shows the namespaces inside the fields. I have created all the DataTypes and namespaces required in for it in the Enterprise service builder, and when i trigger the message it has all the well formated data in the steps of the sxmb_moni, but when arrives to Request Message Mapping step, it fails and delete all the namespaces of the fields.
    I've tried with ( elementFormDefault="qualified") and i've read this other forum: NET -> XI -> WAS Scenario: elementFormDefault="qualified" SUPPORTED??? but it's not the same case.
    Some one knows how can i maintain the namespaces until thirdparty environment?
    Thanks and regards.

    Hi, it's only to explain how i've solved the issue.
    The best solution that i've found is create the namespaces as attributes named "xmlns" and the mapping the namespace has a tring inside a constant field.
    It runs perfectly whit nspaces and "Profile" attributes, try whit this solution always that u must insert info in a field.
    Regards.

  • XAML Namespaces - Why Oh Why Is it "using:" Instead of "clr-namespace"?

    Something's been bugging me for awhile now. I'm writing an application with both a Windows Runtime version as well as a WPF version for legacy users (sorry, but Win8 just doesn't have enough marketshare yet!)
    Thanks to PCL and MVVM, I can re-use 90% of the C# code. Yippiee!
    But the XAML is another story, and a HUGE part of that is the fact that in Windows Apps, identifying a XAML namespace requires "using:namespace.name" whereas in WPF, it's "clr-namespace:namespace.name"
    I would be able to share a huge proportion of my XAML files between my two app versions if not for this seemingly arbitrary difference between the two platforms.
    Why oh why was this done this way? Is there some technical reason MS does not wanting us sharing XAML files between platforms? Is there some best practice I'm violating by trying to do this? 
    By the way, for those who are interested, there is somewhat of a workaround. On the WPF side, if you keep your user-controls entirely in a different module (and they never refer to each other in their own XAML files), you can use XmlnsDefinition to
    define your module's XAML namespace as anything you want. So I can actually then refer to the uc's namespace as "using:namespace.name." That way it compiles properly both in the WPF and Windows App projects. That is indeed what I've been doing and
    now I'm sharing 90% of XAML as well. 
    Still, why oh why? Really, I'm not just trying to troll here. If there's a technical reason this was done and more importantly if there's a good reason I should not be attempting to share XAML code between WPF and App projects, I'd definitely like to know
    Thanks much.
    Peter

    The thread I was thinking of is at
    https://social.msdn.microsoft.com/Forums/windowsapps/en-US/7f492c62-4844-40e6-960c-27cbf076b812/how-do-we-file-a-change-request-on-the-xmlns-in-winrt-xaml?forum=winappswithcsharp
    The UI design of WPF and of Windows Store apps is generally different enough that there wouldn't be a large overlap in Xaml. You'll generally want different layouts, many of the standard controls are different, and there are several other Xaml
    features which differ between WPF and Windows.UI.Xaml.
    It would be very useful to be able to share Xaml for custom controls and UserControls, and conditional compilation (#ifdef) for Xaml is a frequently heard request (although I don't see that obviously on
    http://wpdev.uservoice.com , but I may just be failing at search).
    I know some people do pre-processor tricks to fake this at the expense of being able to use the designer, but it's neither supported nor something I've looked into deeply.

Maybe you are looking for

  • Oracle 8.1.5 in hp-ux 11i v1

    Hi the oracle 8.1.5 not conflics in one server hp 9000 Serie A with OS hp-ux 11 update OS hp-ux 11i v1 ?

  • How to get my Oracle EBS version (on linux)

    Hello, do you know how to get Oracle EBS version (on linux)? Thanks!

  • BOXI 3.0 server and 3.1 client tool

    Hi, I have a couple of question.... - Is it advisable to have client and server on the same machine? - I need the .net sdk that I think is not included in BOXI 3.0 so is it ok if on the same machine I have BOXI 3.0(server) and BOXI 3.1 (client)? - If

  • How to create table of results

    Hi, I am using a database in director and after a search I will end up with multiple record results. How do I present these to the user in a table which is then selectable per row?? I thought using a Flash DataGrid would be a good idea but I don't kn

  • HELP ME NOKIA E65

    Hello I have a Nokia E65 and I want to know if it's technically possible to not register the correct time and date for sending and receiving messages in details. please help me, thanks