Use SubForm Set for a choice in XML Schema
I have questions on subformset, the parameter to the 'setInstances' method and the use of 'intial' attribute of 'occur' element of XFA. <br /><br />In XML schema, sometimes there are exclusive choice. In my example, user has to choose between a customer number and postal-address (name, address, city, state...). I use a check box in the form, so either the customer number or postal address subform can be shown, but not both at the same time. I have no problem displaying them on the form. The problem is when I export the XML data from it. It does not work after user clicks on the check box once. If I use button instead of check box, user can press the button no more than twice. Then only the data of the first element in posta-address are exported.<br /><br />I use setInstances(1) and setInstance(0), but I could not find any documentation on the description of the parameter of setInstances.<br />Anyone can take a look at it and help?<br /><br />Thanks. <br /><br />Hongwei Li<br /><br />I would like to post the XDP file. But it is too long (1000 lines) to fit here. So I post javascript and the XML Schema.<br />==========================================================================<br /><event activity="change"><br /> <script contentType="application/x-javascript">if(this.rawValue==true){<br /><br />_customerNumber.setInstances(1);<br />_correspondenceAddress.setInstances(0);<br />}<br />else{<br /><br />_customerNumber.setInstances(0);<br />_correspondenceAddress.setInstances(1);<br />}</script> <br /><br /> <br /><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" id="XFASchemaXSD3"><br /> <xsd:element name="us-correspondence-address"><br /> <xsd:complexType><br /> <xsd:choice><br /> <xsd:sequence><br /> <xsd:element ref="name-1"/><br /> <xsd:element ref="name-2" minOccurs="0"/><br /> <xsd:element ref="us-postal-address"/><br /> </xsd:sequence><br /> <xsd:element ref="customer-number"/><br /> </xsd:choice><br /> </xsd:complexType><br /> </xsd:element><br /> <xsd:element name="name-1" type="xsd:string"/><br /> <xsd:element name="name-2" type="xsd:string"/><br /> <xsd:element name="us-postal-address"><br /> <xsd:complexType><br /> <xsd:sequence><br /> <xsd:element ref="address-1"/><br /> <xsd:element ref="address-2" minOccurs="0"/><br /> <xsd:element ref="city"/><br /> <xsd:element ref="state" minOccurs="0"/><br /> <xsd:element ref="postcode" minOccurs="0"/><br /> <xsd:element ref="country"/><br /> <xsd:element ref="email" minOccurs="0" maxOccurs="unbounded"/><br /> <xsd:element ref="phone" minOccurs="0" maxOccurs="unbounded"/><br /> <xsd:element ref="fax" minOccurs="0" maxOccurs="unbounded"/><br /> </xsd:sequence><br /> </xsd:complexType><br /> </xsd:element><br /> <xsd:element name="customer-number" type="xsd:string"/><br /> <xsd:element name="address-1" type="xsd:string"/><br /> <xsd:element name="address-2" type="xsd:string"/><br /> <xsd:element name="city" type="xsd:string"/><br /> <xsd:element name="state" type="xsd:string"/><br /> <xsd:element name="postcode" type="xsd:string"/><br /> <xsd:element name="country" type="xsd:string"/><br /> <xsd:element name="email" type="xsd:string"/><br /> <xsd:element name="phone" type="xsd:string"/><br /> <xsd:element name="fax" type="xsd:string"/><br /></xsd:schema>
Jimmy,
Sorry about the negligence. Thanks a lot!
This time I can not even export the data of member number for once. Actually I tried different hierarchies (the default by designer is using subformset and useoneof, I have to make changes in XDP to mark both of the min attribute to '0' and one of the branch intitial attribute of occur element to '1'). I had no no luck.
I think this is an Acrobat 7.0 bug. Or in another word, Acrobat 7.0 is not ready to handle XML schema when the content model is more complex. I will have to wait until we go documentation on setInstances() method. I guess the reason of the bug (if it is) is because when you do the setInstances(0), the branch of data DOM was set to NULLType and could not recover back when you click the checkbox to reactivate this portion again.
Hongwei li
Similar Messages
-
What is the t.code for convert Idoc into XML schema
Hi all,
How to convert IDOC as XML schema?
there is one T.code is there for convert IDOC into Xml schem ,I forgot that,
plz tell me if anybody knows that t.code. Very Urgent
Thanks in Advance
rambabu.AWE60
Let me know if you need any other help with that.
Best Regards,
Steve Hardeman -
Using getter/setter for returing a string variable to display on an Applet
have two classes called, class A and class testA.
class A contains an instance variable called title and one getter & setter method. class A as follow.
public class A extends Applet implements Runnable, KeyListener
//Use setter and getter of the instance variable
private String title;
public void init()
ASpriteFactory spriteFactory = ASpriteFactory.getSingleton();
// Find the size of the screen .
Dimension theDimension = getSize();
width = theDimension.width;
height = theDimension.height;
//Create new ship
ship = spriteFactory.createNewShip();
fwdThruster = spriteFactory.createForwardThruster();
revThruster = spriteFactory.createReverseThruster();
ufo = spriteFactory.createUfo();
missile = spriteFactory.createMissile();
generateStars();
generatePhotons();
generateAsteroids();
generateExplosions();
initializeFonts();
initializeGameData();
//Example from Instructor
//setMyControlPanel( new MyControlPanel(this) );
// new for JDK 1.2.2
addKeyListener(this);
requestFocus();
public void update(Graphics theGraphics)
// Create the offscreen graphics context, if no good one exists.
if (offGraphics == null || width != offDimension.width || height != offDimension.height)
// This better be the same as when the game was started
offDimension = getSize();
offImage = createImage(offDimension.width, offDimension.height);
offGraphics = offImage.getGraphics();
offGraphics.setFont(font);
displayStars();
displayPhotons();
displayMissile();
displayAsteroids();
displayUfo();
//displayShip();
//Load the game with different color of the space ship
displayNewShip();
displayExplosions();
displayStatus();
displayInfoScreen();
// Copy the off screen buffer to the screen.
theGraphics.drawImage(offImage, 0, 0, this);
private void displayInfoScreen()
String message;
if (!playing)
offGraphics.setColor(Color.white);
offGraphics.drawString("\'A\' to Change Font Attribute", 25, 35);
offGraphics.drawString(getTitle(), (width - fontMetrics.stringWidth(message)) / 2, height / 2
- fontHeight);
message = "The Training Mission";
offGraphics.drawString(message, (width - fontMetrics.stringWidth(message)) / 2, height / 2);
message = "Name of Author";
offGraphics.drawString(message, (width - fontMetrics.stringWidth(message)) / 2, height / 2
+ fontHeight);
message = "Original Copyright 1998-1999 by Mike Hall";
offGraphics.drawString(message, (width - fontMetrics.stringWidth(message)) / 2, height / 2
+ (fontHeight * 2));
if (!loaded)
message = "Loading sounds...";
int barWidth = 4 * fontWidth + fontMetrics.stringWidth(message);
int barHeight = fontHeight;
int startX = (width - barWidth) / 2;
int startY = 3 * height / 4 - fontMetrics.getMaxAscent();
offGraphics.setColor(Color.black);
offGraphics.fillRect(startX, startY, barWidth, barHeight);
offGraphics.setColor(Color.gray);
if (clipTotal > 0)
offGraphics.fillRect(startX, startY, (barWidth * clipsLoaded / clipTotal), barHeight);
offGraphics.setColor(Color.white);
offGraphics.drawRect(startX, startY, barWidth, barHeight);
offGraphics
.drawString(message, startX + 2 * fontWidth, startY + fontMetrics.getMaxAscent());
else
message = "Game Over";
offGraphics.drawString(message, (width - fontMetrics.stringWidth(message)) / 2, height / 4);
message = "'S' to Start";
offGraphics.drawString(message, (width - fontMetrics.stringWidth(message)) / 2, height / 4
+ fontHeight);
else if (paused)
offGraphics.setColor(Color.white);
message = "Game Paused";
offGraphics.drawString(message, (width - fontMetrics.stringWidth(message)) / 2, height / 4);
public String getTitle() {
System.out.print(title);
return title;
public void setTitle(String title) {
this.title = title;
}displayInfoScreen method in class A calls out for getTitle( ) to be displayed on an applet as an initial display string for the application.
The instance variable title is set by setTitle method which is called out in class testA as follow,
public class testA extends TestCase
* testASprite constructor comment.
* @param name
* java.lang.String
public testA(String name)
super(name);
* Insert the method's description here.
* @param args
* java.lang.String[]
public static void main(String[] args)
junit.textui.TestRunner.run(suite());
// need to figure out how to get rid of the frame in this test
System.exit(0);
public static Test suite()
return new TestSuite(testA.class);
* Basic create and simple checks
public void testCreate()
A theGame = new A();
assertNotNull("game was null!", theGame);
* Basic create and simple checks
public void testInit()
A theGame = new A();
Frame gameFrame = new Frame("THE GAME");
gameFrame.add(theGame);
int width = 640;
int height = 480;
gameFrame.setSize(width, height);
// must pack to get graphics peer
gameFrame.pack();
theGame.resize(width, height);
theGame.setTitle("TEST THE GAME");
theGame.init();
assertEquals("ASprite width not set", A.width, width);
gameFrame.dispose();
gameFrame.remove(theGame);
}Basically, class testA invokes the init( ) method in class A and start the applet application. However, it displays a white blank display. If I change the getTitle( ) in the displayInfoScreen method to a fixed string, it works fine. Did I forget anything as far as using getter & setter method? Do I have to specify some type of handle to sync between setter and getter between two classes? Any feedback will be greatly appreciated.
Thanks.Your class A extends runnable which leads me to believe that this is a multi-threaded application. In that case, title may or may not be a shared variable. Who knows? It's impossible to tell from what you posted.
Anyway, what is happening is that your applet is being painted by the JFrame before setTitle is called. After that, who knows what's happening. It's a complicated application. I suspect that if you called setTitle before you added the applet to the frame, it would work. -
Use LogRotationType="date" for WebServer in config.xml eats 99% CPU
FYI. By accident I found out to set LogRotationType="date" for WebServer in config.xml eats 99%
of CPU on my NT server constantly. To remove it fixed the problem. I don't understand why, assume
this may be a bug.
The is the setup I had for WebServer in my config.xml.
<WebServer
HttpsKeepAliveSecs="120"
KeepAliveSecs="60"
LogFileName="./config/myserver/logs/access.log"
LogRotationType="date"
LoggingEnabled="true"
Name="myserver"
Targets="myserver"
/>This looks like a bug for technical support. I suggest that you submit a
bug report to [email protected]
Be sure to include a complete test case.
Michael Girdley
BEA Systems
Learning WebLogic? http://learnweblogic.com
"Vivien" <[email protected]> wrote in message
news:3a704ace$[email protected]..
>
FYI. By accident I found out to set LogRotationType="date" for WebServerin config.xml eats 99%
of CPU on my NT server constantly. To remove it fixed the problem. Idon't understand why, assume
this may be a bug.
The is the setup I had for WebServer in my config.xml.
<WebServer
HttpsKeepAliveSecs="120"
KeepAliveSecs="60"
LogFileName="./config/myserver/logs/access.log"
LogRotationType="date"
LoggingEnabled="true"
Name="myserver"
Targets="myserver"
/> -
Setting up default toString() in xml schema
I have an xml schema and xml file that contains info for an app I created. Inside of the app, I load the objects into a combo box for the user to select an item. I want the actual objects in the combo box to access the data directly.
Because of the nature of the combo box, it uses toString() for the actual display. In this case I have to modify the impl code to add in a toString() function for this to work correctly, and not give me the name of the object.
Is there away to setup the xsd file to default one the attributes in the xml file to be returned with toString()?
Example:
<xsd:element name="JFeatsList" type="JFeatsType"/>
<xsd:complexType name="JFeatsType">
<xsd:sequence>
<xsd:element name="JFeatItem" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
<xsd:attribute name="FeatName" type="xsd:string"/>
<xsd:attribute name="FeatType" type="xsd:string"/>
<xsd:attribute name="Notes" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
...I want the FeatName to be sent back with a toString() call.
Thanks,
MikeI'm an XML newbie myself, so I've probably just finished reinventing some wheels, but in any case, I've written some code that makes reading XML pretty easy.
Here are some useful links:
http://java.sun.com/webservices/docs/1.0/tutorial/index.html
http://java.sun.com/webservices/download.html
http://java.sun.com/webservices/downloads/webservicespack.html
The latter contains C:\jwsdp-1_0_01\samples\jaxp\DOMEcho\DOMEcho.java, which creates a DOM from the XML file, and then traverses the DOM tree. For example, if I want to read the "Company motto" from my XML file: <GUIconstants>
<!-- Company motto
-->
<MOTTO value=""There's a sucker born every minute!""/>
<!-- ComboBox mappings; can be any of DatabaseFieldDefinitions (and if you
really, really, really don't want so many choices, you can completely
remove the "combo_3" entry, for example).
0 - ORIGIN_COLUMN -> Origin airport (ex. alternative: TIME_COLUMN)
1 - DESTINATION_COLUMN -> Destination airport (or: FLIGHT_NUMBER)
2 - CARRIER_COLUMN -> Carrier (or: DAY_COLUMN)
3 - FOSTERS_BEER_COLUMN -> pROGRAMMING pRODUCTIVITY aID
-->
<ComboBox_DatabaseField_Mappings
combo_0="ORIGIN_COLUMN"
combo_1="DESTINATION_COLUMN"
combo_2="CARRIER_COLUMN"
combo_3="DAY_COLUMN">
</ComboBox_DatabaseField_Mappings>I have some code like:case Node.ELEMENT_NODE:
category += "." + node.getNodeName();
String temp = category;
if (temp.startsWith(".FBNconfiguration")) {
temp = temp.substring(".FBNconfiguration".length());
// FBNconfiguration.GUIconstants
else if (temp.startsWith(".GUIconstants")) {
temp = temp.substring(".GUIconstants".length());
// FBNconfiguration.GUIconstants.MOTTO
if (temp.equals(".MOTTO"))
Solitaires.MOTTO = new XMLconversion(node).get(Solitaires.MOTTO);
* A class to package what's left over
static class Solitaires {
static String COMMAND_LINE_OPTIONS;
static int PORT;
static String WEEKDAYS;
static int LOCK_DATABASE;
static int LOCK_LEASE_DURATION;
static String MOTTO;
static int SCROLLPANE_JTABLE_WIDTH_DIFFERENCE;
static boolean BUG_4736093_WORKAROUND;
}XMLconversion is a pretty simple class:package suncertify.fbn.xml;
import org.w3c.dom.*;
* <p>Title: Fly by Night Travels</p>
* <p>Description: Sun Certified Java Developer application</p>
* <p>Copyright: Copyright (c) 2002</p>
* <p>Company: Fly by Night Consultants</p>
* @author Thomas Fly
* @version 1.0
* Convert a single ("Solitaire") XML entry
public class XMLconversion {
String value;
public XMLconversion(Node node) {
NamedNodeMap atts = node.getAttributes();
value = atts.item(0).getNodeValue();
public XMLconversion(Node node, boolean concatenate) {
NamedNodeMap atts = node.getAttributes();
value = "";
for (int i = 0; i < atts.getLength(); i++) {
Node att = atts.item(i);
value += atts.item(i).getNodeValue() + "\n";
public String get(String dataType) {
return value;
public int get(int dataType) {
return new Integer(value).intValue();
public boolean get(boolean dataType) {
return value.equalsIgnoreCase("true");
}Then in my FBNconstants class, I have stuff like:// GUIconstants
MOTTO = Solitaires.MOTTO;
COMBO_CONTENTS = comboBox_DatabaseField_Mappings.COMBO_CONTENTS;By extension, you can read into HashMap's & ArrayList's, and retrieve the translated objects as required. -
Request for sample code, Validating XML Schema
Does anyone have some sample code to validate
an XML Schema with the Oracle parser?
Also, the classgen code seems to have more XML Schema classes in it. There is an xschema.jar full of XML Schema related code. Would it be possible to use this code?
I've tried DOMSample.java with the v2 parser. It seems to happily echo Schema based XML files that are obviously wrong. (I use Tibco's XML Authority to verify the XML file and XML Schema).I do not have sample code but it is not a difficult API to call. I have worked on it before, so if you have a specific question on it, happy to help out if I can.
-
Some pages tell me I don't have cookies enabled, I get the same message with IE and I do have IE set to accept all cookies
See also:
* http://kb.mozillazine.org/Cookies
* http://kb.mozillazine.org/Websites_report_cookies_are_disabled
Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
*Don't make any changes on the Safe mode start window.
*https://support.mozilla.com/kb/Safe+Mode
*https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes -
Xml Schema xs:choice element in dynamic forms
Hi all,
I'm developing an xml schema for creating the data model of a form. I connect LC Designer-8.2ES to this schema.
In the schema I do have mutually exclusive elements implemented with a <xs:choice> element. A very comparable situation was described in this thread : http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=123 in 2007.
The problem, as related in this thread, is that only the very first element of the choice is displayed in the generated pdf and I don't know how to display all parts as a real choice. So what's the best way to let user fill in one part or the other of the choice?
Does it need to be implemented with scripting (xfa...myform.presence = visible | hidden)?
I want that only the filled element of the choice be exported from the form, the resulting xml being valid according the schema. I seems to work, but as of now, only for the first element...
BTW, what's the best document describing what parts of xml schema are usable in dynamic XFA forms? Is it 100% compatible? I've observed that the constraints in my schema are not validated in the forms. Shouldn't xml schema generate validating script in LCD? Does it apply for a subset of xml schema?
Thanks in advance,
jgrdHi all,
finally, I understand that we cannot use "anonymous" sequences neither in LiveCycle (like this following example where person might have many email)
<xs:element name="person">
<xs:complexType>
<xs:sequence maxOccurs="unbounded">
<xs:element name="email" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
valid instance with 3 emails :
<person xsi:noNamespaceSchemaLocation="Untitled39.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<email>String</email>
<email>String</email>
<email>String</email>
</person>
In LC Designer, element with same name (<email>) are not used AFAK. Maybe I'm wrong?
The same hands with <xs:choice> where only first choice appears in pdf although being present in LC Designer.
As for sequences, my idea is to produce <email1>, <email2>, etc. in a static schema, before connecting schema's data to LCD.
Hope someone can show up and tell it's the right way or not.
Regards
jgrd -
Sorting with layout set for NewsBrowser and custom made properties
Hi
I have developed some custom made properties that is used for each document based on XML Form. But how can I obtain a custom sorting order based on my properties.
After created a document I define some properties for company, department and process. And using the layout set for NewsBrowser I will have my documents sorted due to my processes. Lets say that I have set the properties for the process for some documents, e.g. SA1010, SA1010-1, SA1010-1a, how to obtain this sorting order in a KM-Navigation-iView using layout set for NewsBrowser?
Regards
Kay-Arne
Message was edited by: Kay-Arne S. AarlieHi Kay-Arne,
A namespace defines a system area in which a property (defined by a property ID) is allowed to exist only once. So for your own predefined properties you should use an own namespace in order to be able to use a Property ID that is already available in another namespace. Check this link for more info:
http://help.sap.com/saphelp_nw04/helpdata/en/1a/9a4a3b80f2ec40aa7456bc87a94259/frameset.htm
In the Property Definition you later use the Namespace Alias. This alias (with ":PropertyID") you would also use in the LayoutSet Parameter mentioned above.
Hope this clarify things ,
Robert -
Trouble Using Netbeans and XML Schema
I am currently experimenting on using XML files to store data for a game that I am developing. I had been using NetBeans 5.5 to validate my XML Schema (I am still new to XSD); however, now I am getting errors and have been trying for the better part of the week but am still unable to resolve them. Here is a clip from one of the schemas:
<?xml version="1.0" encoding="ISO-8859-1" standalone="no" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:cdt="http://JoaL.blissfulTragedy.com/Characters"
targetNamespace="http://JoaL.blissfulTragedy.com/Characters" >
<!-- Document to Define Character Attributes and their current Constraints -->
<!-- Character Name -->
<xs:simpleType name="name">
<xs:restriction base="xs:NMTOKEN">
<xs:maxLength value="15" />
</xs:restriction>
</xs:simpleType>
... When I validate the XML (the two down arrows) I get the following errors for every restriction I have declared:
s4s-att-invalid-value: Invalid attribute value for 'base' in element 'restriction'. Recorded reason: UndeclaredPrefix: Cannot resolve 'xs:NMTOKEN' as a QName: the prefix 'xs' is not declared.After retyping the file three times I tried one of the stock NetBeans schemas, which will produce the same error whenever I add a restriction through the UI.
Any advice will be greatly appreciated :PI think this is a dirty great bug in the Sun version of the apache Xerces classes that were bundled with jdk1.5.
I've had similar problems, and it seems to boil down to the fact that the NamespaceSupport class's getURI method does == instead of .equals when looking up the uri for a particular prefix. I'm told that this is a deliberate feature for the Apache stuff, and that the class assumes interned strings or strings that have gone through their internal SymbolTable mechanism, and that I can work around it by using interned strings. However, it is one of their classes that fails to intern the string (or put it through the symbol table etc.), so that doesn't really make sense as there are no hooks into this stuff.
They have even marked the bug as closed/fixed, and I'm attempting to re-raise it at present (so it'll be fixed in about ten years then). -
BC Sets for Product Compliance
Hi guys,
We are looking at option of copying customization table values using BC sets for Product Compliance.
I don't think we can use BC sets for Incident Management and Risk Assessment part.
However I know you can use BC sets for product compliance part so my question is how do we use
BC sets? Any documentation/link or suggestions on what are the steps?Dear D M
we are not using BC sets. I have only come in touch with them using EHS classic and not EHSM.
Check may be this SAP online help to get some ideas:
Business Configuration Sets (BC-CUS) - SAP Library
C.B.
PS: you can execute in any case what is known as an "cross transport"; This option should be well known (I assume) as it it one "classical" solution to get one configuraiton from one SAP system to a different one (pay attention: Release status should be the same; but this is true as well for BC sets).
this is nbot the same as using a BC set ! -
Can we put time on receive activity using correlation sets ?
I am using correlation sets for po process using ponumber.
In our process we send po message out and then wait(receive) for the response.
The receive activity will go into dehydration while waiting
for the response with the ponumber.
Is there any way to put a time on this receive activity so that we
can continue with the flow after certain time.
I was able to terminate the whole process by putting alarm
around the receive, but I want the process to just stop the
receive activity and continue with rest of the process.Hi,
By substituting receive with pick/onMessage/onAlarm, you should be able to implement the behavior you are looking for.
-Edwin -
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 ChangHi 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 -
I was wondering what size restrictions there are on XML schemas? I'm developing a schema that has just raised the following error on registration.
ERROR at line 1:
ORA-31084: error while creating table "CAS"."swift564357_TAB" for element "swift564"
ORA-01792: maximum number of columns in a table or view is 1000
ORA-02310: exceeded maximum number of allowable columns in table
ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 0
ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 151
ORA-06512: at line 828
On removing a few elements from the schema it registers fine, but querying the generated table swift564xxx_TAB there is only ever one column, typed with an ADT that itself only has 5 elements. In fact there doesn't seem to be, on the face of it, any type that has more than 20-30 elements. Where does this error come from then?
Unfortunately the schema exceeds the 20k limit on postings. I can split it up and post it in two parts if this would help.
Thanks
MarcEach attribute in the ADT and each attribute of attributes which are an ADT count as one column
Here's a snippet from the next version of the doc that may help...
3-20 Oracle XML DB Developer’s Guide, Rel. 1(10.1) Beta 2 Draft
A number of issues can arise when working with large, complex XML Schemas.
Sometimes the error "ORA-01792: maximum number of columns in a table or view
is 1000" will be ecountered when registering an XML Schema or creating a table
based on a global element defined by an XML Schema. This error occurs when an
attempt is made to create an XMLType table or column based on a global element
and the global element is defined as a complexType that contains a very large
number of element and attribute definitions.
The errors only occurs when creating an XMLType table or column that uses object
relational storage. When object relational storage is selected the XMLType is
persisted as a SQL Type. When a table or column is based on a SQL Type, each
Registering an XML Schema with Oracle XML DB
attribute defined by the Type counts as a column in the underlying table. If the SQL
Type contains attributes that are based on other SQL Types, the attributes defined
by those Types also count as columns in the underlying table. If the total number of
attributes in all the SQL types exceeds the Oracle limits of 1000 columns in a table
the storage table cannot be created.
This means that as the total number of elements and attributes defined by a
complexType approaches 1000, it is no longer possible to create a single Table that
can manage the SQL Objects generated when an instance of the Type is stored in the
database.
In order to resolve this problem it is necessary to reduce the total number of
attributes in the SQL Types that are used create the storage tables. Looking at the
schema there are two approaches that can be used to achieve this:
The first approach uses a ’top-down’ technique that uses multiple XMLType
tables to manage the XML documents. This technique reduces the number of
SQL attributes in the SQL Type heirarchy for a given storage table. As long as
none of the tables need manage more than 1000 attributes the problem is
resolved.
The second approach uses a ’bottom-up’ technique that reduces the number of
SQL attributes in the SQL Type herirarchy collapsing some of elements and
attributes defined by the XMLSchema so that they are stored as a single CLOB.
Both techniques rely on annotating the XML Schema to define how a particular
complexType will stored in the database.
In the case of the top down techniqueby the annotations SQLInline="false" and
defaultTable are used to force some sub-elements within the XML Document to
be stored as rows in a seperate XMLType table. Oracle XML DB maitains the
relationship between the two tables using a REF of XMLType Good candidates
for this approach are XML Schemas that define a choice where each element
within the choice is defined as a complexType, or where the XML Schema
defines an element based on a complexType that contains a very large number
of element and attribute definitions.
The bottom up technique involves reducing the total number of attributes in the
SQL object types by choosing to store some of the lower level complexTypes as
CLOBs, rather than objects. This is acieved by annotating the complexType or
the usage of the complexType with SQLType="CLOB".
Which technique is best depends on the application, and the kind of queries and
updates that need to be performed against the data. -
XML Schema binding - dynamic form
I am new to Designer and XML. I have been given a basic interactive form and have persevered for a couple of (often frustrating) weeks to extend its functionality to link to an xml schema and provide for dynamic record creation. Unfortunately I am still having problems when adding new instances of subforms.<br /><br />I have a main form for reporting issues. Underneath it there are major components on a subform (can be multiple major components for each issue) and under major components are sub-components (can be multiple sub-components for each major component) on a child subform of major. I can add and delete instances of the subforms for both levels of records.<br /><br />I have created an xml schema based on the form since it already existed, and so the form fields have not inherited properties from the schema. However, I have bound the fields in the form to the xml fields through a data connection. The schema basically looks as follows (bot not literally the same as you will see from the tags):<br /><br /><element complextype issue><br /> <element issueId string/><br /> ...<br /> ...<br /> <element complextype majorcomponent unbounded><br /> <element majcomponentname string/><br /> ...<br /> <element complextype subcomponent unbounded><br /> <element subcomponent string/><br /> <element quantity string/><br /> ...<br /> ...<br /> </element><br /> </element><br /></element><br /><br />My problem is as follows: <br /><br />When I add an instance of a sub-component or major component subform, the first new instance appears to work correctly. However, every subsequent one inherits the values of the previous record and when it is changed, it changes the values of existing fields of the same name but of a different node. When I change each element in the xml schema to "unbounded", the forms appear to work properly but the values are then not nested correctly in the outputted xml data file (many records will appear under one sub-component, for example, when a new sub-component should be added for each).<br /><br />I suspected my problem might be that the "unbounded" property in the schema of the major component and sub-component elements are not linked to the Designer form because the major component and sub-component subforms are not bound to the xml schema. The reason they are not bound is because if I bind the subform, the first element, major/sub component name as applicable, loses its binding.<br /><br />I am sorry if this doesn't make any sense but I am hoping that someone might recognise the problem I am talking about as it is really creating much bother.<br /><br />Thanks.
Thanks Justin for the reply. Unfortunately I can't explain exactly what was happening because I didn't keep sufficient notes and now the form is behaving differently. You are right in that when I bind the subform to the xml schema element, child fields do change their bindings from a full to a relative path. I had seen this before on all except the first field on a subform, which had losts any binding reference at all.
I finally gave up on the schema and bound the forms to sample xml data. This fixed my problem. Now (several days later), I have revisited the problem and deleted my data connection to the xml file to connect to the schema once again. I am quite sure I have not changed the schema at all, nor the form, but for some reason it now appears to work correctly.
I will continue to work with it, once again but thanks very much for your interest.
Maybe you are looking for
-
I have a ton of music that I purchased when my Mac account had a yahoo email address. I've updated my account to include my current mac address. iTunes won't allow me to play any of the old music, and it asks me to sign in with my yahoo address versi
-
Inactive connection in update rules
Hello, How do I update my update rules for 0MATERIAL_ATTR in the production system (BW prod)? I have attempted to transport the update from dev. I have the info object in the uodate rules, but not the connection to the source field. How do I get the
-
List of attribute for INFOOBJECTS
Hi, Using QueryBuilder, I need a list of attribute to be able to create a SQL that will provide me with the info that I need. Is there a link to access such a list?
-
Can someone please tell me if Flash 10.1 is now installable on the N900? If so, which Linux version do I install? (YUM, Tarring, RPM or Db)?? Any help would be appreciated.
-
ML Sleeps While Programs are Running
Twice now, my iMac running Mountain Lion has fallen asleep while a program is actively running. (Ex. Encoding a movie in Handbrake and burning a BD disc with Toast.) Does anyone know why this is happening? I have never had issues with my Mac sleep