首页 \ 问答 \ JaxB xjc生成的pojos包含空名称空间(JaxB xjc generated pojos contains blank namespaces)

JaxB xjc生成的pojos包含空名称空间(JaxB xjc generated pojos contains blank namespaces)

我正在使用命令行中的xjc从XSD生成POJO。 这是我运行的命令:

"%java_home%\bin\xjc" -p com.etc.etc.etc.etc ConsolidatedAlert.xsd

对于生成的一些POJO,POJO中的属性如下所示:

@XmlElement(name = "UnparsedTelephone", namespace="")
protected String unparsedTelephone;

据我所知,我没有指定这些元素与没有“namespace”属性的其他元素。

以下是XSD的相关部分:

类型声明:

<xs:complexType name="TelephoneType">
    <xs:choice>
        <xs:element name="UnparsedTelephone" type="xs:string"/>
        <xs:element name="ParsedTelephone" type="ParsedTelephoneType"/>
    </xs:choice>
</xs:complexType>

元素声明:

<xs:element name="Telephone" type="TelephoneType"/>

使用“电话”的地方:

<xs:complexType name="CompanyContactType">
    <xs:sequence>
        <xs:element ref="Telephone"/>
    </xs:sequence>
</xs:complexType>

使用“CompanyContact”的地方:

<xs:complexType name="AmountType">
        <xs:sequence>
            <xs:element ref="CompanyContact" minOccurs="0" />
            <xs:element name="TriggerAmount" type="xs:string"/>
        </xs:sequence>
</xs:complexType>

我可以简单地从每个POJO中删除namespace =“”,但这可能需要一点时间,我想更好地了解它为什么会发生在一起。

此外,这是大约8个XSD全部链接在一起。 它们在模式定义中都具有相同的targetNamespace和xmlns,但是其中一些具有elementFormDefault =“unqualified”,而其他的具有elementFormDefault =“qualified”。 这可能是问题的原因吗?

有任何想法吗?


I'm using xjc from the command line to generate POJOs from an XSD. Here's the command I run:

"%java_home%\bin\xjc" -p com.etc.etc.etc.etc ConsolidatedAlert.xsd

For some of the POJOs generated, the properties in the POJO come back like the following:

@XmlElement(name = "UnparsedTelephone", namespace="")
protected String unparsedTelephone;

As far as I can tell, I don't specify these elements any differently than others that don't have the "namespace" attribute.

Here's the relevant sections of the XSD:

Type declaration:

<xs:complexType name="TelephoneType">
    <xs:choice>
        <xs:element name="UnparsedTelephone" type="xs:string"/>
        <xs:element name="ParsedTelephone" type="ParsedTelephoneType"/>
    </xs:choice>
</xs:complexType>

Element declaration:

<xs:element name="Telephone" type="TelephoneType"/>

Where "Telephone" is used:

<xs:complexType name="CompanyContactType">
    <xs:sequence>
        <xs:element ref="Telephone"/>
    </xs:sequence>
</xs:complexType>

Where "CompanyContact" is used:

<xs:complexType name="AmountType">
        <xs:sequence>
            <xs:element ref="CompanyContact" minOccurs="0" />
            <xs:element name="TriggerAmount" type="xs:string"/>
        </xs:sequence>
</xs:complexType>

I can simply remove the namespace="" from each POJO, but that can take a bit, and I'd like a better understanding about why it's happening in the first place.

Also, this is about 8 XSDs all linked together. They all have the same targetNamespace and xmlns in the schema definition, but some of them have elementFormDefault="unqualified" and others have elementFormDefault="qualified". Could this be the cause of the problem?

Any ideas?


原文:https://stackoverflow.com/questions/19668802
更新时间:2022-02-02 10:02

最满意答案

最后,我带着一个javascript解决方案,在我来之前开始在这里贴出来

<script type="text/javascript">
    $(window).scroll(function() {
        $('#sidebarPage1').css('top', $(this).scrollTop() + "px");
    });
</script>

哪些做了工作并且产生了我想要的结果,但是它所取得的效果非常缺乏,因为它看起来非常不平稳和不愉快。

我今天做了更多的Google搜索,并且遇到了这篇文章: 使用jQuery的顶级浮动消息框 。 这导致我到这里

<script type="text/javascript">
    $(window).scroll(function() {
        $('#sidebarPage1').animate({ top: $(window).scrollTop() + "px" }, 
            { queue: false, duration: 500, easing: 'easeInOutSine' });
    });
</script>

这对我的边栏产生了很好的干净滚动效果,在我看来,缓解是真正帮助它感觉精美的东西。


In the end I went with a javascript solution where I started with before I came and posted here was

<script type="text/javascript">
    $(window).scroll(function() {
        $('#sidebarPage1').css('top', $(this).scrollTop() + "px");
    });
</script>

Which did work and produced the result I wanted however it was very lacking in the effect it achieved because it was very jerky and unpleasant to watch.

I did some more googling today and came across this post: Top Floating message box using jQuery. Which lead me to here

<script type="text/javascript">
    $(window).scroll(function() {
        $('#sidebarPage1').animate({ top: $(window).scrollTop() + "px" }, 
            { queue: false, duration: 500, easing: 'easeInOutSine' });
    });
</script>

Which produces a nice clean scrolling effect of my sidebar, the easing in my opinion is what really helps it feel polished.

相关问答

更多

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。