XJC生成的命名空间(XJC generated namespaces)
我正在尝试使用xjc代码生成工具从一个
*.xsd
文件包中生成java源文件。这些* .xsd文件中使用的名称空间如下所示:
http://www.domain.com/foo/bar.x http://www.domain.com/foo/bar.x.y http://www.domain.com/foo/bar.x.y.z
XJC生产包装如下:
com.domain.foo.bar.x并将生成的java文件从“... x”和“... xy”xsd namespaces放置在那里
com.domain.foo.bar.x_y并将生成的java文件从“... xyz”xsd namespaces放置到那里
我想在这里实现的是正确的:
com.domain.foo.bar.x com.domain.foo.bar.x.y com.domain.foo.bar.x.y.z package names
这是否有可能? 也许使用自定义JAXB绑定? 我研究过jaxb自定义绑定文档,但我不确定是否可能。
基本上我希望xjc同时处理“/”和“。”。 作为包分隔符。
任何帮助赞赏。
阿德尔伯特
I am trying to generate java source files from a package of
*.xsd
files using the xjc code generation tool.The namespaces used in those *.xsd files are as follows:
http://www.domain.com/foo/bar.x http://www.domain.com/foo/bar.x.y http://www.domain.com/foo/bar.x.y.z
XJC produces packages as follows:
com.domain.foo.bar.x and places generated java files from "...x" and "...x.y" xsd namespaces there
com.domain.foo.bar.x_y and places generated java files from "...x.y.z" xsd namespaces there
What I would like to achieve here is proper:
com.domain.foo.bar.x com.domain.foo.bar.x.y com.domain.foo.bar.x.y.z package names
Is this somehow possible? Maybe using custom JAXB bindings? I've studied jaxb custom binding docs but I am not sure if it's possible.
Basically I would like xjc to treat both "/" and "." as package separators.
Any help appreciated.
Adalbert
原文:https://stackoverflow.com/questions/3463432
最满意答案
actionSheet.buttonPressedBlock
是一个属性 。 你正试图设置它。 那你的等号在哪里? 这就是你在Swift中设置的方式:myThing.myProperty = myValue
您试图将此属性设置为块(函数)的事实不会改变任何内容。 所以:
let actionSheet = JGActionSheet(sections: sections) actionSheet.buttonPressedBlock = { (sheet: JGActionSheet!, indexPath: NSIndexPath!) in actionSheet.dismissAnimated(true) }
actionSheet.buttonPressedBlock
is a property. You are trying to set it. So where's your equals sign? This is how you set things in Swift:myThing.myProperty = myValue
The fact that you are trying to set this property to a block (a function) changes nothing. So:
let actionSheet = JGActionSheet(sections: sections) actionSheet.buttonPressedBlock = { (sheet: JGActionSheet!, indexPath: NSIndexPath!) in actionSheet.dismissAnimated(true) }
相关问答
更多-
一个可能的原因是它实际上是一种方法。 方法是非常鬼祟的,他们看起来就像常规功能,但是它们的行为方式不一样,我们来看看这个: func funFunction(someArg: Int, someOtherArg: Int) { println("funFunction: \(someArg) : \(someOtherArg)") } // No external parameter funFunction(1, 4) func externalParamFunction(externalOne ...
-
actionSheet.buttonPressedBlock是一个属性 。 你正试图设置它。 那你的等号在哪里? 这就是你在Swift中设置的方式: myThing.myProperty = myValue 您试图将此属性设置为块(函数)的事实不会改变任何内容。 所以: let actionSheet = JGActionSheet(sections: sections) actionSheet.buttonPressedBlock = { (sheet: JGActionSheet!, ind ...
-
Swift包含数组错误:在调用中缺少参数标签'where:'(Swift Contains Array Error: Missing argument label 'where:' in call)[2022-01-25]
该错误有点误导。 array(forKey返回[Any]?所以你必须将对象Equatable转换为期望的类型,以确保该类型符合Equatable if let items = UserDefaults.standard.array(forKey: "purchasedItems") as? [Int] { if items.contains(1) { print("works!") } } The error is a bit misleading. array(forKey ... -
第二个参数: RelativeToURL的类型为NSURL ,您传递一个String 尝试这个 : var url:NSURL = NSURL(string: "\(appItem.URLSchema)://") 有关更多信息,您可以查看“Swift编程语言” iBook中的“字符串插值”部分。 字符串插值是一种通过在字符串文字中包含它们的值,从常量,变量,文字和表达式的混合构造新的String值的方法。 插入到字符串文字中的每个项目都包含在一对括号中,前缀为反斜杠 The second argument ...
-
在Swift 3中,默认的初始值设定项会从一些导入的枚举类型中移除。 使用UITableViewRowActionStyle.default (或在你的情况下只是.default )而不是UITableViewRowActionStyle() 。 let delBut = UITableViewRowAction(style: .default, title: delete_InLocal) { action, index in Default initializers are removed f ...
-
功能参数错误 - 缺少参数标签异常 - SWIFT(Function parameter error - Missing Argument Label Anomaly - SWIFT)[2022-05-02]
这就是所谓的外部参数名称 ,默认情况下: 全局函数:不具有隐式外部名称 类/结构方法:外部名称在第一个之后自动为所有参数定义 初始值设定项:所有参数都会自动定义外部名称 如果未明确指定,则外部名称与本地参数具有相同的名称。 您可以通过在_加一个本地参数名称来覆盖该名称。 在你的情况下: func ranNum(low: Int, _ high:Int) -> UInt32 { ... } 你提到在操场上调用函数没有任何外部参数名称 - 我可能会说: 在操场上,您将该功能作为全局功能 在其他测试中, ... -
你得到的错误是Swift的神秘方式,说它找不到与你的参数相匹配的方法。 如果您尝试传递interiorPolygons参数,您会得到同样令人困惑的: 调用中额外的参数'interiorPolygons' 你的代码虽然很接近, 你只需要一些小的改变。 在你参考的文档中,它说你可以通过的一件事是: 作为指向数组开头的指针传递的in-out [Type]值,以及调用期间的生命周期延长 所以,它正在寻找一个输入参数 。 通过传递前缀为& coordinates来完成,如下所示: MKPolygon(coordina ...
-
Swift:缺少参数错误(Swift: Missing Argument Error)[2023-06-27]
enter需要一个输入参数,但你没有提供输入参数。 用enter(sender)替换它 @IBAction func operate(sender: UIButton) { let operation = sender.currentTitle! if userIsInTheMiddleOfTypingANumber { enter(sender) } switch operation { case "x": if o ... -
您的初始化程序有两个参数,在调用它时是必需的。 正确调用它看起来像这样: let whiskeyItemInstance = WhiskeyItem(wName: "name", wType: "type") 如果您不想将参数传递给初始值设定项,则可以提供默认参数: init(wName: String = "default name", wType: String = "default type") { 或者使用没有参数的初始化程序: init() { self.wName = "wName" ...
-
为什么我在此代码中出现“缺少参数参数”错误?(Why am I getting a “missing argument for parameter” error in this code?)[2022-07-16]
您正在尝试使用url参数初始化Radio类。 但是这个类没有init(url: NSURL) (或者至少它没有在你的问题中显示)所以你不能。 你需要创建一个init(url: NSURL) ,在这个init中你还必须为UIViewController调用super init(即使你没有使用它,就像在我的例子中一样),因为你的Radio类继承了它。 这就是您收到此错误的原因: 在调用中缺少参数'bundle'的参数 因为Xcode建议为类使用init(nibName: String?, bundle: NSB ...