当前位置: 首页 > news >正文

网站设计素材网站推荐从做系统后以前的网站打不开了怎么办

网站设计素材网站推荐,从做系统后以前的网站打不开了怎么办,湖南网站建设网络公司,led灯网站策划书jaxb-xjc.jar由于JAXB是JDK的一部分#xff0c;因此它是处理XML文档最常用的框架之一。 它提供了一种从XML文档检索数据并将其存储到Java类的简便方法。 因为几乎每个Java开发人员都已经使用过JAXB#xff0c;所以我不会解释不同的JAXB批注。 相反#xff0c;我将重点介绍一… jaxb-xjc.jar 由于JAXB是JDK的一部分因此它是处理XML文档最常用的框架之一。 它提供了一种从XML文档检索数据并将其存储到Java类的简便方法。 因为几乎每个Java开发人员都已经使用过JAXB所以我不会解释不同的JAXB批注。 相反我将重点介绍一个名为xjc的命令行工具并向您展示如何基于现有XSD架构描述生成绑定类。 为现有XML接口实现所有绑定类可能是一项耗时且繁琐的任务。 但好消息是您不需要这样做。 如果您具有XSD架构描述则可以使用xjc绑定编译器创建所需的类。 甚至更好的是xjc是JDK的一部分。 因此不需要外部工具如果需要您应该始终使用它。 使用xjc 如下面的代码片段所示xjc支持许多选项。 最重要的是 -d定义生成的类应在文件系统中存储的位置 -p定义要使用的软件包当然 -帮助如果您还有其他需要。 Usage: xjc [-options ...] schema file/URL/dir/jar ... [-b bindinfo] ... If dir is specified, all schema files in it will be compiled. If jar is specified, /META-INF/sun-jaxb.episode binding file will be compiled. Options:-nv : do not perform strict validation of the input schema(s)-extension : allow vendor extensions - do not strictly follow theCompatibility Rules and App E.2 from the JAXB Spec-b file/dir : specify external bindings files (each file must have its own -b)If a directory is given, **/*.xjb is searched-d dir : generated files will go into this directory-p pkg : specifies the target package-httpproxy proxy : set HTTP/HTTPS proxy. Format is [user[:password]]proxyHost:proxyPort-httpproxyfile f : Works like -httpproxy but takes the argument in a file to protect password-classpath arg : specify where to find user class files-catalog file : specify catalog files to resolve external entity referencessupport TR9401, XCatalog, and OASIS XML Catalog format.-readOnly : generated files will be in read-only mode-npa : suppress generation of package level annotations (**/package-info.java)-no-header : suppress generation of a file header with timestamp-target (2.0|2.1) : behave like XJC 2.0 or 2.1 and generate code that doesnt use any 2.2 features.-encoding encoding : specify character encoding for generated source files-enableIntrospection : enable correct generation of Boolean getters/setters to enable Bean Introspection apis-contentForWildcard : generates content property for types with multiple xs:any derived elements-xmlschema : treat input as W3C XML Schema (default)-relaxng : treat input as RELAX NG (experimental,unsupported)-relaxng-compact : treat input as RELAX NG compact syntax (experimental,unsupported)-dtd : treat input as XML DTD (experimental,unsupported)-wsdl : treat input as WSDL and compile schemas inside it (experimental,unsupported)-verbose : be extra verbose-quiet : suppress compiler output-help : display this help message-version : display version information-fullversion : display full version informationExtensions:-Xinject-code : inject specified Java code fragments into the generated code-Xlocator : enable source location support for generated code-Xsync-methods : generate accessor methods with the synchronized keyword-mark-generated : mark the generated code as javax.annotation.Generated-episode FILE : generate the episode file for separate compilation例 好的让我们看一个例子。 我们将使用以下XSD模式定义和xjc来生成具有描述的属性和必需的JAXB批注的Author和Book类。 ?xml version1.0 encodingUTF-8 standaloneyes? xs:schema version1.0 xmlns:xshttp://www.w3.org/2001/XMLSchemaxs:element nameauthor typeauthor/xs:element namebook typebook/xs:complexType nameauthorxs:sequencexs:element namefirstName typexs:string minOccurs0/xs:element namelastName typexs:string minOccurs0//xs:sequence/xs:complexTypexs:complexType namebookxs:sequencexs:element refauthor minOccurs0/xs:element namepages typexs:int/xs:element namepublicationDate typexs:dateTime minOccurs0/xs:element nametitle typexs:string minOccurs0//xs:sequence/xs:complexType /xs:schema 以下命令调用xjc并为生成的类包和XSD模式文件提供目标目录。 xjc -d src -p blog.thoughts.on.java schema.xsdparsing a schema... compiling a schema... blog\thoughts\on\java\Author.java blog\thoughts\on\java\Book.java blog\thoughts\on\java\ObjectFactory.java OK操作成功完成现在在src目录中有3个生成的类。 这可能比某些人预期的要多。 因此让我们看看它们中的每一个。 类Author和Book看起来像预期的那样。 它们包含XSD架构中描述的属性和必需的JAXB批注。 // // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 // See a hrefhttp://java.sun.com/xml/jaxbhttp://java.sun.com/xml/jaxb/a // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2014.01.13 at 07:38:24 PM CET //package blog.thoughts.on.java;import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType;/*** pJava class for author complex type.* * pThe following schema fragment specifies the expected content contained within this class.* * pre* complexType nameauthor* complexContent* restriction base{http://www.w3.org/2001/XMLSchema}anyType* sequence* element namefirstName type{http://www.w3.org/2001/XMLSchema}string minOccurs0/* element namelastName type{http://www.w3.org/2001/XMLSchema}string minOccurs0/* /sequence* /restriction* /complexContent* /complexType* /pre* * */ XmlAccessorType(XmlAccessType.FIELD) XmlType(name author, propOrder {firstName,lastName }) public class Author {protected String firstName;protected String lastName;/*** Gets the value of the firstName property.* * return* possible object is* {link String }* */public String getFirstName() {return firstName;}/*** Sets the value of the firstName property.* * param value* allowed object is* {link String }* */public void setFirstName(String value) {this.firstName value;}/*** Gets the value of the lastName property.* * return* possible object is* {link String }* */public String getLastName() {return lastName;}/*** Sets the value of the lastName property.* * param value* allowed object is* {link String }* */public void setLastName(String value) {this.lastName value;}}// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 // See a hrefhttp://java.sun.com/xml/jaxbhttp://java.sun.com/xml/jaxb/a // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2014.01.13 at 07:38:24 PM CET //package blog.thoughts.on.java;import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; import javax.xml.datatype.XMLGregorianCalendar;/*** pJava class for book complex type.* * pThe following schema fragment specifies the expected content contained within this class.* * pre* complexType namebook* complexContent* restriction base{http://www.w3.org/2001/XMLSchema}anyType* sequence* element ref{}author minOccurs0/* element namepages type{http://www.w3.org/2001/XMLSchema}int/* element namepublicationDate type{http://www.w3.org/2001/XMLSchema}dateTime minOccurs0/* element nametitle type{http://www.w3.org/2001/XMLSchema}string minOccurs0/* /sequence* /restriction* /complexContent* /complexType* /pre* * */ XmlAccessorType(XmlAccessType.FIELD) XmlType(name book, propOrder {author,pages,publicationDate,title }) public class Book {protected Author author;protected int pages;XmlSchemaType(name dateTime)protected XMLGregorianCalendar publicationDate;protected String title;/*** Gets the value of the author property.* * return* possible object is* {link Author }* */public Author getAuthor() {return author;}/*** Sets the value of the author property.* * param value* allowed object is* {link Author }* */public void setAuthor(Author value) {this.author value;}/*** Gets the value of the pages property.* */public int getPages() {return pages;}/*** Sets the value of the pages property.* */public void setPages(int value) {this.pages value;}/*** Gets the value of the publicationDate property.* * return* possible object is* {link XMLGregorianCalendar }* */public XMLGregorianCalendar getPublicationDate() {return publicationDate;}/*** Sets the value of the publicationDate property.* * param value* allowed object is* {link XMLGregorianCalendar }* */public void setPublicationDate(XMLGregorianCalendar value) {this.publicationDate value;}/*** Gets the value of the title property.* * return* possible object is* {link String }* */public String getTitle() {return title;}/*** Sets the value of the title property.* * param value* allowed object is* {link String }* */public void setTitle(String value) {this.title value;}} 第三类也许是意外类是ObjectFactory类。 它包含每个生成的类或接口的工厂方法。 如果您需要创建对象的JAXBElement表示形式这将非常有用。 // // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 // See a hrefhttp://java.sun.com/xml/jaxbhttp://java.sun.com/xml/jaxb/a // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2014.01.13 at 07:38:24 PM CET //package blog.thoughts.on.java;import javax.xml.bind.JAXBElement; import javax.xml.bind.annotation.XmlElementDecl; import javax.xml.bind.annotation.XmlRegistry; import javax.xml.namespace.QName;/*** This object contains factory methods for each * Java content interface and Java element interface * generated in the blog.thoughts.on.java package. * pAn ObjectFactory allows you to programatically * construct new instances of the Java representation * for XML content. The Java representation of XML * content can consist of schema derived interfaces * and classes representing the binding of schema * type definitions, element declarations and model * groups. Factory methods for each of these are * provided in this class.* */ XmlRegistry public class ObjectFactory {private final static QName _Author_QNAME new QName(, author);private final static QName _Book_QNAME new QName(, book);/*** Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: blog.thoughts.on.java* */public ObjectFactory() {}/*** Create an instance of {link Author }* */public Author createAuthor() {return new Author();}/*** Create an instance of {link Book }* */public Book createBook() {return new Book();}/*** Create an instance of {link JAXBElement }{code }{link Author }{code }}* */XmlElementDecl(namespace , name author)public JAXBElementAuthor createAuthor(Author value) {return new JAXBElementAuthor(_Author_QNAME, Author.class, null, value);}/*** Create an instance of {link JAXBElement }{code }{link Book }{code }}* */XmlElementDecl(namespace , name book)public JAXBElementBook createBook(Book value) {return new JAXBElementBook(_Book_QNAME, Book.class, null, value);}}结论 我们研究了xjc并将其用于为现有XSD模式定义生成所需的绑定类。 xjc为每种复杂类型生成了一个类并为简化JAXBElement表示形式的创建提供了附加的工厂类。 您如何看待xjc和生成的代码 请给我留言并告诉我。 我认为该工具可生成非常干净的代码并节省大量时间。 在大多数情况下可以将生成的代码直接添加到项目中。 但是即使不是这种情况基于生成的代码进行一些重构比自己做所有事情要快得多。 翻译自: https://www.javacodegeeks.com/2014/05/generate-your-jaxb-classes-in-a-second-with-xjc.htmljaxb-xjc.jar
http://www.pierceye.com/news/345941/

