Using XSDBuilder to build XML Schema objects

I want to parse an XML document using an XML Schema Definition that I provide explicitly to the parser, rather than one identified in the document being validated. It appears that I can create an XML Schema object using XSDBuilder, and give it to the XML parser using XMLParser.setXMLSchema(). The problem is that XSDBuilder.build() wants an XSD system ID that is a file, and I want to retrieve XSD documents from non-file-based stores. Ideally, I'd like to give the builder a stream containing the XSD, or barring that, provide a custom entity resolver that it can use. Any ideas how to go about doing that? Or am I going about this the wrong way?
Thanks for any advice,
markl
null

Hi,
I didn't test it wit XML Schema, but any parser that finds a system ID should call an implementation of EntityResolver that returns an InputSource for the system ID.
An InputSource is a wrapper around an InputStream and its url and it ssystemID.
An example for sun's parser is on http://www.s-line.de/homepages/gerd_castan/java/resolve.html
(I "tested" this code also with oracles DTD and Schema parser. This means that I used this code for oracle, too, but I didn't go through the debugger to see what it does.)
Cheers,
Gerd

Similar Messages

  • Is it possible to use List Type in XML schema within the SOA Rule author?

    Is it possible to use List Type in XML schema within the SOA Suite Rule author? The reason is that with the following XSD, Rule author generates XML facts of type "List" for the element "ResultSet". Basically I want to check the Input facts (Input1, Input2, Input3) for some conditions and then assign action to the element Resultset of type List (array). The output Resultset can contain multiple values based on the input facts. My problem is that I am unable to see the ResultSet in the "Assign" action type of the action block. Is it possible to use the Resultset of type List with the Rule author or is there any limitation on the rule author and any workaround for this?
    <schema xmlns="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.oracle.com/ns/TestMultipleOutputs"
    elementFormDefault="qualified">
    <element name="TestMultipleOutputs">
    <complexType>
    <sequence minOccurs="0">
    <element name="Input1" type="string" minOccurs="0"/>
    <element name="Input2" type="string" minOccurs="0"/>
    <element name="Input3" type="string" minOccurs="0"/>
    <element name="ResultSet" type="string" minOccurs="0"
    maxOccurs="unbounded"/>
    </sequence>
    </complexType>
    </element>
    </schema>
    --Thanks a lot                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Hi Richard,
    I have slightly modified the xml schema you suggested and was able to import into the rule author. the following is the modified XSD. Rule Author created a List type for the "ResultSet" . I still don't see "Resultset" in the assign action, so I tried creating RL function in order to assign the output to the "Resultset", but was unsuccessful so far. can you please let me know how to populate the resultset with the output values? Thanks a lot.
    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema attributeFormDefault="unqualified"
    xmlns:ns1="http://www.oracle.com/ns/TestComplexOutputs"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.oracle.com/ns/TestComplexOutputs"
    xmlns:tns="http://www.oracle.com/ns/TestComplexOutputs"
    elementFormDefault="qualified">
    <xsd:element name="TestComplexOutputs">
    <xsd:complexType>
    <xsd:sequence minOccurs="0">
    <xsd:element name="Input1" type="xsd:string" minOccurs="0"/>
    <xsd:element name="Input2" type="xsd:string" minOccurs="0"/>
    <xsd:element name="Input3" type="xsd:string" minOccurs="0"/>
    <xsd:element name="ResultSet" type="tns:ResultSetType" minOccurs="0"
    maxOccurs="unbounded"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:complexType name="ResultSetType">
    <xsd:sequence>
    <xsd:element name="ResultSet" type="tns:ResultSetStructure" minOccurs="1"
    maxOccurs="unbounded"/>
    </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="ResultSetStructure">
    <xsd:sequence>
    <xsd:element name="ErrorReason">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string"/>
    </xsd:simpleType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:schema>

  • Build.xml classpath ref to be used in another build XML file

    Hi,
    I have ant build.xml with a target as
    <target name="build_project">
              <ant antfile="C:/projects/antbuild/build.xml" inheritAll="true">
                   <target name="clean" />
              </ant>
         </target>
         in report1.xml.
         This build.xml inturn have the classpath defined in it with the JARS added to the classpath.
         In the report2.xml,
         Can I use the classpathref in build.xml which is defined in report2.xml? Where report2.xml is imported in report1.xml as
         <import file="report2.xml" />
         If I can do so I don't have to create duplicate class path ref again adding all the JARS in report2.xml?
         Please clarify.
    Thanks.

    I've used quite a bit of ANT in the past, but I don't really know what to answer to your question that is in any way helpful to you. I remember that ANT has some form of build file inheritance built in, I've played around with it in years ago to try and crank out somewhat standardized build files with reusable elements. What I can recall is that I had to read a book on advanced ANT usage to be able to work it out, the online manual wasn't nearly enough.

  • Using ID constraints in XML Schema

    I've been testing out a schema containing a number of key/keyref constraints for validation with the DOM parser and I've been having problems.
    Specifically, when I've used predicates as in:
    blocklist/block[1],
    blocklist/block[position()=1] or
    blocklist/block[position()=last()]
    the parser hasn't found any nodes.
    Does anybody know anything about this - what type of XPath expressions are allowed in selector and field elements and exactly what predicate syntax is recognised (if any!)?

    My mistake - it was a namespace problem!!
    I'd remembered to use namespace prefixes for the xpath names in the keyrefs but not in the keys!
    Because I was getting different messages from the parser when I was defining the keyrefs with and without the predicates, I got the impression that it was working ok without predicates and that it was a predicate problem.
    Actually, I don't think that the error messages returned from the parser for broken key constraints are very infomative.
    I have three keys and keyrefs defined. If there is a constraint error, the parser doesn't tell you which keyref the error is with, only that there is an error with one of them. Additionally, because the the key and keyref tables are calculated after the rest of the document has been schema verified, the line given as the error line is the current line - ie the last line of document!

  • Exception when using the unsignedByte, short  XML Schema datatypes

    Hi,
    I am generating the java classes form my XSD file, where i have defined the
    datatypes like int and short.
    Example:
    1) <xs:element name="Red" type="xs:unsignedByte"/>
    2) <xs:element name="Border" type="xs:int" default="0"/>
    but JAXB is giving the following exception -
    DefaultValidationEventHandler: [ERROR]: Unexpected text ""
    Location:
    java.lang.NullPointerException
         at com.sun.xml.bind.DatatypeConverterImpl.parseShort(DatatypeConverterImpl.java:90)
         at javax.xml.bind.DatatypeConverter.parseShort(DatatypeConverter.java:170)
         at com.sumasoft.tbws.xmlapi.form.formelements.impl.ColorTypeImpl$Unmarshaller.eatText1(ColorTypeImpl.java:373)
         at com.sumasoft.tbws.xmlapi.form.formelements.impl.ColorTypeImpl$Unmarshaller.handleText(ColorTypeImpl.java:350)
         at com.sumasoft.tbws.xmlapi.form.formelements.impl.runtime.AbstractUnmarshallingEventHandlerImpl.text(AbstractUnmarshallingEventHandlerImpl.java:82)
         at com.sumasoft.tbws.xmlapi.form.formelements.impl.runtime.SAXUnmarshallerHandlerImpl.consumeText(SAXUnmarshallerHandlerImpl.java:210)
         at com.sumasoft.tbws.xmlapi.form.formelements.impl.runtime.SAXUnmarshallerHandlerImpl.processText(SAXUnmarshallerHandlerImpl.java:214)
         at com.sumasoft.tbws.xmlapi.form.formelements.impl.runtime.SAXUnmarshallerHandlerImpl.endElement(SAXUnmarshallerHandlerImpl.java:139)
         at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source)
         at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
         at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
         at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
         at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
         at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
         at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
         at com.sumasoft.tbws.xmlapi.form.formelements.impl.runtime.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:140)
         at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:131)
         at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:178)
         at com.sumasoft.tbws.xmlapi.TBWSUnmarshaller.readXML(TBWSUnmarshaller.java:66)
         at com.sumasoft.tbws.xmlapi.TBWSUnmarshaller.<init>(TBWSUnmarshaller.java:43)
         at com.sumasoft.tbws.xmlapi.TBWSUnmarshaller.main(TBWSUnmarshaller.java:188)
    --------------- linked to ------------------
    javax.xml.bind.UnmarshalException: Unexpected text ""
    - with linked exception:
    [java.lang.NullPointerException]
         at com.sumasoft.tbws.xmlapi.form.formelements.impl.runtime.SAXUnmarshallerHandlerImpl.handleEvent(SAXUnmarshallerHandlerImpl.java:577)
         at com.sumasoft.tbws.xmlapi.form.formelements.impl.runtime.AbstractUnmarshallingEventHandlerImpl.reportError(AbstractUnmarshallingEventHandlerImpl.java:139)
         at com.sumasoft.tbws.xmlapi.form.formelements.impl.runtime.AbstractUnmarshallingEventHandlerImpl.handleUnexpectedTextException(AbstractUnmarshallingEventHandlerImpl.java:121)
         at com.sumasoft.tbws.xmlapi.form.formelements.impl.ColorTypeImpl$Unmarshaller.handleText(ColorTypeImpl.java:363)
         at com.sumasoft.tbws.xmlapi.form.formelements.impl.runtime.AbstractUnmarshallingEventHandlerImpl.text(AbstractUnmarshallingEventHandlerImpl.java:82)
         at com.sumasoft.tbws.xmlapi.form.formelements.impl.runtime.SAXUnmarshallerHandlerImpl.consumeText(SAXUnmarshallerHandlerImpl.java:210)
         at com.sumasoft.tbws.xmlapi.form.formelements.impl.runtime.SAXUnmarshallerHandlerImpl.processText(SAXUnmarshallerHandlerImpl.java:214)
         at com.sumasoft.tbws.xmlapi.form.formelements.impl.runtime.SAXUnmarshallerHandlerImpl.endElement(SAXUnmarshallerHandlerImpl.java:139)
         at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source)
         at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
         at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
         at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
         at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
         at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
         at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
         at com.sumasoft.tbws.xmlapi.form.formelements.impl.runtime.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:140)
         at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:131)
         at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:178)
         at com.sumasoft.tbws.xmlapi.TBWSUnmarshaller.readXML(TBWSUnmarshaller.java:66)
         at com.sumasoft.tbws.xmlapi.TBWSUnmarshaller.<init>(TBWSUnmarshaller.java:43)
         at com.sumasoft.tbws.xmlapi.TBWSUnmarshaller.main(TBWSUnmarshaller.java:188)
    If the Datatypes are valid then why the JAXB is throwing this exception?
    Any one knows , plz help.

    I have a reason to believe that my anti virus scanner is modifying the jar file.
    I had initially downloaded the jar file from sourceforge. It had the com.iwss.... package.
    Now i dowloaded the file in zip format and that package is not there in the zip file. But i have a new problem now.
    My eclispe just crashed with the following error message.
    JVM terminated. Exit code=1
    D:\Oracle\product\10.1.0\Client_2\jre\1.4.2\bin\javaw.exe
    -Xms40m
    -Xmx256m
    -jar C:\eclipse\startup.jar
    -os win32
    -ws win32
    -arch x86
    -launcher C:\eclipse\eclipse.exe
    -name Eclipse
    -showsplash 600
    -exitdata 1bc_74
    -vm D:\Oracle\product\10.1.0\Client_2\jre\1.4.2\bin\javaw.exe
    -vmargs
    -Xms40m
    -Xmx256m
    -jar C:\eclipse\startup.jar

  • XML Schema Collection (SQL Server 2012): How to create an XML Schema Collection that can be used to Validate a field name (column title) of an existing dbo Table of a Database in SSMS2012?

    Hi all,
    I used the following code to create a new Database (ScottChangDB) and a new Table (marvel) in my SQL Server 2012 Management Studio (SSMS2012) successfully:
    -- ScottChangDB.sql saved in C://Documents/SQL Server XQuery_MacLochlainns Weblog_code
    -- 14 April 2015 09:15 AM
    USE master
    IF EXISTS
    (SELECT 1
    FROM sys.databases
    WHERE name = 'ScottChangDB')
    DROP DATABASE ScottChangDB
    GO
    CREATE DATABASE ScottChangDB
    GO
    USE ScottChangDB
    CREATE TABLE [dbo].[marvel] (
    [avenger_name] [char] (30) NULL, [ID] INT NULL)
    INSERT INTO marvel
    (avenger_name,ID)
    VALUES
    ('Hulk', 1),
    ('Iron Man', 2),
    ('Black Widow', 3),
    ('Thor', 4),
    ('Captain America', 5),
    ('Hawkeye', 6),
    ('Winter Soldier', 7),
    ('Iron Patriot', 8);
    SELECT avenger_name FROM marvel ORDER BY ID For XML PATH('')
    DECLARE @x XML
    SELECT @x=(SELECT avenger_name FROM marvel ORDER BY ID FOR XML PATH('Marvel'))--,ROOT('root'))
    SELECT
    person.value('Marvel[4]', 'varchar(100)') AS NAME
    FROM @x.nodes('.') AS Tbl(person)
    ORDER BY NAME DESC
    --Or if you want the completed element
    SELECT @x.query('/Marvel[4]/avenger_name')
    DROP TABLE [marvel]
    Now I am trying to create my first XML Schema Collection to do the Validation on the Field Name (Column Title) of the "marvel" Table. I have studied Chapter 4 XML SCHEMA COLLECTIONS of the book "Pro SQL Server 2008 XML" written by
    Michael Coles (published by Apress) and some beginning pages of XQuery Language Reference, SQL Server 2012 Books ONline (published by Microsoft). I mimicked  Coles' Listing 04-05 and I wanted to execute the following first-drafted sql in
    my SSMS2012:
    -- Reference [Scott Chang modified Listing04-05.sql of Pro SQL Server 2008 XML by Michael Coles (Apress)]
    -- [shcColes04-05.sql saved in C:\\Documents\XML_SQL_Server2008_code_Coles_Apress]
    -- [executed: 2 April 2015 15:04 PM]
    -- shcXMLschemaTableValidate1.sql in ScottChangDB of SQL Server 2012 Management Studio (SSMS2012)
    -- saved in C:\Documents\XQuery-SQLServer2012
    tried to run: 15 April 2015 ??? AM
    USE ScottChangDB;
    GO
    CREATE XML SCHEMA COLLECTION dbo. ComplexTestSchemaCollection_all
    AS
    N'<?xml version="1.0"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:element name="marvel">
    <xsd:complexType>
    <xsd:all>
    <xsd:element name="avenger_name" />
    <xsd:element name="ID" />
    </xsd:all>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>';
    GO
    DECLARE @x XML (dbo. ComplexTestSchemaCollection_all);
    SET @x = N'<?xml version="1.0"?>
    <marvel>
    <avenger_name>Thor</name>
    <ID>4</ID>
    </marvel>';
    SELECT @x;
    GO
    DROP XML SCHEMA COLLECTION dbo.ComplexTestSchemaCollection_all;
    GO
    I feel that drafted sql is very shaky and it needs the SQL Server XML experts to modify to make it work for me. Please kindly help, exam the coding of my shcXMLTableValidate1.sql and modify it to work.
    Thanks in advance,
    Scott Chang

    Hi Scott,
    2) Yes, FOR XML PATH clause converts relational data to XML format with a specific structure for the "marvel" Table. Regarding validate all the avenger_names, please see below
    sample.
    DECLARE @x XML
    SELECT @x=(SELECT ID ,avenger_name FROM marvel FOR XML PATH('Marvel'))
    SELECT @x
    SELECT
    n.value('avenger_name[1]','VARCHAR(99)') avenger_name,
    n.value('ID[1]','INT') ID
    FROM @x.nodes('//Marvel') Tab(n)
    WHERE n.value('ID[1]','INT') = 1 -- specify the ID here
    --FOR XML PATH('Marvel')  --uncommented this line if you want the result as element type
    3)i.check the xml schema content
    --find xml schema collection
    SELECT ss.name,xsc.name collection_name FROM sys.xml_schema_collections xsc JOIN sys.schemas ss ON xsc.schema_id= ss.schema_id
    select * from sys.schemas
    --check the schema content,use the name,collection_name from the above query
    SELECT xml_schema_namespace(N'name',N'collection_name')
    3)ii. View can be viewed as virtual table. Use a view to list the XML schema content.
    CREATE VIEW XSDContentView
    AS
    SELECT ss.name,xsc.name collection_name,cat.content
    FROM sys.xml_schema_collections xsc JOIN sys.schemas ss ON xsc.schema_id= ss.schema_id
    CROSS APPLY(
    SELECT xml_schema_namespace(ss.name,xsc.name) AS content
    ) AS cat
    WHERE xsc.name<>'sys'
    GO
    SELECT * FROM XSDContentView
    By the way, it would be appreciated if you can spread your questions into posts. For any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • Using HAL to generate XML files

    Greetings,<BR>I'd like to use HAL to build XML files and feeding certain variables while these files are generated. When the XML file is done being created, it will contain the variables passed. There are over 500 XML required to be build and for each of these files, only 2 or 3 variables must be passed to them. A template of the xml file was created using the Batch scheduler from Hyperion Reports, and this is the file I'd like to use as a template and build a HAL adapter based on that file.<BR><BR>Does any one have a sample of the XML adapter (via screen shot) that I can use a starting guide?<BR><BR>Many thanks in advance for your time.

    Hi,
    I'm running into the same problem deploying the classes generated by the class generator. Code works fine from JDeveloper, but had to put my DTD in the directory where my classes are. Deploying the classes with Apache's JServ gives me a NullPointer exception on the first addNode method. I guess it can't find the DTD. I tried to put the DTD in many locations but this didn't fix the problem. Any suggestions?
    Steve,
    Did you fix this problem? Thanx!
    null

  • Try to do my first XML Schema in SQL Server 2012 Mangement Studio(SSMS2012)-How to execute the xsd and xml files in SSMS2012?

    Hi all,
    I learmed the basic stuff of XML, DTD, DOM, etc. long time ago. Now, I came back to resume my XML journey and try to learn the XML Schemas, XPath and XQuery. I have Microsoft SQL Server 2012 Management Studio (SSMS2012) in our computer network. From
    Page 221 of the old Book "Beginning XML 2nd Edition" written by David Hunter, et.al., (published by Wrox), I copied the name5.xsd and name5.xml :
    <?xml version="1.0"?>
    <schema xmlns=http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.wrox.com/name" xmlns:target="http://www.wrox.com/name"
    elementFormDefault="qualified">
    <element name="name">
    <complexType>
    <sequence>
    <element name="first" type="string"/>
    <element name="middle" type="string"/>
    <element name="last" type="string"/>
    </sequence>
    </complexType>
    </element>
    </schema>
    <?xml version="1.0"?>
    <name
    xmlns=http://www.wrox.com/name"
    xmlns:xsi="http://www.wrox.org/2001XMLSchema-instance"
    xsi:schemaLocation="http://www.wrox.com/name name5.xsd"
    title="Mr.">
    <first>John</first>
    <middle>Frizgerald</middle>
    <last>Doe</last>
    </name>
    How can I execute these two files in my SSMS2012 for doing my first XML Schema trial?
    Please kindly help, advise and respond.
    Thanks in advance,
    Scott Chang

    Hi Eric Zhang, Thanks for your nice response.
    1) I saw the CREATE XML SCHEMA COLLECTION (Transact-SQL) and tried  its first example "Create XML schema collection in the database" in my SQL Server 2012 Management Studio (SSMS2012):
    -- Create a sample database in which to load the XML schema collection.
    -- Copied this set of code stsments from Microsoft Library (ms176009)
    -- ColesMS12_20a.sql (saved in C:/Documents/SQL Server Management Studio)
    -- 19 March 2015 1145 AM
    CREATE DATABASE SampleDB
    GO
    USE SampleDB
    GO
    CREATE XML SCHEMA COLLECTION ManuInstructionsSchemaCollection AS
    N'<?xml version="1.0" encoding="UTF-16"?>
    <xsd:schema targetNamespace="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelManuInstructions"
    xmlns ="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelManuInstructions"
    elementFormDefault="qualified"
    attributeFormDefault="unqualified"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
    <xsd:complexType name="StepType" mixed="true" >
    <xsd:choice minOccurs="0" maxOccurs="unbounded" >
    <xsd:element name="tool" type="xsd:string" />
    <xsd:element name="material" type="xsd:string" />
    <xsd:element name="blueprint" type="xsd:string" />
    <xsd:element name="specs" type="xsd:string" />
    <xsd:element name="diag" type="xsd:string" />
    </xsd:choice>
    </xsd:complexType>
    <xsd:element name="root">
    <xsd:complexType mixed="true">
    <xsd:sequence>
    <xsd:element name="Location" minOccurs="1" maxOccurs="unbounded">
    <xsd:complexType mixed="true">
    <xsd:sequence>
    <xsd:element name="step" type="StepType" minOccurs="1" maxOccurs="unbounded" />
    </xsd:sequence>
    <xsd:attribute name="LocationID" type="xsd:integer" use="required"/>
    <xsd:attribute name="SetupHours" type="xsd:decimal" use="optional"/>
    <xsd:attribute name="MachineHours" type="xsd:decimal" use="optional"/>
    <xsd:attribute name="LaborHours" type="xsd:decimal" use="optional"/>
    <xsd:attribute name="LotSize" type="xsd:decimal" use="optional"/>
    </xsd:complexType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>' ;
    GO
    -- Verify - list of collections in the database.
    select *
    from sys.xml_schema_collections
    -- Verify - list of namespaces in the database.
    select name
    from sys.xml_schema_namespaces
    -- Use it. Create a typed xml variable. Note collection name specified.
    DECLARE @x xml (ManuInstructionsSchemaCollection)
    GO
    --Or create a typed xml column.
    CREATE TABLE T (
    i int primary key,
    x xml (ManuInstructionsSchemaCollection))
    GO
    -- ////The following code statements are not used in order to create SampleDB
    -- Clean up
    ---DROP TABLE T
    ---GO
    ---DROP XML SCHEMA COLLECTION ManuInstructionsSchemaCollection
    ---Go
    ---USE Master
    ---GO
    ---DROP DATABASE SampleDB
    It worked and I got the following results:
    1 4 NULL sys 2009-04-13 12:59:13.390 2012-02-10 20:16:02.097
    65536 1 NULL ManuInstructionsSchemaCollection 2015-03-19 11:47:17.660 2015-03-19 11:47:17.660
    http://www.w3.org/2001/XMLSchema
    http://schemas.microsoft.com/sqlserver/2004/sqltypes
    http://www.w3.org/XML/1998/namespace
    http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelManuInstructions
    But, I don't undertand (i) what SCHEMA COECTION is, (ii) what <xsd:schema targetNamespace=.....</xsd:complexType> are, (iii) How I can specify my "project specific" schema in the Microsoft SCHEMA COLLECTION to check my xml file.
    2) I dived in the XQuery programmimng in SSMS2012 in the last few weeks. I used the examles of Ad-Hoc XML File Query by Seth Delconte (in
    httpS://www.simple-talk.com/content/print.aspx?article=1756) in my SSMS2012. They worked. But I don't understand the (i) Importing XML data using a function, (ii) Using the XQuery contans()
    function to find substrings, (iii)Efficiency comparisons in the article.
    Please kindly help me in enlightening me to resolve the difficulties listed in 1) and 2).
    Thanks,
    Scott Chang

  • XML Schemas & XML SCHEMA COLLECTIONS: XSD.exe & the tool in C:\Program Files (x86)\Microsoft SDKs\Windows\v7..0A\Bin\x64?.

    Hi all,
    I just read Pages 346-348 of the book "Microsoft SQL Server 2012 Bible" written by A. Jorgensen, P. LeBlanc, J. Chinchilla, J. Segarra & A. Nelson (published by Wiley) regarding XML Schemas and XML SCHEMA COLLECTIONS: Step 1.  create and
    save orderxml.xml
    <Order OrderID="1">
    <Item>
    <ItemNumber>V001</ItemNumber>
    <Quantity>1</Quantity>
    <Price>299.99</Price>
    </Item>
    </Order>
    Step 2.  using the tool in the following location:
    C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\x64
    Open a command prompt, and navigate the preceding directory. The syntax for creating schema is: Xsd.exe C:\temp\orderxml.xml /outputdirectory:c:\temp  to create the orderxml.xsd file.  
    Step 3. Copy all the contents of the orderxml.xsd file to the clipboard, and create a new query window in SQL Server Management Studio, pasting in the content of the clipboard. To create the XML Schema Collection, you need to add the CREATE XML SCHEMA COLLECTION
    statement to the beginning of the schema as shown below:
    --MSss2012bibleP348.sql for XML Schema Collection OrderInformationSchemaCollection
    -- Copied and executed by SHC (Date & Time): 24 April 2015 8:05 AM
    USE ScottChangDB
    GO
    Create XML SCHEMA COLLECTION OrderInformationCollection AS
    N'<?xml version="1.0" encoding="utf-16"?>
    <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:msdata="urn:schema-microsoft-com:xml-msdata">
    <xs:element name="Order">
    <xs:sequence>
    <xs:element name="Item" minOccurs="0" maxOccurs="unbounded".
    <xs:complexType>
    <xs:sequence>
    <xs:element name="ItemNumber" type="xs:string" minOccurs="0" />
    <xs:element name="Quantity" type="xs:string" minOccurs="0" />
    <xs:element name="price" type="xs:string" minOccurs="0" />
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:sequence>
    <xs:attribute name="OrderID" type="xs:string" />
    </xs:complexType>
    </xs:element>
    <xs:element name="NewDataSet" msdata" msdata:IsDataSet="true"
    msdata:UseCurrentLocale="true">
    <xs:complexType>
    <xs:choice minOccurs="0" maxOccurs="unbounded'>
    <xs:element ref="Order" />
    </xs:choice>
    </xs:complexType>
    </xs:element>
    </xs:schema>' ;
    /* Apply it to the table/columns */
    ALTER TABLE ItemInfo
    ALTER COLUMN ItemData xml (OrderInformationCollection)
    GO
    I prepared (i) the orderxml.xml file for Step 1 and Step 2, and (ii) the MSss2012bibleP348.sql file for Step 3. But I am not sure that I can do the Steps (i) and (ii) in my PC that does not have the regular version of Microsoft SQL Server 2012 and Microsoft
    Visual Studio 2012. Furthermore, I  have difficulties to do Step 2 and Step 3 in my PC that is the part of Windows 7 Lan Computer System in my office: I navigated to my C:\Program Files (x86)\Microsoft SDKs\v7.0A\Bin\, I did not see the x64
    thing in the  Bin folder, but, I saw the xsd.exe in the Bin folder. If I click the xsd.exe and I get the following in the bottom of the PC screen:   
    xsd.exe Date modified:12/122011 12:55 PM    Date created:  12/12/2011  12:55 PM
    Applicaion    Size:81.8 KB
    Also, I see my PC screen flashes (and it looks like a dialog box with black background to flash for me to type the command) quickly. I am lost completely in this step and I don't understand the whole thing in doing Step 1, Step 2, and Step 3
    I briefly summarized/described/presented above.
    I need the following help from the experts of XML Schemas and XML Schema Collections in Microsoft SQL Server 2012 Management Studio:
    Help #1: I don't understan the concept of Step 1, Step2 and Step 3 to do XML Schema, XSD.exe, and XML Schema Collection in the SQL Server 2012!!?? I just have the SQL Server 2012 Management Studio (SSMS2012) in my PC.
    Help #2: How can I execute the xsd.exe in my C:\Program Files  (x86)\Microsoft SDKs\Windows\v7.0A\Bin\ folder?
    Help #3: I just learned the basic things of creating XML SCHEMA COLLECTIONS in my SSMS2012 directly. Is the MSss2012P348.sql (I created and presented above) right for the task? How can I use clipboard to create the XML Schema Collection in my ScottChangDB
    database?
    Please kindly help and give me the answers/comments for Help #1, Help #2 and Help #3.
    Thanks in advance,
    Scott Chang  

    Hi Scott,
    Help #1: I don't understan the concept of Step 1, Step2 and Step 3 to do XML Schema, XSD.exe, and XML Schema Collection in the SQL Server 2012!!?? I just have the SQL Server 2012 Management Studio (SSMS2012) in my PC.
    Step1 and Step2 not that related to SQL Server, you can get the XSD from a given XML with an online XSD generator.
    Google search: XSD generator
    Help #2: How can I execute the xsd.exe in my C:\Program Files  (x86)\Microsoft SDKs\Windows\v7.0A\Bin\ folder?
    Please see the link in the #1
    Help #3: I just learned the basic things of creating XML SCHEMA COLLECTIONS in my SSMS2012 directly. Is the MSss2012P348.sql (I created and presented above) right for the task? How can I use clipboard to create the XML Schema Collection in
    my ScottChangDB database?
    See the syntax and example in
    create XML schema collection
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • Collection in a XML schema.

    Hello!
    I would like to see some example code of how to use collections in an XML schema.
    Thank you.

    Hi Scott,
    2) Yes, FOR XML PATH clause converts relational data to XML format with a specific structure for the "marvel" Table. Regarding validate all the avenger_names, please see below
    sample.
    DECLARE @x XML
    SELECT @x=(SELECT ID ,avenger_name FROM marvel FOR XML PATH('Marvel'))
    SELECT @x
    SELECT
    n.value('avenger_name[1]','VARCHAR(99)') avenger_name,
    n.value('ID[1]','INT') ID
    FROM @x.nodes('//Marvel') Tab(n)
    WHERE n.value('ID[1]','INT') = 1 -- specify the ID here
    --FOR XML PATH('Marvel')  --uncommented this line if you want the result as element type
    3)i.check the xml schema content
    --find xml schema collection
    SELECT ss.name,xsc.name collection_name FROM sys.xml_schema_collections xsc JOIN sys.schemas ss ON xsc.schema_id= ss.schema_id
    select * from sys.schemas
    --check the schema content,use the name,collection_name from the above query
    SELECT xml_schema_namespace(N'name',N'collection_name')
    3)ii. View can be viewed as virtual table. Use a view to list the XML schema content.
    CREATE VIEW XSDContentView
    AS
    SELECT ss.name,xsc.name collection_name,cat.content
    FROM sys.xml_schema_collections xsc JOIN sys.schemas ss ON xsc.schema_id= ss.schema_id
    CROSS APPLY(
    SELECT xml_schema_namespace(ss.name,xsc.name) AS content
    ) AS cat
    WHERE xsc.name<>'sys'
    GO
    SELECT * FROM XSDContentView
    By the way, it would be appreciated if you can spread your questions into posts. For any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • Error when deleting and registering an xml schema

    Why do I get an error saying that my schema 'xsd/Envelope.xsd' already exists when I try to register it and yet I cannot delete it and it does not exist in the USER_XML_SCHEMAS table?
    SQL> declare
    2 begin
    3 dbms_xmlschema.deleteSchema('xsd/Envelope.xsd', dbms_xmlschema.DELETE_CASCADE_FORCE);
    4 end;
    5 /
    declare
    ERROR at line 1:
    ORA-31000: Resource 'xsd/Envelope.xsd' is not an XDB schema document
    ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 0
    ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 100
    ORA-06512: at line 3
    SQL> declare
    2 begin
    3 DBMS_XMLSCHEMA.registerSchema('xsd/Envelope.xsd', xdbURIType('/sys/schemas/REITDIST/xsd/Envelope.xsd').getClob(), TRUE, TRUE, FALSE, FALSE);
    4 end;
    5 /
    declare
    ERROR at line 1:
    ORA-31085: schema "xsd/Envelope.xsd" already registered
    ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 0
    ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 26
    ORA-06512: at line 3
    SQL> select SCHEMA_URL, local, qual_schema_url
    2 from user_xml_schemas;
    no rows selected

    dbms_xmlSchema.registerSchema
         SCHEMAURL     => <your xsd name>,
         SCHEMADOC     => <your xsd>,
         LOCAL          => TRUE,
         GENTYPES     => TRUE,
         GENTABLES     => FALSE,
         FORCE          => TRUE,
    If parameter called "force" is set to TRUE, the schema registration will not raise errors. Instead, it creates an invalid XML schema object in case of any errors. By default, the value of this parameter is FALSE (http://download-uk.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_xmlsch.htm#i1003177)

  • Validation of XML-Schema

    I have a question, if in the XDK there is a
    possibility to check a .xsd file, if it belongs to the XML Schema Definition http://www.w3.org/2000/10/XMLSchema
    Thanks for your help
    Greetings, Merry Christmas and Happy new Year
    Andreas

    Simply use the self-same XML Schema Processor to validate your *.xsd schema against the schema for XML Schema itself. That is, the XML Schema spec "ships" with a normative XML Schema which describes the valid elements that a schema author can use to write a schema. If you have a particular XML schema definition in hand, it is in particular an instance of a document that should be valid by the XML schema for XML Schema, if you've done it correctly.

  • French character in schema object

    I received an error message when tried to register an XML schema on Oracle 9.2.0.4.0 on AIX 5.1 platform. However it went all fine on Windows platform.
    The XML file reads like this when opening up on Windows with Notepad:
    <?xml version="1.0" encoding="utf-8"?>
    <cibc:Lookup xml:lang="fr">L'�ge maximum a atteint</cibc:Lookup>
    While opening up on Unix using VI command, it reads like:
    <cibc:Lookup xml:lang="fr">L'�^�ge maximum a atteint</cibc:Lookup>^M
    select * from NLS_DATABASE_PARAMETERS returns the following difference:
    NLS_CHARACTERSET = WE8MSWIN1252 (Windows)
    NLS_CHARACTERSET = WE8ISO8859P1 (AIX)
    All other values are identical.
    NLS_LANGUAGE AMERICAN
    NLS_TERRITORY AMERICA
    Does anyone know where to check?
    Thanks,
    Harry

    Hi Harry
    Are you registering the XML schema from the same client? If yes, try to register it from the server.
    In fact if the character set of the client and the server are not the same you may have problems...
    Another issue are characters that are part of your XML schema present in WE8MSWIN1252 but not in WE8ISO8859P1. According to the method you use to store the XML schema Oracle translate them in the database character set.
    Chris

  • How read a XML Schema

    Hi,
    i wish to ask you a question: how i can read a XML Schema? Which library i have to use to visit a XML Schema? There are examples on internet? I haven't found anything about it.
    Please help me.
    Thank you, regards
    Gianni

    WXS schemas and RelaxNG schemas have an XML encoding, so any XML parser can read them. ASN1 XML schemas and compact RNG schemas require specialist parsers.
    If you wish to populate a more useful structure than DOM, then Castor has classes to represent and manipulate WXS, though I've not used them myself.
    Pete

  • JMX equivalent for webservice build.xml

    Hi,
    I am using the below build.xml to create and deploy webservices.
    Can I get the equivalent or approximate JMX code (java code using MBeans) to do this.
    <project default="all">
         <!-- set global properties for this build -->
         <property name="wls.username" value="weblogic" />
         <property name="wls.password" value="weblogic" />
         <property name="wls.hostname" value="localhost" />
         <property name="wls.port" value="7001" />
         <property name="wls.server.name" value="AdminServer" />
         <property name="ear.deployed.name" value="wsdlcEar" />
         <property name="example-output" value="output" />
         <property name="compiledWsdl-dir" value="${example-output}/compiledWsdl" />
         <property name="impl-dir" value="${example-output}/impl" />
         <property name="ear-dir" value="${example-output}/wsdlcEar" />
         <property name="clientclass-dir" value="${example-output}/clientclasses" />
         <path id="client.class.path">
              <pathelement path="${clientclass-dir}" />
              <pathelement path="${java.class.path}" />
         </path>
         <taskdef name="wsdlc" classname="weblogic.wsee.tools.anttasks.WsdlcTask" />
         <taskdef name="jwsc" classname="weblogic.wsee.tools.anttasks.JwscTask" />
         <taskdef name="clientgen" classname="weblogic.wsee.tools.anttasks.ClientGenTask" />
         <taskdef name="wldeploy" classname="weblogic.ant.taskdefs.management.WLDeploy" />
         <target name="all" depends="clean,generate-from-wsdl,build-service,deploy,client" />
         <target name="clean" depends="undeploy">
              <delete dir="${example-output}" />
         </target>
         <target name="generate-from-wsdl">
              <wsdlc srcWsdl="wsdl_files/TemperatureService.wsdl" destJwsDir="${compiledWsdl-dir}" destImplDir="${impl-dir}" packageName="examples.webservices.wsdlc" />
         </target>
         <target name="build-service">
              <jwsc srcdir="src" destdir="${ear-dir}">
                   <jws file="examples/webservices/wsdlc/TemperaturePortTypeImpl.java" compiledWsdl="${compiledWsdl-dir}/TemperatureService_wsdl.jar" />
              </jwsc>
         </target>
         <target name="deploy">
              <wldeploy action="deploy" name="${ear.deployed.name}" source="${ear-dir}" user="${wls.username}" password="${wls.password}" verbose="true" adminurl="t3://${wls.hostname}:${wls.port}" targets="${wls.server.name}" />
         </target>
         <target name="undeploy">
              <wldeploy action="undeploy" name="${ear.deployed.name}" failonerror="false" user="${wls.username}" password="${wls.password}" verbose="true" adminurl="t3://${wls.hostname}:${wls.port}" targets="${wls.server.name}" />
         </target>
         <target name="client">
              <clientgen wsdl="http://${wls.hostname}:${wls.port}/temp/TemperatureService?WSDL" destDir="${clientclass-dir}" packageName="examples.webservices.wsdlc.client" />
              <javac srcdir="${clientclass-dir}" destdir="${clientclass-dir}" includes="**/*.java" />
              <javac srcdir="src" destdir="${clientclass-dir}" includes="examples/webservices/wsdlc/client/**/*.java" />
         </target>
         <target name="run">
              <java classname="examples.webservices.wsdlc.client.TemperatureClient" fork="true" failonerror="true">
                   <classpath refid="client.class.path" />
                   <arg line="http://${wls.hostname}:${wls.port}/temp/TemperatureService" />
              </java>
         </target>
    </project>
    Regards,
    Suresh

    JMX is for management, build.xml and what you have here is for assembling applications - in your case webservices.
    unless I'm missing something, using what you have is the best way to go.
    Pete

Maybe you are looking for