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

Similar Messages

  • ORA-19202: Error occurred in XML processingLSX-00023: unknown namespace URI

    Hi there
    I am trying to register an XSD document as an XML schema on the database. I am using Oracle 9i release 9.2.0.5.0 and using the dbms_xmlschema.registerSchema method in PL/SQL.
    I am getting the following error when trying to register:
    ORA-19202: Error occurred in XML processing LSX-00023: unknown namespace URI
    The problem seems to be caused by a local simpleType declared outside of the root element. If I remove the simpleType from the xsd, I can register it successfully as a schema on the database. However, we need the simpleType there as it defines valid values for one of the elements in the xsd.
    The xsd follows the structure:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema targetNamespace="http://www.oracle.com/VFLOC.xsd"
    xmlns:vfloc="http://www.oracle.com/VFLOC.xsd"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xdb="http://xmlns.oracle.com/xdb">
         <xsd:element name="VisionDataExchange">
              <xsd:complexType>
                   <xsd:sequence>
                        <xsd:element name="Credentials">
    ...... etc. etc.
                   </xsd:element>
                   </xsd:sequence>
              </xsd:complexType>
         </xsd:element>
         <!-- Data Types Must complete data type values from database -->
         <xsd:simpleType name="TrueFalseType">
              <xsd:restriction base="xsd:string">
                   <xsd:enumeration value="1"/>
                   <xsd:enumeration value="0"/>
                   <xsd:enumeration value="True"/>
                   <xsd:enumeration value="False"/>
              </xsd:restriction>
              <!-- 1 and 0 are preferred -->
         </xsd:simpleType>
    </xsd:schema>
    Does anyone know how I can register a schema with a targetNamespace and the local simpleType below?
    Any help would be much appreciated.
    Thanks!
    Sonya

    Hi
    I wanted to know
    1)Hw to register a schema
    2) Associate xml files with the schema
    3) hw to do read the xml files
    If you could provide a small exampl, shall appreciate
    Thanks for your help in advance
    Sushil

  • "unknown namespace URI" during schema registration

    I have an XML containing other XMLs, grouping them together. The contained XMLs namespaces are different.
    Anybody knows a way to register such an xml? (Except including the schemas into each other. I don't have the oppurtunity to change the xmls.)
    Here is the example:
    First the xml instance:
    <?xml version="1.0" encoding="UTF-8"?>
    <variables xmlns="http://www.wildom.com/neaddfel/2612">
    <folder_form_2613>
    <variables xmlns="http://www.wildom.com/neaddfel/2613">
    <form.id>4520</form.id>
    <form.type>folderform</form.type>
    <form.type_id>2613</form.type_id>
    <form.type_name>teszteset</form.type_name>
    <form.xslt>null</form.xslt>
    <t_comment/>
    <t_input>2222222222222222222222</t_input>
    </variables>
    </folder_form_2613>
    <folder_form_2614>
    <variables xmlns="http://www.wildom.com/neaddfel/2614">
    <form.id>4520</form.id>
    <form.type>folderform</form.type>
    <form.type_id>2613</form.type_id>
    <form.type_name>teszteset</form.type_name>
    <form.xslt>null</form.xslt>
    <t_comment/>
    <t_input>2222222222222222222222</t_input>
    </variables>
    </folder_form_2614>
    <folder.company_address_city>Bp.</folder.company_address_city>
    <folder.company_address_id>TuzeŠr utca 42.</folder.company_address_id>
    <folder.company_address_zip>1122</folder.company_address_zip>
    <folder.company_id>522</folder.company_id>
    <folder.company_name>Breona kft.</folder.company_name>
    <folder.hir_id>null</folder.hir_id>
    <folder.id>4521</folder.id>
    <folder.type_id>2612</folder.type_id>
    <folder.type_name>FSDTGSH</folder.type_name>
    <folder.userid>602</folder.userid>
    <folder.username>[email protected]</folder.username>
    <folder.xslt>FSDTGSH</folder.xslt>
    </variables>
    Now the xsds:
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.wildom.com/neaddfel/2613" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="variables" type="ns:variablesType" xmlns:ns="http://www.wildom.com/neaddfel/2613"/>
    <xs:complexType name="variablesType">
    <xs:sequence>
    <xs:element type="xs:string" name="form.id"/>
    <xs:element type="xs:string" name="form.type"/>
    <xs:element type="xs:string" name="form.type_id"/>
    <xs:element type="xs:string" name="form.type_name"/>
    <xs:element type="xs:string" name="form.xslt"/>
    <xs:element type="xs:string" name="t_comment"/>
    <xs:element type="xs:string" name="t_input"/>
    </xs:sequence>
    </xs:complexType>
    </xs:schema>
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.wildom.com/neaddfel/2614" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="variables" type="ns:variablesType" xmlns:ns="http://www.wildom.com/neaddfel/2614"/>
    <xs:complexType name="variablesType">
    <xs:sequence>
    <xs:element type="xs:string" name="form.id"/>
    <xs:element type="xs:string" name="form.type"/>
    <xs:element type="xs:string" name="form.type_id"/>
    <xs:element type="xs:string" name="form.type_name"/>
    <xs:element type="xs:string" name="form.xslt"/>
    <xs:element type="xs:string" name="t_comment"/>
    <xs:element type="xs:string" name="t_input"/>
    </xs:sequence>
    </xs:complexType>
    </xs:schema>
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.wildom.com/neaddfel/2612" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="variables" type="ns:variablesType" xmlns:ns="http://www.wildom.com/neaddfel/2612"/>
    <xs:complexType name="folder_form_2614Type">
    <xs:sequence>
    <xs:element ref="ns:variables" xmlns:ns="http://www.wildom.com/neaddfel/2614"/>
    </xs:sequence>
    </xs:complexType>
    <xs:complexType name="variablesType">
    <xs:sequence>
    <xs:element type="ns:folder_form_2613Type" name="folder_form_2613" xmlns:ns="http://www.wildom.com/neaddfel/2612"/>
    <xs:element type="ns:folder_form_2614Type" name="folder_form_2614" xmlns:ns="http://www.wildom.com/neaddfel/2612"/>
    <xs:element type="xs:string" name="folder.company_address_city"/>
    <xs:element type="xs:string" name="folder.company_address_id"/>
    <xs:element type="xs:string" name="folder.company_address_zip"/>
    <xs:element type="xs:string" name="folder.company_id"/>
    <xs:element type="xs:string" name="folder.company_name"/>
    <xs:element type="xs:string" name="folder.hir_id"/>
    <xs:element type="xs:string" name="folder.id"/>
    <xs:element type="xs:string" name="folder.type_id"/>
    <xs:element type="xs:string" name="folder.type_name"/>
    <xs:element type="xs:string" name="folder.userid"/>
    <xs:element type="xs:string" name="folder.username"/>
    <xs:element type="xs:string" name="folder.xslt"/>
    </xs:sequence>
    </xs:complexType>
    <xs:complexType name="folder_form_2613Type">
    <xs:sequence>
    <xs:element ref="ns:variables" xmlns:ns="http://www.wildom.com/neaddfel/2613"/>
    </xs:sequence>
    </xs:complexType>
    </xs:schema>
    As you can see, the last xsd only refers to the "variables" element in the first two.
    When I register this xsd with:
    DBMS_XMLSCHEMA.RegisterSchema(schemaurl=>'http://www.wildom.com/neaddfel/2612',schemadoc=>acctschema,local=>false,gentypes=>true,genbean=>FALSE,gentables=>true,force=>false,owner=>'neaddfel_xml');
    I've got the error:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00023: unknown namespace URI "http://www.wildom.com/neaddfel/2614"
    ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 3
    ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 14
    ORA-06512: at line 35
    Is there any way to tell to XDB to use the first two xsd? I would like to store the contained xmls in the tables generated by the registration of the first two xsds.
    I think I need a registerschema syntax that accepts multiple source xsd schemaurls...
    Like in some validation APIs where one can define multiple xsds to validate the xml against...
    Any idea?
    TIA: gviczai

    Normally when you get an error like " "unknown namespace URI" during schema registration " you encountered one of the following issues:
    - The namespace is not registered in the XMLDB repository
    - The namespace is registered, but can not be found on the referred location
    - The namespace is registered, but you don't have the needed privileges to call it
    - You refer to an URI outside the database, which is not allowed (URI's must be registered in the repository)

  • Namespace URIs Using Files

    All,
    Is it possible to reference a namespace to a file on your hard disk? All the examples I have seen use http addresses. I have tried the file URI but receive the message given below.
    Thanks,
    Brian
    MSV Message:
    start parsing a grammar.
    namespace "file:///C:/Namespaces/basic_temporal.xsd" is reference
    d but no schema definition of this namespace was found.
    87@file:/C:/Namespaces/base_object.xsd
    failed to load a grammar.

    A namespace doesn't "reference" anything. It's just a name. For some unfortunate reason, people seem to use HTTP URI's as namespaces, although there does not need to be any physical document at that URI.
    So in answer to your question: you can use any series of characters you like as your namespace URI. The only rule is that it must be a URI as defined by RFC 2396, so you could use a file: URI if you liked. It just needs to be different from any other namespace URI that has ever been used by somebody else, or will ever be used by somebody else. I suppose that was the idea behind using HTTP addresses.

  • Namespace-URI is wrong in the metadata.xml??

    Dear Captivate-Community,
    I am running into troubles importing SCORM packages from Captivate 6 into our LMS.
    Our LMS  (Viversa 7.1 from VIWIS) interprets SCORM 1.2 very strict.
    It seems that the namespace-URI is wrong in the metadata.xml!
    wrong is...
    Line 4:   xmlns:pkgprop="http://www.scorm.com/ScormEnginePackageProperties"
    correct is:
    Line 4:   xmlns:pkgprop="http://www.scorm.com/xsd/ScormEnginePackageProperties"
    Has anyone else the same experience? I don´t want to change each exported file by hand...
    Thx
    :-) michael

    Hi Michael,
    yes, currently I actually have the same problem, also using the LMS Viversa. The solution from RodWard was very helpful. I change the template in Line 67 and add the "xsd/". Now it works!
    Regards
    Katharina

  • XPath function namespace-uri in Mediator raises ORAMED-01004

    Hi,
    In a mediator component (SOA Suite 11g) I try to use some XPath functions.
    "name" and "local-name" do just fine, but when I try to use "namespace-uri" I always get an ORAMED-01004 error.
    Like this:
    oracle.tip.mediator.infra.exception.MediatorException: ORAMED-01004:[Multiple source nodes]Source expression "namespace-uri($in.berichtPart/child::*)" resulted in multiple node for source message which is not supportedPossible Fix:Please check expression for correctness. Modify source expression based on the requirement otherwise contact Oracle for support
    I seems like a bug to me as namespace-uri should return a string, just like name and local-name...
    Xpath spec: Function: string namespace-uri(node-set?)
    Can anyone confirm? Am I missing something???
    Groeten,
    HJH

    Any solution to this?

  • Removing Namespace URI from payload

    Hi All,
    I receive a payload into BPEL
    Payload contains some namespace URIs at header level
    I wanna remove them
    Is there any pre-bulit functions available to do that..?
    or any other way..?
    For Example
    <os:envelope xmlns:os="http://www.1sync.org" xmlns:sh="http://www.gs1.org/sh"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.1sync.org
    http://www.preprod.1sync.org/schemas/item/1.0/ResponseProxy.xsd">
    Now I want to remove all namspace URI
    Thanks
    -Praveen

    It possible use this stylesheet:
    <?xml version="1.0" encoding="UTF-8" ?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="comment()|processing-instruction()|/">
    <xsl:copy>
    <xsl:apply-templates/>
    </xsl:copy>
    </xsl:template>
    <xsl:template match="*">
    <xsl:element name="{local-name()}">
    <xsl:apply-templates select="@*|node()"/>
    </xsl:element>
    </xsl:template>
    <xsl:template match="@*">
    <xsl:choose>
    <!-- test namespace -->
    <xsl:when test="name() != ''xmlns''">
    <xsl:attribute name="{local-name()}">
    <xsl:value-of select="."/>
    </xsl:attribute>
    </xsl:when>
    </xsl:choose>
    </xsl:template>
    </xsl:stylesheet>

  • 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>

  • 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 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

  • Namespace URI for a Service Object

    A Distributed Object registered using task.Part.ObjectLocationMgr.RegisterObject(name = '/TestSvc',object = tm, duration = DO_DURATION_SESSION) can be retrieved using task.Part.ObjectLocationMgr.BindObject(name = '/TestSvc', classType = Object). But how can I dynamically bind to a service object registered by the Forte System ? What Namespace do I need to use in ServiceName value for this ?

    Forte has a build in name service where it registers all of the service objects. (And more.) If you use something before UDS 5.0 you can see the name service in E-console under the application view. UDS 5.0 even allows you to drill down into the name service as part of Econsole.
    You dynamicly bind with this code if you do a little research on bindobject:
    bindName : textdata = new();
    myName.replaceParameters('site/%1/%1-%2', SampleProjectName_cl0, SOSampleName);
    myServer = (TUBaseService)(task.Part.ObjectLocationMgr.BindObject
                        (name = bindName, classType = serverClass));
    This would bind to the SOSampleName service object in the project SampleProject. Notice that the compatibility level is important.
    Hope this helps.
    --Scott Bechtel
    [email protected]

  • Namespace error with JAXB

    Hello everyone! This is my problem:
    I am using jaxb to unmarshall a xml file. When I unmarshall, the program doesn�t work at this point:
    JAXBContext jc = JAXBContext.newInstance("com.claynet.core.clom");
    Unmarshaller u = jc.createUnmarshaller();
    u.setValidating(true);
    Clom clom =
    (Clom)u.unmarshal(
    new FileInputStream( ".." + File.separatorChar +
    "webapps"+ File.separatorChar + "claybrary" + File.separatorChar
    + "objetosCLOM" + File.separatorChar + file_name.trim()) );
    The error I get is the following one:
    javax.xml.bind.UnmarshalException: Probably namespace URI of tag "clom" is wrong (correct one is "http://www.clayformacion.com/xsd/clomv1.0")
    - with linked exception:
    [com.sun.msv.verifier.ValidityViolation: Probably namespace URI of tag "clom" is wrong (correct one is "http://www.clayformacion.com/xsd/clomv1.0")]
    The problem seems to be a conflict with the namespace, but the schema has the namespace correctly set:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:clom="http://www.clayformacion.com/xsd/clomv1.0" xmlns="http://www.clayformacion.com/xsd/clomv1.0" targetNamespace="http://www.clayformacion.com/xsd/clomv1.0" elementFormDefault="qualified">
    The validation inside the unmarshalling crash.
    Is there any errors with the code? Can Anyone help me?
    Thanks

    Looks like error is clear namespace mismatch...try changing the following url in wsdl and regen the code
    http://example.ws found http://example.ws/xsd

  • Setting namespace prefix with JAXB

    I'm trying to build and use a JAXB application.
    1. Generate the Java source files by submitting the XML Schema with Namespace to the binding compiler.
    2. Compile the Java source code.
    3. Marshal the data to new XML documents(valid XML document).
    But namespace prefix of XML Schema doesn't equal namespace prefix of new XML document.
    The prefix of new XML Schema is "heo". But, the prefix of new XML document set as "ns1" at discretion.
    Is there any way to solve namespace prefix setting?
    Thank you for your help.

    Why is java the only one doing this?
    I know prefixes are arbitrary, but when groups/individuals design XML docs, the instinct is to specify unique prefixes and to expect them coming in and out of other systems.
    When joe-developer emails an API to a buddy, she's got to include a lot more info every time, not just "cool:news" vs. "bad:news" but "cool:news" and "xmlns:cool=uri-foobar-smyte" and ...
    Sooo much simpler to handle the xml when its not only declared correctly, but you can expect specific prefixes. Less lines in writing tests, less lines in parsing out namespace declarations in order to expand them to uris and then map those to the random prefixes... blah.
    If you are concerned about dropping uri's then THAT should be the exception to the rule, then you write tests to lookup the namespace-uri.
    I suppose sun's xml stack is kind of a lesson to teach us developers to handle xml the orthodox way, using random prefixes, thanks for that.
    Classic: look at the amount of code it takes to parse xml in java. Then add on complexity (weirdness) in terms of random prefixes .... then compare that to .net/python/ruby/php/perl/c/c++ ... sun is all alone on this one and about 10x more verbose.
    At least honor the xml prefixes declared and developers round the world will appreciate the boost in productivity.
    Word!
    -jhn

  • Problem validating xml file - jaxb

    hi people, I'm working with jaxb to generate Java source classes from the .xsd schemas that I have. I work with 17 schemas that, a priori, I can't modify. In those schemas there are a lot of types and structures that I can use when creating an .xml file. I've read other threads with the problem of namespaces but as a solution they provide a modification on the schemas. The generation of java source is ok, I've done custoization classes and no problem, but when I try to unmarshal an input xml file I get an error of validation:
    DefaultValidationEventHandler: [ERROR]: Probably namespace URI of tag "XFFile" is wrong (correct one is "http://ww........
    A possible xml file is :
    <?xml version="1.0" encoding="UTF-8" standalone="no" ?><!DOCTYPE XFFile><XFFile xmlns:rp210Elements="http://www.smpte-ra.org/schemes/434/200X/multiplex/S377M/2004" xmlns:s377mGroups="http://www.smpte-ra.org/schemes/434/200X/groups/S377M/2004" xmlns:s377mMux="http://www.smpte-ra.org/schemes/434/200X/multiplex/S377M/2004" xmlns:s377mTypes="http://www.smpte-ra.org/schemes/434/200X/types/S377M/2004" xmlns:s380mGroups="http://www.smpte-ra.org/schemes/434/200X/groups/S380M/2004" xmlns:s381mGroups="http://www.smpte-ra.org/schemes/434/200X/groups/S381M/200X" xmlns:s382mGroups="http://www.smpte-ra.org/schemes/434/200X/groups/S382M/200X" xmlns:s385mGroups="http://www.smpte-ra.org/schemes/434/200X/groups/S385M/2004" xmlns:s422mGroups="http://www.smpte-ra.org/schemes/434/200X/groups/S422M/200X" xmlns:s422mTypes="http://www.smpte-ra.org/schemes/434/200X/types/S422M/200X" xmlns:s423mGroups="http://www.smpte-ra.org/schemes/434/200X/groups/S423M/200X">
         <s380mGroups:ClipFramework rp210Elements:InstanceID="a6.67.7a.47.19.2f.4b.10.8f.ee.1e.59.6d.4c.f1.70" rp210Elements:LinkedGenerationID="0e.10.a8.9c.96.1c.4c.11.b1.fb.0a.a9.40.22.a4.e2">
              <rp210Elements:ClipCreationDateTime>
                   <rp210Elements:Year>2006</rp210Elements:Year>
                   <rp210Elements:Month>4</rp210Elements:Month>
                   <rp210Elements:Day>18</rp210Elements:Day>
                   <rp210Elements:Hour>12</rp210Elements:Hour>
                   <rp210Elements:Minute>0</rp210Elements:Minute>
                   <rp210Elements:Second>0</rp210Elements:Second>
                   <rp210Elements:mSec4>0</rp210Elements:mSec4></rp210Elements:ClipCreationDateTime>
              <rp210Elements:FrameworkExtendedTextLanguageCode>fr</rp210Elements:FrameworkExtendedTextLanguageCode>
         </s380mGroups:ClipFramework>
    </XFFile>
    I think it's ok because someone has provided it to my company but I can't validate it because it takes elements from many schemas (am I wrong and I can?)
    i can't post the schemas because of the copyrights (damn it). I'm not asking for a solution but if someone has an idea or has had a similar problema.. I'll appreciate all comments, thanks
    Jordi
    Message was edited by:
    WuWei

    In the schema root element xs:schema add namespace declaration.
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    In the XML document root element add xmlns:xsi and xsi:noNamespaceSchemaLocation attributes.
    <root_element xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file://c:/testing.xsd">

  • XML NameSpace Issue Confused whether it is a bug

    Hi,
    The issue is that the generated XML and Actual XML vary as the following: -
    The namespace which is used in the Actual XML is globally used and whereas In the generated XML It is used locally wherever the corresponding element or type is used in the XML Actually, which should not happen.
    I am confused whether it is a bug or an issue if this is an issue can somebody please suggest me a solution
    Generated XML
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <namespace1:utilAuthenticate xmlns:namespace1="http://NAMESPACE1Services.com">
        <namespace2:ccInfo xmlns:namespace2="http://Namespace2CompanionElements.com">
            <namespace2:UKCreditCard>visa</namespace2:UKCreditCard>
            <namespace2:ccAttributes houseNo="koramangala" cardIssueNumber="321" postCode="533201" cardExpDate="01/01/2006" cardNumber="999999999999998" cardIssueDate="01/01/2005" cv2="123" cardHolderName="murali"/>
        </namespace2:ccInfo>
        <namespace2:ourReference xmlns:namespace2="http://Namespace2CompanionElements.com">reference3</namespace2:ourReference>
    </namespace1:utilAuthenticate>
    Actual XML
    <?xml version="1.0" encoding="UTF-8"?>
    <namespace1:utilAuthenticate xmlns:namespace1="http://NAMESPACE1Services.com"
        xmlns:namespace2="http://Namespace2CompanionElements.com">
        <namespace2:ccInfo>
            <namespace2:UKCreditCard>VISA</namespace2:UKCreditCard>
            <namespace2:ccAttributes cardNumber="4627851535817358"
                cardExpDate="05/08" cardHolderName="testnamecard" cv2="482"
                houseNo="75" postCode="NW1 2PL"/>
        </namespace2:ccInfo>
        <namespace2:ourReference>gm-002025004</namespace2:ourReference>
    </namespace1:utilAuthenticate>The code to give the namespaces is the following line: -
    schemaMarshaller.setProperty("com.sun.xml.bind.namespacePrefixMapper",new NamespacePrefixMapperImpl());
    The complete code to Generate the XML is :-
    Marshaller schemaMarshaller = jaxbContext.createMarshaller();
    schemaMarshaller.setProperty("com.sun.xml.bind.namespacePrefixMapper",new NamespacePrefixMapperImpl());
    schemaMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
    schemaMarshaller.marshal(bizObj, baos);
    NamespacePrefixMapperImpl is the class written by me which should implement the interface NameSpacePrefix (A JAXB Runtime Class)
    And the code for the class is : -
    import com.sun.xml.bind.marshaller.NamespacePrefixMapper;
    class NamespacePrefixMapperImpl extends NamespacePrefixMapper {
         * This method returns prefix for a given namespace uri.
        public String getPreferredPrefix(String namespaceUri, String suggestion,
                boolean requirePrefix) {
            if ("http://gshop.eai.o2c.ibm.com".equals(namespaceUri))
                return "gshop";
            if ("http://Namespace2CompanionElements.com"
                    .equals(namespaceUri))
                return "namespace2";
            if ("http://NAMESPACE1Services.com".equals(namespaceUri))
                return "namespace1";
            if ("http://www.w3.org/2001/XMLSchema".equals(namespaceUri))
                return "xs";
            return suggestion;
        public String[] getPreDeclaredNamespaceUris() {
            return new String[] {};
    }Thanks in Advance for any suggestion.
    Thanks
    Manjith Kumar A.

    Hi Suren7669,
    Welcome to the Support Communities!
    To resolve this issue, I would suggest updating your iOS to the latest, which is 7.0.3.
    iOS 7.0.3
    http://support.apple.com/kb/DL1691
    iOS: How to update your iPhone, iPad, or iPod touch
    http://support.apple.com/kb/HT4623
    Cheers,
    - Judy

Maybe you are looking for