相关文章:

  • 建设博客网站步骤常州网站建设百科
  • 门户网站 管理系统wordpress 微信图标
  • 广元网站建设广元莱芜论坛二手车
  • 山东省建设工程质量监督网站广州软件合作中心
  • 郑州网站建设怎么样通州建设局网站
  • 免费网站建设福州怎么修改网站主页
  • 深圳企业建站设计公司wordpress不显示样式
  • 外贸网站商城广东省建设协会网站
  • 杭州制作企业公司网站wordpress数据库添加用户
  • 主域名进入网站广告标识标牌制作厂家
  • 网站建设基础流程摘要专题网站建设策划
  • 滁州网站建设电话网站建设与网站优化
  • 慈溪做网站公司哪家好淘宝商城的网站建设
  • 安徽建设厅网站怎么打不开太原网络搭建
  • idea 网站开发最好的免费推广平台
  • 专业排名优化网站怎么建网站教程视频app
  • 全国八大员报名官方网站支付宝小程序开发工具
  • 怎么查看vps网站服务器时间中国建设会计协会网站
  • 门户网站上的广告怎么做深圳服装网站建设
  • 公司网站上线的通知抚州营销型网站建设
  • 中国住房城乡和城乡建设部网站小广告文案
  • 做带字头像的网站wordpress 翻页设置
  • 网站横幅js代码公众号如何申请
  • 找网站建设需要问什么软件物联网平台功能
  • 含山县城市建设有限公司网站成都中高风险地区名单最新
  • 鄂州手机网站建设深圳seo网站设计
  • 网站内容的实现方式建筑设计人才招聘
  • 网站做优化效果怎样iis怎么做网站空间
  • 重庆市建设局网站郑州网站建设哪一家好
  • wordpress指定分类广告金融网站排名优化