xsom

Parsing XML schema java

风格不统一 提交于 2019-12-25 04:59:07
问题 I need to parse XML schema (source can be wsdl file or xsd ) and extract all the complex types and their constituent elements with their types.. I have used JAXB (xjc)but it does not return me a list of all complexTypes . Which alternative (XSOM) should I use? I would prefer some built-in library in jdk6. ` <element name="BankLoanProcessRequest"> <complexType> <sequence> <element name="ClientId" type="int"/> <element name="LoanAmount" type="double"/> </sequence> </complexType> </element>` 回答1

how to get max depth of a xsd using xsom\dom\jaxb?

荒凉一梦 提交于 2019-12-24 04:46:08
问题 how to get max depth of a xsd using xsom. For e.g: total number of elements under each complex types of the xsd? Also if as complex types is there under that complex types the number of element + attributes under that......using dom\xsom\jaxb <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="root" type="root"> <xs:annotation> <xs:documentation> Comment describing

Using a schema to reorder the elements of an XML document in conformance with the schema

ⅰ亾dé卋堺 提交于 2019-12-09 06:24:30
问题 Say I have an XML document (represented as text, a W3C DOM, whatever), and also an XML Schema. The XML document has all the right elements as defined by the schema, but in the wrong order. How do I use the schema to "re-order" the elements in the document to conform to the ordering defined by the schema? I know that this should be possible, probably using XSOM, since the JAXB XJC code generator annotates its generated classes with the correct serialization order of the elements. However, I'm

getting the minOccurs attribute using XSOM from an element

懵懂的女人 提交于 2019-12-07 17:38:50
问题 How do I get the minOccurs attribute off of an element using the XSOM parser? I've seen this example for getting the attributes related to a complex type: private void getAttributes(XSComplexType xsComplexType){ Collection<? extends XSAttributeUse> c = xsComplexType.getAttributeUses(); Iterator<? extends XSAttributeUse> i = c.iterator();while(i.hasNext()){ XSAttributeDecl attributeDecl = i.next().getDecl(); System.out.println("type: "+attributeDecl.getType()); System.out.println("name:"

XSD circular import

天涯浪子 提交于 2019-12-07 10:29:31
问题 I need to parse a XSD with XSOM but this XSD contains circular imports. A.xsd <xs:schema xmlns=”ns1” targetNamespace=”ns1”> <xs:import namespace=”ns2” schemaLocation=”B.xsd”/> <xs:element name=”MyElement” type=”xs:string”/> </xs:schema> B.xsd <xs:schema xmlns=”ns2” targetNamespace=”ns2” xmlns:ns1=”ns1”> <xs:import namespace=”ns1” schemaLocation=”A.xsd”/> <xs:complexType name="MyComplex"> <xs:sequence> <xs:element ref="ns1:MyElement" minOccurs="0"/> <xs:sequence> <xs:complexType> </xs:schema>

Parsing XSD Schema with XSOM in Java. How to access element and complex types

瘦欲@ 提交于 2019-12-07 07:57:01
问题 I’m having a lot of difficuly parsing an .XSD file with a XSOM in Java. I have two .XSD files one defines a calendar and the second the global types. I'd like to be able to read the calendar file and determine that: calendar has 3 properties Valid is an ENUM called eYN Cal is a String Status is a ENUM called eSTATUS Calendar.xsd <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:gtypes="http://www.btec.com/gtypes" elementFormDefault="qualified"

getting the minOccurs attribute using XSOM from an element

你说的曾经没有我的故事 提交于 2019-12-06 01:05:00
How do I get the minOccurs attribute off of an element using the XSOM parser? I've seen this example for getting the attributes related to a complex type: private void getAttributes(XSComplexType xsComplexType){ Collection<? extends XSAttributeUse> c = xsComplexType.getAttributeUses(); Iterator<? extends XSAttributeUse> i = c.iterator();while(i.hasNext()){ XSAttributeDecl attributeDecl = i.next().getDecl(); System.out.println("type: "+attributeDecl.getType()); System.out.println("name:"+attributeDecl.getName()); } } But, can't seem to figure out the right way for getting it off an an element

XSD circular import

旧巷老猫 提交于 2019-12-05 18:03:23
I need to parse a XSD with XSOM but this XSD contains circular imports. A.xsd <xs:schema xmlns=”ns1” targetNamespace=”ns1”> <xs:import namespace=”ns2” schemaLocation=”B.xsd”/> <xs:element name=”MyElement” type=”xs:string”/> </xs:schema> B.xsd <xs:schema xmlns=”ns2” targetNamespace=”ns2” xmlns:ns1=”ns1”> <xs:import namespace=”ns1” schemaLocation=”A.xsd”/> <xs:complexType name="MyComplex"> <xs:sequence> <xs:element ref="ns1:MyElement" minOccurs="0"/> <xs:sequence> <xs:complexType> </xs:schema> XSOM can’t parse the schema because it detects elements that have already been defined due to circular

Parsing XSD Schema with XSOM in Java. How to access element and complex types

北慕城南 提交于 2019-12-05 10:18:04
I’m having a lot of difficuly parsing an .XSD file with a XSOM in Java. I have two .XSD files one defines a calendar and the second the global types. I'd like to be able to read the calendar file and determine that: calendar has 3 properties Valid is an ENUM called eYN Cal is a String Status is a ENUM called eSTATUS Calendar.xsd <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:gtypes="http://www.btec.com/gtypes" elementFormDefault="qualified"> <xs:import namespace="http://www.btec.com/gtypes" schemaLocation="gtypes.xsd"/> <xs:element name=

Using a schema to reorder the elements of an XML document in conformance with the schema

Deadly 提交于 2019-12-03 08:01:52
Say I have an XML document (represented as text, a W3C DOM, whatever), and also an XML Schema. The XML document has all the right elements as defined by the schema, but in the wrong order. How do I use the schema to "re-order" the elements in the document to conform to the ordering defined by the schema? I know that this should be possible, probably using XSOM , since the JAXB XJC code generator annotates its generated classes with the correct serialization order of the elements. However, I'm not familiar with the XSOM API, and it's pretty dense, so I'm hoping one of you lot has some